0

I've got a XCode workspace.

This workspace holds the main target (Swift) and a target with a dynamic library embedded in a framework.

The entry of the framework is a wrapper class written in Objective-C++. The dynamic library has been written in C++.

The project seems to compile and link fine, but when I execute one its methods, it throws me back an error I would like to debug.

I tried stepping in with the debugger but then I only get int the stack. I can try to follow the stack but I can't print any variables, it only shows the method names that have been called.

I also tried an exception breakpoint, but it only stops in the Objective-C++ wrapper layer.

Is there any way to debug the insides of the dynamic library with XCode or LLDB?

Thanks

6
  • Yes, you can: Debug > Debug Workflow > Always Show Disassembly, and then you may want to use Debug > Step Over Instruction and Debug > Step Into Instruction Commented Mar 14, 2023 at 17:55
  • That's kind of the way I was doing it, but it would take me ages to debug. I was thinking more of setting a breakpoint at a particular line in the cpp source file compile into the library, for example. Commented Mar 14, 2023 at 18:24
  • You can do that as well, but it requires that you have the source file of the library. Commented Mar 14, 2023 at 20:58
  • 1
    Did you build the C++ part of the framework? If you didn't then you don't have debug info for that part, and disassembly is pretty much the best you can do. If you did build the framework, then debugging it should "just work". It sounds like either you didn't build it, or it was built w/o debug information or it got stripped before you set about to debug it. Commented Mar 14, 2023 at 23:08
  • 1
    gdb's dir just tells gdb about other places to look for source files, in case they aren't where the debug info says they are. But the source files by themselves can't provide the mapping from lines -> instructions as they have no way of knowing how the binary was built. You need the debug info for that. Similarly, if symbols have been stripped, lldb has no way to reconstruct them except debug info. If you want to do symbolic debugging of this library you need to either build it locally, or get a dSYM with debug info from whoever provided the library. Commented Mar 20, 2023 at 22:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.