[Lldb-commits] [lldb] [lldb] Remove limit on max memory read size (PR #105765)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 23 19:14:26 PDT 2024
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/105765
>From 6a27ad3be748a6072014a805a5a94dede9321432 Mon Sep 17 00:00:00 2001
From: Jason Molenda <jmolenda at apple.com>
Date: Thu, 22 Aug 2024 18:29:55 -0700
Subject: [PATCH 1/2] [lldb] Remove limit on max memory read size
`memory read` will return an error if you try to read more than 1k
bytes in a single command, instructing you to set
`target.max-memory-read-size` or use `--force` if you intended to
read more than that. This is a safeguard for a command where people
are being explicit about how much memory they would like lldb to
read (either to display, or save to a file) and is an annoyance
every time you need to read more than a small amount. If someone
confuses the --count argument with the start address, lldb may begin
dumping gigabytes of data but I'd rather that behavior than requiring
everyone to special-case their way around a common use case.
---
lldb/source/Target/TargetProperties.td | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index 7bb5bd53688b14..f553d92f7c64f6 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -102,7 +102,7 @@ let Definition = "target" in {
DefaultUnsignedValue<1024>,
Desc<"Maximum number of characters to show when using %s in summary strings.">;
def MaxMemReadSize: Property<"max-memory-read-size", "UInt64">,
- DefaultUnsignedValue<1024>,
+ DefaultUnsignedValue<4294967295>,
Desc<"Maximum number of bytes that 'memory read' will fetch before --force must be specified.">;
def BreakpointUseAvoidList: Property<"breakpoints-use-platform-avoid-list", "Boolean">,
DefaultTrue,
>From 3d63f0b0c6c7f28422d271f89977635d2e8cd4df Mon Sep 17 00:00:00 2001
From: Jason Molenda <jmolenda at apple.com>
Date: Fri, 23 Aug 2024 19:14:01 -0700
Subject: [PATCH 2/2] Change to using a hex value in .td, fix API test
---
lldb/source/Target/TargetProperties.td | 2 +-
.../memory/big-read/TestMemoryReadMaximumSize.py | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index f553d92f7c64f6..0f68deb543f90e 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -102,7 +102,7 @@ let Definition = "target" in {
DefaultUnsignedValue<1024>,
Desc<"Maximum number of characters to show when using %s in summary strings.">;
def MaxMemReadSize: Property<"max-memory-read-size", "UInt64">,
- DefaultUnsignedValue<4294967295>,
+ DefaultUnsignedValue<0xffffffff>,
Desc<"Maximum number of bytes that 'memory read' will fetch before --force must be specified.">;
def BreakpointUseAvoidList: Property<"breakpoints-use-platform-avoid-list", "Boolean">,
DefaultTrue,
diff --git a/lldb/test/API/functionalities/memory/big-read/TestMemoryReadMaximumSize.py b/lldb/test/API/functionalities/memory/big-read/TestMemoryReadMaximumSize.py
index 259fde71a63626..1bc227dfce9bef 100644
--- a/lldb/test/API/functionalities/memory/big-read/TestMemoryReadMaximumSize.py
+++ b/lldb/test/API/functionalities/memory/big-read/TestMemoryReadMaximumSize.py
@@ -22,6 +22,8 @@ def test_memory_read_max_setting(self):
)
self.assertTrue(self.bp.IsValid())
+ self.runCmd("settings set target.max-memory-read-size 1024")
+
self.expect(
"mem rea -f x -s 4 -c 2048 `&c`",
error=True,
More information about the lldb-commits
mailing list