[Lldb-commits] [lldb] 7dd790d - [lldb] NFC fixes addressing David's feedback
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 1 19:17:50 PST 2024
Author: Jason Molenda
Date: 2024-02-01T19:17:44-08:00
New Revision: 7dd790db8b77c4a833c06632e903dc4f13877a64
URL: https://github.com/llvm/llvm-project/commit/7dd790db8b77c4a833c06632e903dc4f13877a64
DIFF: https://github.com/llvm/llvm-project/commit/7dd790db8b77c4a833c06632e903dc4f13877a64.diff
LOG: [lldb] NFC fixes addressing David's feedback
David Spickett had several suggestions for
https://github.com/llvm/llvm-project/pull/79962 after I'd
already merged it. Address those.
Added:
Modified:
lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
lldb/source/Breakpoint/WatchpointResource.cpp
lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h b/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
index 8871e4e5e84e6..a9ec070bbcfe2 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
@@ -21,8 +21,7 @@ class WatchpointAlgorithms {
public:
/// Convert a user's watchpoint request into an array of memory
- /// regions that can be watched by one hardware watchpoint register
- /// on the current target.
+ /// regions, each region watched by one hardware watchpoint register.
///
/// \param[in] addr
/// The start address specified by the user.
@@ -61,18 +60,21 @@ class WatchpointAlgorithms {
lldb::addr_t addr, size_t size, bool read, bool write,
lldb::WatchpointHardwareFeature supported_features, ArchSpec &arch);
+protected:
struct Region {
lldb::addr_t addr;
size_t size;
};
-protected:
- /// Convert a user's watchpoint request into an array of addr+size that
- /// can be watched with power-of-2 style hardware watchpoints.
+ /// Convert a user's watchpoint request into an array of Regions,
+ /// each of which can be watched by a single hardware watchpoint
+ /// that can watch power-of-2 size & aligned memory regions.
///
/// This is the default algorithm if we have no further information;
/// most watchpoint implementations can be assumed to be able to watch up
- /// to pointer-size regions of memory in power-of-2 sizes and alingments.
+ /// to sizeof(void*) regions of memory, in power-of-2 sizes and alignments.
+ /// e.g. on a 64-bit target: 1, 2, 4, 8 or bytes with a single hardware
+ /// watchpoint register.
///
/// \param[in] user_addr
/// The user's start address.
@@ -81,7 +83,8 @@ class WatchpointAlgorithms {
/// The user's specified byte length.
///
/// \param[in] min_byte_size
- /// The minimum byte size supported on this target.
+ /// The minimum byte size of the range of memory that can be watched
+ /// with one watchpoint register.
/// In most cases, this will be 1. AArch64 MASK watchpoints can
/// watch a minimum of 8 bytes (although Byte Address Select watchpoints
/// can watch 1 to pointer-size bytes in a pointer-size aligned granule).
diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp b/lldb/source/Breakpoint/WatchpointResource.cpp
index 8f15fc7c49583..fa0442997b528 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -115,7 +115,6 @@ bool WatchpointResource::ShouldStop(StoppointCallbackContext *context) {
void WatchpointResource::Dump(Stream *s) const {
s->Printf("addr = 0x%8.8" PRIx64 " size = %zu", m_addr, m_size);
- return;
}
wp_resource_id_t WatchpointResource::GetNextID() {
diff --git a/lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py b/lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py
index 24ddc037d0fbc..c8ec5cfb03dba 100644
--- a/lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py
+++ b/lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py
@@ -35,7 +35,7 @@ def test_unaligned_large_watchpoint(self):
"""Test watching an unaligned region of memory that requires multiple watchpoints."""
self.build()
self.main_source_file = lldb.SBFileSpec("main.c")
- (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, "break here", self.main_source_file
)
self.runCmd("break set -p done")
@@ -79,7 +79,6 @@ def test_unaligned_large_watchpoint(self):
# Now try watching a 16 byte variable
# (not unaligned, but a good check to do anyway)
- #
frame = thread.GetFrameAtIndex(0)
err = lldb.SBError()
wp = frame.locals["variable"][0].Watch(True, False, True, err)
diff --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index ba99c6bf4fabf..e760015dafc50 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -16,19 +16,20 @@
using namespace lldb;
using namespace lldb_private;
-struct testcase {
- WatchpointAlgorithms::Region user; // What the user requested
- std::vector<WatchpointAlgorithms::Region>
- hw; // The hardware watchpoints we'll use
-};
-
class WatchpointAlgorithmsTest : public WatchpointAlgorithms {
public:
using WatchpointAlgorithms::PowerOf2Watchpoints;
+ using WatchpointAlgorithms::Region;
+};
+
+struct testcase {
+ WatchpointAlgorithmsTest::Region user; // What the user requested
+ std::vector<WatchpointAlgorithmsTest::Region>
+ hw; // The hardware watchpoints we'll use
};
void check_testcase(testcase test,
- std::vector<WatchpointAlgorithms::Region> result,
+ std::vector<WatchpointAlgorithmsTest::Region> result,
size_t min_byte_size, size_t max_byte_size,
uint32_t address_byte_size) {
More information about the lldb-commits
mailing list