Skip to content

Commit b076f66

Browse files
authored
[lldb] Remove limit on max memory read size (#105765)
`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. I don't want to remove the setting because many people have added (much larger) default max read sizes to their ~/.lldbinit files after hitting this behavior. Another option would be to stop reading/using the value in Target.cpp, but I see no harm in leaving the setting if someone really does prefer to have a small cap on their memory read size.
1 parent 18263c3 commit b076f66

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lldb/source/Target/TargetProperties.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let Definition = "target" in {
102102
DefaultUnsignedValue<1024>,
103103
Desc<"Maximum number of characters to show when using %s in summary strings.">;
104104
def MaxMemReadSize: Property<"max-memory-read-size", "UInt64">,
105-
DefaultUnsignedValue<1024>,
105+
DefaultUnsignedValue<0xffffffff>,
106106
Desc<"Maximum number of bytes that 'memory read' will fetch before --force must be specified.">;
107107
def BreakpointUseAvoidList: Property<"breakpoints-use-platform-avoid-list", "Boolean">,
108108
DefaultTrue,

lldb/test/API/functionalities/memory/big-read/TestMemoryReadMaximumSize.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def test_memory_read_max_setting(self):
2222
)
2323
self.assertTrue(self.bp.IsValid())
2424

25+
self.runCmd("settings set target.max-memory-read-size 1024")
26+
2527
self.expect(
2628
"mem rea -f x -s 4 -c 2048 `&c`",
2729
error=True,

0 commit comments

Comments
 (0)