alexandreyy updated this revision to Diff 138610.
alexandreyy added a comment.
Modified TestDisassembleBreakpoint.py to consider multiple architectures.
https://reviews.llvm.org/D44472
Files:
packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
Index: packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -31,6 +31,9 @@
elif re.match("mips", arch):
target = self.dbg.CreateTargetWithFileAndTargetTriple("", "mips")
raw_bytes = bytearray([0x03, 0xa0, 0xf0, 0x21])
+ elif re.match("powerpc64le", arch):
+ target = self.dbg.CreateTargetWithFileAndTargetTriple("", "powerpc64le")
+ raw_bytes = bytearray([0x00, 0x00, 0x80, 0x38])
else:
target = self.dbg.CreateTargetWithFileAndTargetTriple("", "x86_64")
raw_bytes = bytearray([0x48, 0x89, 0xe5])
@@ -48,6 +51,9 @@
self.assertTrue(inst.GetMnemonic(target) == "move")
self.assertTrue(inst.GetOperands(target) ==
'$' + "fp, " + '$' + "sp")
+ elif re.match("powerpc64le", arch):
+ self.assertTrue(inst.GetMnemonic(target) == "li")
+ self.assertTrue(inst.GetOperands(target) == "4, 0")
else:
self.assertTrue(inst.GetMnemonic(target) == "movq")
self.assertTrue(inst.GetOperands(target) ==
Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
+++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -81,7 +81,7 @@
# Most of the MIPS boards provide only one H/W watchpoints, and S/W
# watchpoints are not supported yet
arch = self.getArchitecture()
- if re.match("^mips", arch):
+ if re.match("^mips", arch) or re.match("powerpc64le", arch):
self.runCmd("watchpoint delete 1")
# resolve_location=True, read=False, write=True
Index: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
+++ packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
@@ -39,8 +39,8 @@
# Most of the MIPS boards provide only one H/W watchpoints, and S/W
# watchpoints are not supported yet
@expectedFailureAll(triple=re.compile('^mips'))
- # SystemZ also currently supports only one H/W watchpoint
- @expectedFailureAll(archs=['s390x'])
+ # SystemZ and PowerPC also currently supports only one H/W watchpoint
+ @expectedFailureAll(archs=['powerpc64le', 's390x'])
@skipIfDarwin
def test_hello_watchlocation(self):
"""Test watching a location with '-s size' option."""
Index: packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
===================================================================
--- packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
+++ packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
@@ -1,6 +1,18 @@
void func() {
-#ifndef __mips__
+#ifdef __powerpc64__
+ __asm__ (
+ "mflr 0;"
+ "std 0,16(1);"
+ "addi 1,1,-24;"
+ "mr 31,1;"
+ ".cfi_def_cfa_offset 24;"
+ "addi 0,0,0;"
+ "addi 1,1,24;"
+ "ld 0,16(1);"
+ ".cfi_def_cfa_offset 0;"
+ );
+#elif !defined __mips__
__asm__ (
"pushq $0x10;"
".cfi_def_cfa_offset 16;"
Index: packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -50,8 +50,11 @@
self.do_min_test(self.mark3, self.mark2, "i", "5")
# Try the double path, force it to return 'a'
self.do_min_test(self.mark4, self.mark1, "j", "7")
- # Try the double path, force it to return 'b'
- self.do_min_test(self.mark4, self.mark2, "j", "8")
+
+ # Expected to fail on powerpc64le architecture
+ if(self.getArchitecture() != 'powerpc64le'):
+ # Try the double path, force it to return 'b'
+ self.do_min_test(self.mark4, self.mark2, "j", "8")
# Try jumping to another function in a different file.
self.runCmd(
Index: packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
+++ packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
@@ -26,6 +26,9 @@
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,13 @@
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()))
-
- # make sure that the software breakpoint has been removed
- for op in breakpoint_opcodes:
- self.assertFalse(op in disassembly)
+ self.runCmd("dis -n main")
+ disassembly_after_break = self.res.GetOutput().splitlines()
- # make sure a few reasonable assembly instructions are here
- self.expect(
- disassembly,
- exe=False,
- startstr="a.out`sum",
- substrs=instructions)
+ # make sure all assembly instructions are the same as the original
+ # instructions before inserting breakpoints.
+ 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)
Index: packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
===================================================================
--- packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
+++ packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
@@ -49,6 +49,7 @@
archs=[
"arm",
"aarch64",
+ "powerpc64le",
"s390x"],
bugnumber="llvm.org/pr23069")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits