madsmtm / objc2

Bindings to Apple's frameworks in Rust
https://docs.rs/objc2/
MIT License
340 stars 39 forks source link

Improve support for debuggers #352

Open madsmtm opened 1 year ago

madsmtm commented 1 year ago

It would be especially cool if we could re-use the debugging support that LLDB already contains for Foundation types like NSString and NSArray.

The unstable #![debugger_visualizer] attribute is probably the way to go, once it supports LLDB. Support for other debuggers is also desired, but probably less important (since the expectation is that users are going to be developing on macOS).

LLDB has a way to change how types are debugged, so I might try writing a python script that users can command script import (similar to how Rust's LLDB support currently work, though I think we might need to improve that too, see also https://github.com/vadimcn/codelldb/issues/997).

Seems like Swift does it in code somehow, see https://developer.apple.com/documentation/swift/debugdescription(). So might be possible to make this information part of the binary?

madsmtm commented 1 year ago

The #![debugger_visualizer(...)] attribute is now stabilized, though without support for LLDB - we/I will probably have to do the work ourselves if we want that support.

madsmtm commented 11 months ago

It would also be nice if we could somehow make instance variables show up by default if inspecting Objective-C code in Xcode (even if they're not exactly pretty).

Currently they're just hidden (exactly like for imported Swift classes), which is quite confusing!

See also https://github.com/madsmtm/objc2/issues/459.