This change ensures that if for whatever reason we read less bytes than expected (for example, when trying to read memory that spans multiple sections), we try reading from the live process as well.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Target/Target.cpp | ||
---|---|---|
1780 | Is there a reason why we need to use malloc and free? |
lldb/source/Target/Target.cpp | ||
---|---|---|
1780 | Since the type is void I thought that was the correct way. What should I use instead? |
lldb/source/Target/Target.cpp | ||
---|---|---|
1780 | I looked at the places we are calling Target::ReadMemory and they are using some form of a uint8_t buffer. So a uint8_t array would be fine: std::unique_ptr<uint8_t[]> file_cache_read_buffer; //.... p = std::make_unique<uint8_t[]>(file_cache_bytes_read); |
Change buffer unique pointer from void to uint8_t, eliminating the need to call malloc/free.
lldb/source/Target/Target.cpp | ||
---|---|---|
1780 | Thanks Shakif, it does look a bit simpler now. |
lldb/source/Target/Target.cpp | ||
---|---|---|
1780 | std::vector for a buffer is also possible some callers do that but I don't see a reason to prefer that over this solution. |
lldb/source/Target/Target.cpp | ||
---|---|---|
1823–1830 | Thanks Jonas! |
Is there a reason why we need to use malloc and free?