diff options
author | Pavel Labath <labath@google.com> | 2018-03-26 15:17:58 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-03-26 15:17:58 +0000 |
commit | 9a652a84b141901b6eb17a5948b0741e0febd141 (patch) | |
tree | 311bb741d67b3b740441f26cecb26e60fc7a0cc2 /lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py | |
parent | d95020108c48d785b99b08cce423134a8463a95d (diff) | |
download | bcm5719-llvm-9a652a84b141901b6eb17a5948b0741e0febd141.tar.gz bcm5719-llvm-9a652a84b141901b6eb17a5948b0741e0febd141.zip |
Fix TestDisassembleBreakpoint broken by r328488
The first issue was that the test was capturing the "before" disassembly
before launching, and the "after" after. This is a problem because some
of the disassembly will change after we know the load address (e.g. PCs
in call instructions). I fix this by capturing both disassemblies with
the process running.
The second issue was that the refactor in r328488 accidentaly changed
the meaning of the test, as it was no longer disassembling the function
which contained the breakpoint.
While inside, I also modernize the test to use
lldbutil.run_to_source_breakpoint and prevent debug-info replication.
llvm-svn: 328504
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py index 2e0d4fda369..52f9daf6bd4 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -16,40 +16,29 @@ from lldbsuite.test import lldbutil class DisassemblyTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + NO_DEBUG_INFO_TESTCASE = True @expectedFailureAll( oslist=["windows"], bugnumber="function names print fully demangled instead of name-only") def test(self): self.build() - exe = self.getBuildArtifact("a.out") - self.expect("file " + exe, - patterns=["Current executable set to .*a.out.*"]) - - self.runCmd("dis -n main") - disassembly_before_break = self.res.GetOutput().splitlines() - - match_object = lldbutil.run_break_set_command(self, "br s -n sum") - lldbutil.check_breakpoint_result( - self, - match_object, - symbol_name='sum', - symbol_match_exact=False, - num_locations=1) - - self.expect("run", - patterns=["Process .* launched: "]) - - self.runCmd("dis -n main") - disassembly_after_break = self.res.GetOutput().splitlines() - - # make sure all assembly instructions are the same as the original - # instructions before inserting breakpoints. - self.assertEqual(len(disassembly_before_break), - len(disassembly_after_break)) - - for dis_inst_before, dis_inst_after in \ - zip(disassembly_before_break, disassembly_after_break): - inst_before = dis_inst_before.split(':')[-1] - inst_after = dis_inst_after.split(':')[-1] - self.assertEqual(inst_before, inst_after) + target, _, _, bkpt = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", lldb.SBFileSpec("main.cpp")) + self.runCmd("dis -f") + disassembly_with_break = self.res.GetOutput().splitlines() + + self.assertTrue(target.BreakpointDelete(bkpt.GetID())) + + self.runCmd("dis -f") + disassembly_without_break = self.res.GetOutput().splitlines() + + # Make sure all assembly instructions are the same as instructions + # with the breakpoint removed. + self.assertEqual(len(disassembly_with_break), + len(disassembly_without_break)) + for dis_inst_with, dis_inst_without in \ + zip(disassembly_with_break, disassembly_without_break): + inst_with = dis_inst_with.split(':')[-1] + inst_without = dis_inst_without.split(':')[-1] + self.assertEqual(inst_with, inst_without) |