[Lldb-commits] [PATCH] D128956: make debugserver able to inspect mach-o binaries present in memory, but not yet registered with dyld

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 1 00:35:27 PDT 2022


jasonmolenda added inline comments.


================
Comment at: lldb/tools/debugserver/source/MacOSX/MachProcess.mm:1186-1191
+      // dyld doesn't think there is a binary at this address,
+      // but maybe there isn't a binary YET - let's look in memory
+      // for a proper mach-o header etc and return what we can.
+      // We will have an empty filename for the binary (because dyld
+      // doesn't know about it yet) but we can read all of the mach-o
+      // load commands from memory directly.
----------------
JDevlieghere wrote:
> What happens when it turns out that there's no Mach-O header at this load address? I expect it doesn't end up in the `jGetLoadedDynamicLibrariesInfos` response then? Where does this filtering take place?
Yeah, it's a good question.  `MachProcess::GetMachOInformationFromMemory` does the Mach-O parsing, and reviewing that code, I do some sanity checking but I don't check for the magic number in the header.  At the very least, I should add that check.   I should also check the return value from `GetMachOInformationFromMemory` and not add the entry to my list of binaries I'm going to respond to lldb with.  So, a bit more work here would be a good idea, agreed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128956/new/

https://reviews.llvm.org/D128956



More information about the lldb-commits mailing list