From d5ee7ab47e3f3093c49a9fe0fab7326b14ff27d4 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 26 Mar 2018 12:42:07 +0000 Subject: Add and fix some tests for PPC64 Summary: TestExprsChar.py Char is unsigned char by default in PowerPC. TestDisassembleBreakpoint.py Modify disassemble testcase to consider multiple architectures. TestThreadJump.py Jumping directly to the return line on PowerPC architecture dos not means returning the value that is seen on the code. The last test fails, because it needs the execution of some assembly in the beginning of the function. Avoiding this test for this architecture. TestEhFrameUnwind.py Implement func for ppc64le test case. TestWatchLocation.py TestStepOverWatchpoint.py PowerPC currently supports only one H/W watchpoint. TestDisassembleRawData.py Add PowerPC opcode and instruction for disassemble testcase. Reviewers: labath Reviewed By: labath Subscribers: davide, labath, alexandreyy, lldb-commits, luporl, lbianc Differential Revision: https://reviews.llvm.org/D44472 Patch by Alexandre Yukio Yamashita . llvm-svn: 328488 --- .../disassembly/TestDisassembleBreakpoint.py | 45 +++++++--------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py index aee5f930ea1..2e0d4fda369 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -26,6 +26,9 @@ class DisassemblyTestCase(TestBase): 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, @@ -37,36 +40,16 @@ class DisassemblyTestCase(TestBase): self.expect("run", patterns=["Process .* launched: "]) - self.runCmd("dis -f") - disassembly = self.res.GetOutput() - - # ARCH, if not specified, defaults to x86_64. - arch = self.getArchitecture() - if arch in ["", 'x86_64', 'i386', 'i686']: - breakpoint_opcodes = ["int3"] - instructions = [' mov', ' addl ', 'ret'] - elif arch in ["arm", "aarch64", "arm64", "armv7", "armv7k"]: - breakpoint_opcodes = ["brk", "udf"] - instructions = [' add ', ' ldr ', ' str '] - elif re.match("mips", arch): - breakpoint_opcodes = ["break"] - instructions = ['lw', 'sw'] - elif arch in ["s390x"]: - breakpoint_opcodes = [".long"] - instructions = [' l ', ' a ', ' st '] - else: - # TODO please add your arch here - self.fail( - 'unimplemented for arch = "{arch}"'.format( - arch=self.getArchitecture())) + self.runCmd("dis -n main") + disassembly_after_break = self.res.GetOutput().splitlines() - # make sure that the software breakpoint has been removed - for op in breakpoint_opcodes: - self.assertFalse(op in disassembly) + # 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)) - # make sure a few reasonable assembly instructions are here - self.expect( - disassembly, - exe=False, - startstr="a.out`sum", - substrs=instructions) + 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) -- cgit v1.2.3