[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
Wed Jul 6 16:55:13 PDT 2022


jasonmolenda updated this revision to Diff 442720.
jasonmolenda added a comment.

Updated patch to address Jonas and David's feedback.

Updated the test C file so the mach header sizeofcmds is correct.  Update test to test querying an invalid mach-o binary, and the combination of a valid & invalid mach-o binary addresses, and check that we get the correct replies.

Add simple checks to MachProcess::GetMachOInformationFromMemory() which parses inferior memory as a Mach-O binary, to detect things that are not mach-o binaries and return false in those case.

Update callers to GetMachOInformationFromMemory() to mark any entry that had a problem parsing it to mark that entry is is_valid=false.

Update MachProcess::FormatDynamicLibrariesIntoJSON() to check the is_valid flag for each entry, and don't add those entries to the StructuredData return array.  Do return validly formatted mach-o's that were found during the scan, though.

MachProcess::GetLoadedDynamicLibrariesInfos() (not used on modern Darwin systems any more) - in the process of updating its handling of macho-parsing call, noticed that the indentation was all incorrect for this method.  Fixed it, removed an extra return at the end.  This looks like it's undergone some incorrect revision over the years -- probably by me.  It's near time this could be removed altogether most likely, but I don't want to do that just yet.

I'll add an NDEBUG assert to DynamicLoaderMacOS later which checks that lldb gets back the same number of binary image entries that it asked for -- so we can flag any case where debugserver omits a binary in our testing.  I can't imagine this would happen.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128956

Files:
  lldb/test/API/macosx/unregistered-macho/Makefile
  lldb/test/API/macosx/unregistered-macho/TestUnregisteredMacho.py
  lldb/test/API/macosx/unregistered-macho/main.c
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128956.442720.patch
Type: text/x-patch
Size: 17481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220706/c4f01d0b/attachment.bin>


More information about the lldb-commits mailing list