| 1 |
""" |
| 2 |
Test some lldb command abbreviations. |
| 3 |
""" |
| 4 |
|
| 5 |
|
| 6 |
import lldb |
| 7 |
from lldbsuite.test.decorators import * |
| 8 |
from lldbsuite.test.lldbtest import * |
| 9 |
from lldbsuite.test import lldbutil |
| 10 |
|
| 11 |
|
| 12 |
class DisassemblyTestCase(TestBase): |
| 13 |
NO_DEBUG_INFO_TESTCASE = True |
| 14 |
|
| 15 |
def test(self): |
| 16 |
self.build() |
| 17 |
target, _, _, bkpt = lldbutil.run_to_source_breakpoint( |
| 18 |
self, "Set a breakpoint here", lldb.SBFileSpec("main.cpp") |
| 19 |
) |
| 20 |
self.runCmd("dis -f") |
| 21 |
disassembly_with_break = self.res.GetOutput().splitlines() |
| 22 |
|
| 23 |
self.assertTrue(target.BreakpointDelete(bkpt.GetID())) |
| 24 |
|
| 25 |
self.runCmd("dis -f") |
| 26 |
disassembly_without_break = self.res.GetOutput().splitlines() |
| 27 |
|
| 28 |
# Make sure all assembly instructions are the same as instructions |
| 29 |
# with the breakpoint removed. |
| 30 |
self.assertEqual(len(disassembly_with_break), len(disassembly_without_break)) |
| 31 |
for dis_inst_with, dis_inst_without in zip( |
| 32 |
disassembly_with_break, disassembly_without_break |
| 33 |
): |
| 34 |
inst_with = dis_inst_with.split(":")[-1] |
| 35 |
inst_without = dis_inst_without.split(":")[-1] |
| 36 |
self.assertEqual(inst_with, inst_without) |