libobjc2 icon indicating copy to clipboard operation
libobjc2 copied to clipboard

Add debug support symbols

Open weliveindetail opened this issue 2 years ago • 1 comments

Proper ObjC support in debuggers requires the runtime to provide a few support symbols. Grepping the Apple V2 runtime in upstream LLDB brings up these candidates:

  • gdb_object_getClass and gdb_objc_realized_classes for expression evaluation
    https://opensource.apple.com/source/objc4/objc4-787.1/runtime/objc-gdb.h.auto.html
  • gdb_objc_trampolines and gdb_objc_trampolines_changed for trampoline step-through
    https://opensource.apple.com/source/objc4/objc4-437.1/runtime/objc-gdb.h.auto.html

I am not sure whether the referenced open-source declaration are the relevant sources or whether they are up-to-date.

weliveindetail avatar Mar 16 '23 09:03 weliveindetail

My understanding is that gdb_object_getClass is equivalent to object_getClass but doesn't acquire locks. Our implementation of this class never acquires locks, so we probably don't need it. I'm not sure what the others are for. I think the tampoline ones are specifically related to how Apple implements the objc_msgSend family, so I'd need to understand what the debugger wants from these to see what an equivalent would look like. gdb_objc_realized_classes depends on NXHashTable, which we don't implement (and I thought Apple removed with ObjC2).

davidchisnall avatar Mar 16 '23 10:03 davidchisnall