diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:28:34 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:28:34 +0000 |
commit | bb00d0b6b29a2ab1c59d3040a21f14156d8779df (patch) | |
tree | cbe5c64120aa89abbfd4cfc9e6d54b958f0e85bd /lldb/packages/Python/lldbsuite | |
parent | 7311bb34f63df58edb4819e5b483b49932b371bd (diff) | |
download | bcm5719-llvm-bb00d0b6b29a2ab1c59d3040a21f14156d8779df.tar.gz bcm5719-llvm-bb00d0b6b29a2ab1c59d3040a21f14156d8779df.zip |
Support Linux on SystemZ as platform
This patch adds support for Linux on SystemZ:
- A new ArchSpec value of eCore_s390x_generic
- A new directory Plugins/ABI/SysV-s390x providing an ABI implementation
- Register context support
- Native Linux support including watchpoint support
- ELF core file support
- Misc. support throughout the code base (e.g. breakpoint opcodes)
- Test case updates to support the platform
This should provide complete support for debugging the SystemZ platform.
Not yet supported are optional features like transaction support (zEC12)
or SIMD vector support (z13).
There is no instruction emulation, since our ABI requires that all code
provide correct DWARF CFI at all PC locations in .eh_frame to support
unwinding (i.e. -fasynchronous-unwind-tables is on by default).
The implementation follows existing platforms in a mostly straightforward
manner. A couple of things that are different:
- We do not use PTRACE_PEEKUSER / PTRACE_POKEUSER to access single registers,
since some registers (access register) reside at offsets in the user area
that are multiples of 4, but the PTRACE_PEEKUSER interface only allows
accessing aligned 8-byte blocks in the user area. Instead, we use a s390
specific ptrace interface PTRACE_PEEKUSR_AREA / PTRACE_POKEUSR_AREA that
allows accessing a whole block of the user area in one go, so in effect
allowing to treat parts of the user area as register sets.
- SystemZ hardware does not provide any means to implement read watchpoints,
only write watchpoints. In fact, we can only support a *single* write
watchpoint (but this can span a range of arbitrary size). In LLDB this
means we support only a single watchpoint. I've set all test cases that
require read watchpoints (or multiple watchpoints) to expected failure
on the platform. [ Note that there were two test cases that install
a read/write watchpoint even though they nowhere rely on the "read"
property. I've changed those to simply use plain write watchpoints. ]
Differential Revision: http://reviews.llvm.org/D18978
llvm-svn: 266308
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
17 files changed, 36 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py index c0e5343f3b3..92ffdb69744 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py @@ -113,6 +113,8 @@ class BreakpointConditionsTestCase(TestBase): self.runCmd("breakpoint modify -c ($r0&&i)") elif re.match("mips",arch): self.runCmd("breakpoint modify -c ($r2&&i)") + elif arch in ['s390x']: + self.runCmd("breakpoint modify -c ($r2&&i)") self.runCmd("run") self.expect("process status", PROCESS_STOPPED, diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py index 4606846210c..be0ea144133 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -43,6 +43,9 @@ class DisassemblyTestCase(TestBase): 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())) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py index fb876c256b8..59bf6900816 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py @@ -19,6 +19,7 @@ class LinuxCoreTestCase(TestBase): _i386_pid = 32306 _x86_64_pid = 32259 + _s390x_pid = 1045 @skipIf(bugnumber="llvm.org/pr26947") def test_i386(self): @@ -29,6 +30,10 @@ class LinuxCoreTestCase(TestBase): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("x86_64", self._x86_64_pid) + def test_s390x(self): + """Test that lldb can read the process information from an s390x linux core file.""" + self.do_test("s390x", self._s390x_pid) + def test_same_pid_running(self): """Test that we read the information from the core correctly even if we have a running process with the same PID around""" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core Binary files differnew file mode 100644 index 00000000000..b97fc43e967 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out Binary files differnew file mode 100755 index 00000000000..640fbdc257d --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py index ce30d269bbf..4183e18e758 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -33,6 +33,7 @@ class HelloWatchLocationTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") @expectedFailureAll(triple = re.compile('^mips')) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet + @expectedFailureAll(archs=['s390x']) # SystemZ also currently supports only one H/W watchpoint @skipIfDarwin def test_hello_watchlocation(self): """Test watching a location with '-s size' option.""" diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py index bea438b43fe..22011f11352 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -20,6 +20,7 @@ class TestStepOverWatchpoint(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], bugnumber="llvm.org/pr26031") @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test(self): """Test stepping over watchpoints.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py index 9ad0052c73c..4ce05af96e2 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py @@ -32,6 +32,7 @@ class WatchpointCommandsTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_rw_watchpoint(self): """Test read_write watchpoint and expect to stop two times.""" self.build(dictionary=self.d) @@ -92,6 +93,7 @@ class WatchpointCommandsTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_rw_watchpoint_delete(self): """Test delete watchpoint and expect not to stop for watchpoint.""" self.build(dictionary=self.d) @@ -137,6 +139,7 @@ class WatchpointCommandsTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_rw_watchpoint_set_ignore_count(self): """Test watchpoint ignore count and expect to not to stop at all.""" self.build(dictionary=self.d) @@ -186,6 +189,7 @@ class WatchpointCommandsTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_rw_disable_after_first_stop(self): """Test read_write watchpoint but disable it after the first stop.""" self.build(dictionary=self.d) @@ -245,6 +249,7 @@ class WatchpointCommandsTestCase(TestBase): @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_rw_disable_then_enable(self): """Test read_write watchpoint, disable initially, then enable it.""" self.build(dictionary=self.d) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py index 81e9db7a07f..4240628e7bf 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py @@ -59,7 +59,7 @@ class TestWatchpointEvents (TestBase): self.listener.StartListeningForEvents (self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged) error = lldb.SBError() - local_watch = local_var.Watch(True, True, True, error) + local_watch = local_var.Watch(True, False, True, error) if not error.Success(): self.fail ("Failed to make watchpoint for local_var: %s"%(error.GetCString())) diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index bf06e184dc4..0da09dc99ce 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -29,6 +29,8 @@ def check_first_register_readable(test_case): test_case.expect("register read x0", substrs = ['x0 = 0x']) elif re.match("mips",arch): test_case.expect("register read zero", substrs = ['zero = 0x']) + elif arch in ['s390x']: + test_case.expect("register read r0", substrs = ['r0 = 0x']) else: # TODO: Add check for other architectures test_case.fail("Unsupported architecture for test case (arch: %s)" % test_case.getArchitecture()) diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index e753317e939..762726d81f7 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -168,6 +168,10 @@ else override ARCH := override ARCHFLAG := endif + ifeq "$(ARCH)" "s390x" + override ARCH := + override ARCHFLAG := + endif ifeq "$(findstring mips,$(ARCH))" "mips" override ARCHFLAG := - endif diff --git a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py index df5658a285f..bedf286e199 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py @@ -28,6 +28,7 @@ class SetWatchpointAPITestCase(TestBase): @add_test_categories(['pyapi']) @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_watch_val(self): """Exercise SBValue.Watch() API to set a watchpoint.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py index 3b6a3c8aae0..d7b45a533e3 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py @@ -28,6 +28,7 @@ class WatchpointIgnoreCountTestCase(TestBase): @add_test_categories(['pyapi']) @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ def test_set_watch_ignore_count(self): """Test SBWatchpoint.SetIgnoreCount() API.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py index 2ec106c3fcd..8bbb93af07e 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py @@ -58,7 +58,7 @@ class WatchpointIteratorTestCase(TestBase): # Watch 'global' for read and write. value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) error = lldb.SBError(); - watchpoint = value.Watch(True, True, True, error) + watchpoint = value.Watch(True, False, True, error) self.assertTrue(value and watchpoint, "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index b8108f39f3d..468f3131f33 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -93,6 +93,7 @@ class TargetWatchAddressAPITestCase(TestBase): @add_test_categories(['pyapi']) @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches + @skipIf(archs=['s390x']) # Likewise on SystemZ def test_watch_address_with_invalid_watch_size(self): """Exercise SBTarget.WatchAddress() API but pass an invalid watch_size.""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py index 464617511e8..a62b9a25400 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py @@ -234,18 +234,20 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase): # Test that --thread is optional self.runCmd("-exec-next-instruction --frame 0") self.expect("\^running") - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"") + # Depending on compiler, it can stop at different line + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(28|29)\"") # Test that --frame is optional self.runCmd("-exec-next-instruction --thread 1") self.expect("\^running") - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"") + # Depending on compiler, it can stop at different line + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"") # Test that both --thread and --frame are optional self.runCmd("-exec-next-instruction") self.expect("\^running") # Depending on compiler, it can stop at different line - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"") + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30|31)\"") # Test that an invalid --thread is handled self.runCmd("-exec-next-instruction --thread 0") diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py index 1bf7fff9c3b..340eb19521a 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -1355,6 +1355,9 @@ class GdbRemoteTestCaseBase(TestBase): #MIPS required "3" (ADDIU, SB, LD) machine instructions for updation of variable value if re.match("mips",arch): expected_step_count = 3 + #S390X requires "2" (LARL, MVI) machine instructions for updation of variable value + if re.match("s390x",arch): + expected_step_count = 2 self.assertEqual(step_count, expected_step_count) # Verify we hit the next state. |