[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 00:50:32 PDT 2022
jasonmolenda added a comment.
Thanks for the review David. I am still fiddling with handling the case where debugserver is handed the address of something that isn't actually a Mach-O binary in memory, but I'll update the patch soon with these.
================
Comment at: lldb/test/API/macosx/unregistered-macho/TestUnregisteredMacho.py:21
+ self.build()
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ self, "// break here", lldb.SBFileSpec("main.c"))
----------------
DavidSpickett wrote:
> You can drop the `()` around the variable names.
Ah, yes thanks.
================
Comment at: lldb/test/API/macosx/unregistered-macho/main.c:21
+ mh.ncmds = 2;
+ mh.sizeofcmds = size_of_mh_and_cmds;
+ mh.flags = MH_NOUNDEFS | MH_DYLDLINK | MH_TWOLEVEL | MH_PIE;
----------------
DavidSpickett wrote:
> It seems like this should be the size of the commands only, not including the header. Though I can't find documentation for it so maybe this is just an unfortunate name.
No, you're exactly correct. When I was writing the test case originally I had a little bug and switched sizeofcmds to be size of the mach header and the commands, and it's not correct. Most parsers limit their parsing to the number of load commands and the total size of load commands, so they wouldn't read past the actual load commands. Thanks for noticing, I fixed it after confirming I was wrong, hah.
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