[Lldb-commits] [lldb] [lldb-dap] Support inspecting memory (PR #104317)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 17 05:43:01 PDT 2024


DavidSpickett wrote:

The test case is failing on Windows, for reasons not related to it being Windows but due to data layout.

The const string is placed at the start of a region:
```
(lldb) p rawptr
(const char *) 0x00007ff77fcb5000 "dead"
(lldb) memory region --all
<...>
[0x00007ff77fc61000-0x00007ff77fcb5000) r-x .text
[0x00007ff77fcb5000-0x00007ff77fcc2000) r-- .rdata
```
This means that when you read with offset `-1` it starts 1 byte into the `.text` section, reads that single byte, then returns.

(same thing would happen if the memory was the last part of a region, a positive offset would make the read end early when it hit the end of the region)

Your code needs to be aware that this may happen, or just do the memory read without looking up the region and assume that the lower layers do the right thing (I don't know if they do).

https://github.com/llvm/llvm-project/pull/104317


More information about the lldb-commits mailing list