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

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 4 04:05:02 PDT 2022


DavidSpickett added a comment.

Some random comments.

Also agree that a test for what happens when there is no header found would be good.



================
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"))
----------------
You can drop the `()` around the variable names.


================
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;
----------------
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.


================
Comment at: lldb/test/API/macosx/unregistered-macho/main.c:33
+  seg.vmsize = 0x1000;
+  seg.fileoff = 0;
+  seg.filesize = 0;
----------------
Does this need to be `sizeof (struct mach_header_64)`? Probably doesn't and/or it doesn't matter for this test.


================
Comment at: lldb/test/API/macosx/unregistered-macho/main.c:52
+
+  // If this needs to be debugged, the memory buffer can be written
+  // to a file with
----------------
No comment here other than I always like to see this kind of info in a test!


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