mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-12 13:37:16 +00:00

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
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
"""
|
|
Test some lldb command abbreviations.
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
|
|
import os
|
|
import time
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
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()
|
|
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)
|