[Lldb-commits] [lldb] [lldb][Mach-O] Handle shared cache binaries correctly (PR #117832)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 18:12:07 PST 2024


jasonmolenda wrote:

I have two criticisms of the patch as-is.  We read the LC_SYMTAB load command into `symtab_load_command` which has six fields, the first two being the usual `cmd` and `cmdsize`.  We use all of the next four: `ncmds`, `strsize`, `symoff`, `stroff`.  I'm taking the uses of two of these fields out of `symtab_load_command`, and putting them in 64-bit locals.  But I think the smarter move is probably to read the load command into a temporary object, and then create four local variables with the resized fields as needed, or have a locally defined struct with the resized fields. 

The second criticism is that I don't have a good way to test it.  I have a request to have ProcessMachCore treat an LC_SEGMENT that has a virtual address & size, but no file size as an all-zeroes segment.  In which case it would be possible to create a mach-o corefile that is larger than 4GB in size, but actually only uses a couple hundred kb on disk (and doesn't fill the CI filesystems), and then we'd have to hand-write a mach-o file with a LINKEDIT 4GB away from the TEXT segment.  There's a couple pieces that don't exist to do all of this right now, though.

https://github.com/llvm/llvm-project/pull/117832


More information about the lldb-commits mailing list