Skip to content
Permalink
Browse files

[lldb] [Process/NetBSD] Use global enable bits for watchpoints

Set global enable bits (i.e. bits 1, 3, 5, 7) to enable watchpoints
on NetBSD rather than the local enable bits (0, 2, 4, 6).  The former
are necessary for watchpoints to be correctly recognized by the NetBSD
kernel.  The latter cause them to be reported as trace points.

Differential Revision: https://reviews.llvm.org/D63792

llvm-svn: 364781
  • Loading branch information...
mgorny committed Jul 1, 2019
1 parent baf64b6 commit 0856721e3a06aaf2423186a6b4f97dea03c64c13
@@ -42,7 +42,6 @@ def setUp(self):
# SystemZ and PowerPC also currently supports only one H/W watchpoint
@expectedFailureAll(archs=['powerpc64le', 's390x'])
@skipIfDarwin
@expectedFailureNetBSD
def test_hello_watchlocation(self):
"""Test watching a location with '-s size' option."""
self.build(dictionary=self.d)
@@ -34,7 +34,6 @@ def setUp(self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
@add_test_categories(["basic_process"])
def test_hello_watchpoint_using_watchpoint_set(self):
"""Test a simple sequence of watchpoint creation and watchpoint hit."""
@@ -23,7 +23,6 @@ class MultipleHitsTestCase(TestBase):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@skipIf(bugnumber="llvm.org/pr30758", oslist=["linux"], archs=["arm", "aarch64", "powerpc64le"])
@skipIfwatchOS
@expectedFailureNetBSD
def test(self):
self.build()
exe = self.getBuildArtifact("a.out")
@@ -23,15 +23,13 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@skipIfNetBSD
def test_watchpoint_before_thread_start(self):
"""Test that we can hit a watchpoint we set before starting another thread"""
self.do_watchpoint_test("Before running the thread")

@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@skipIfNetBSD
def test_watchpoint_after_thread_start(self):
"""Test that we can hit a watchpoint we set after starting another thread"""
self.do_watchpoint_test("After running the thread")
@@ -25,7 +25,6 @@ class TestStepOverWatchpoint(TestBase):
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureAll(oslist=["ios", "watchos", "tvos", "bridgeos"], bugnumber="<rdar://problem/34027183>") # watchpoint tests aren't working on arm64
@expectedFailureNetBSD
@add_test_categories(["basic_process"])
def test(self):
"""Test stepping over watchpoints."""
@@ -41,7 +41,6 @@ def setUp(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_rw_watchpoint(self):
"""Test read_write watchpoint and expect to stop two times."""
self.build(dictionary=self.d)
@@ -170,7 +169,6 @@ def test_rw_watchpoint_delete(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
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)
@@ -231,7 +229,6 @@ def test_rw_watchpoint_set_ignore_count(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_rw_disable_after_first_stop(self):
"""Test read_write watchpoint but disable it after the first stop."""
self.build(dictionary=self.d)
@@ -302,7 +299,6 @@ def test_rw_disable_after_first_stop(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_rw_disable_then_enable(self):
"""Test read_write watchpoint, disable initially, then enable it."""
self.build(dictionary=self.d)
@@ -40,7 +40,6 @@ def setUp(self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
@@ -109,7 +108,6 @@ def test_watchpoint_command(self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
def test_watchpoint_command_can_disable_a_watchpoint(self):
"""Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
self.build(dictionary=self.d)
@@ -41,7 +41,6 @@ def setUp(self):
oslist=["linux"],
archs=["aarch64"],
bugnumber="llvm.org/pr27710")
@expectedFailureNetBSD
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
@@ -112,7 +111,6 @@ def test_watchpoint_command(self):
oslist=["linux"],
archs=["aarch64"],
bugnumber="llvm.org/pr27710")
@expectedFailureNetBSD
def test_continue_in_watchpoint_command(self):
"""Test continue in a watchpoint command."""
self.build(dictionary=self.d)
@@ -40,7 +40,6 @@ def setUp(self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
def test_watchpoint_cond(self):
"""Test watchpoint condition."""
self.build(dictionary=self.d)
@@ -27,7 +27,6 @@ def test_disable_works (self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
def test_disable_enable_works (self):
"""Set a watchpoint, disable it, and make sure it doesn't get hit."""
self.build()
@@ -39,7 +39,6 @@ def setUp(self):
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
@expectedFailureNetBSD
def test_watchlocation_using_watchpoint_set(self):
"""Test watching a location with 'watchpoint set expression -w write -s size' option."""
self.build()
@@ -36,7 +36,6 @@ def setUp(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_byte_size_watchpoints_with_byte_selection(self):
"""Test to selectively watch different bytes in a 8-byte array."""
self.run_watchpoint_size_test('byteArray', 8, '1')
@@ -46,7 +45,6 @@ def test_byte_size_watchpoints_with_byte_selection(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_two_byte_watchpoints_with_word_selection(self):
"""Test to selectively watch different words in an 8-byte word array."""
self.run_watchpoint_size_test('wordArray', 4, '2')
@@ -56,7 +54,6 @@ def test_two_byte_watchpoints_with_word_selection(self):
bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@expectedFailureNetBSD
def test_four_byte_watchpoints_with_dword_selection(self):
"""Test to selectively watch two double words in an 8-byte dword array."""
self.run_watchpoint_size_test('dwordArray', 2, '4')
@@ -764,7 +764,7 @@ Status NativeRegisterContextNetBSD_x86_64::IsWatchpointVacant(uint32_t wp_index,

uint64_t control_bits = reg_value.GetAsUInt64();

is_vacant = !(control_bits & (1 << (2 * wp_index)));
is_vacant = !(control_bits & (1 << (2 * wp_index + 1)));

return error;
}
@@ -803,7 +803,7 @@ Status NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpointWithIndex(
return error;

// for watchpoints 0, 1, 2, or 3, respectively, set bits 1, 3, 5, or 7
uint64_t enable_bit = 1 << (2 * wp_index);
uint64_t enable_bit = 1 << (2 * wp_index + 1);

// set bits 16-17, 20-21, 24-25, or 28-29
// with 0b01 for write, and 0b11 for read/write

0 comments on commit 0856721

Please sign in to comment.
You can’t perform that action at this time.