[lldb] [API] process.ReadPointerFromMemory doesn't report error if core file truncated
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
When a truncated core file is loaded in the debugger, some memory addresses are inaccessible due to them being in the deleted part of file. Commands report the failure (though not the reason). Python APIs in general do not. The only way a script can detect the situation is use process.ReadMemory and check result for None
```
(lldb) x/a 0x7efca3f99ff8
error: read memory from 0x7efca3f99ff8 failed
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> err = lldb.SBError()
>>> lldb.process.ReadPointerFromMemory(0x7efca3f99ff8, err)
18446744073709551615
>>> err
success
>>> lldb.process.ReadUnsignedFromMemory(0x7efca3f99ff8, 8, err)
0
>>> err
success
>>> None is lldb.process.ReadMemory(0x7efca3f99ff8, 8, err)
True
>>> err
success
>>>
```
Expected behavior:
err.fail is set and the error message is saying that the core file is truncated
Contributor guide
Research direction
Start with LLDB's SBProcess memory-reading APIs, especially ReadPointerFromMemory and ReadUnsignedFromMemory, and compare their SBError handling with ReadMemory. Reproduce the behavior using a truncated core file and verify that failed reads set err.fail and report that the core file is truncated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100