2 Test some lldb command abbreviations.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class DisassemblyTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
22 bugnumber="function names print fully demangled instead of name-only")
25 exe = os.path.join(os.getcwd(), "a.out")
26 self.expect("file " + exe,
27 patterns=["Current executable set to .*a.out.*"])
29 match_object = lldbutil.run_break_set_command(self, "br s -n sum")
30 lldbutil.check_breakpoint_result(
34 symbol_match_exact=False,
38 patterns=["Process .* launched: "])
41 disassembly = self.res.GetOutput()
43 # ARCH, if not specified, defaults to x86_64.
44 arch = self.getArchitecture()
45 if arch in ["", 'x86_64', 'i386', 'i686']:
46 breakpoint_opcodes = ["int3"]
47 instructions = [' mov', ' addl ', 'ret']
48 elif arch in ["arm", "aarch64"]:
49 breakpoint_opcodes = ["brk", "udf"]
50 instructions = [' add ', ' ldr ', ' str ']
51 elif re.match("mips", arch):
52 breakpoint_opcodes = ["break"]
53 instructions = ['lw', 'sw']
54 elif arch in ["s390x"]:
55 breakpoint_opcodes = [".long"]
56 instructions = [' l ', ' a ', ' st ']
58 # TODO please add your arch here
60 'unimplemented for arch = "{arch}"'.format(
61 arch=self.getArchitecture()))
63 # make sure that the software breakpoint has been removed
64 for op in breakpoint_opcodes:
65 self.assertFalse(op in disassembly)
67 # make sure a few reasonable assembly instructions are here