[Lldb-commits] [PATCH] D115494: Add support to lldb for reading a "load binary" LC_NOTE with Mach-O corefiles
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 10 02:27:11 PST 2021
DavidSpickett added inline comments.
================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:6984
+ uint64_t slide = m_data.GetU64(&fileoff);
+ std::string filename = (const char *)m_data.GetCStr(&fileoff);
+
----------------
Seems like the cast wouldn't be needed:
```
const char *GetCStr(lldb::offset_t *offset_ptr) const;
```
================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:7005
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
if (image_infos.IsValid()) {
for (const MachOCorefileImageEntry &image : image_infos.all_image_infos) {
----------------
Maybe not for this change but if you made this early return you could dedent all the following by one level.
```
if (!image_infos.IsValid())
return added_images;
```
================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:7035
+ image.filename.c_str(), uuidstr.c_str());
+ }
+ for (auto name_vmaddr_tuple : image.segment_load_addresses) {
----------------
You can use the `LLDB_LOGF` to do the `if (log)` for you I think. Then do `image.uuid.GetAsString().c_str()` directly as one of the parameters.
================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:7065
+ "ObjectFileMachO::LoadCoreFileImages adding binary '%s' "
+ "UUID %s with slide address 0x%" PRIx64,
+ image.filename.c_str(), uuidstr.c_str(), image.slide);
----------------
Is the slide address the amount you slide the load address *by* or is it an address all to itself? My assumption was the former.
(which makes the log message a bit odd since it's a distance not an amount)
================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:7077
+ "ObjectFileMachO::LoadCoreFileImages adding binary '%s' "
+ "UUID %s at its file address unslid",
+ image.filename.c_str(), uuidstr.c_str());
----------------
unslid sounds a bit like you removed a slide from it, I'd go with "without a slide" but that's just me.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115494/new/
https://reviews.llvm.org/D115494
More information about the lldb-commits
mailing list