p2 / Redland-ObjC

Objective-C wrapper for the Redland RDF libraries
Other
20 stars 11 forks source link

Stepping into redland c libs during xCode debugging #10

Open ghost opened 10 years ago

ghost commented 10 years ago

I'm trying to step into the redland c functions from the wrapper classes in Xcode.

At the moment the debugger just skips to the next Objective-c statement.

Is there a straight forward way to configure the project for debugging into the underlying libraries?

Andy

p2 commented 10 years ago

The C-libraries are built as a static library and linked into the Objective-C framework, I think that means you can't step into the code but I'm not sure. I wouldn't know how to be able to step into the C code from Xcode other than adding all C sources to the project and have Xcode compile them.

I'll leave this open, you might get an answer on StackOverflow just for asking how to step into C code from Xcode.

ipmcc commented 9 years ago

Xcode is actually pretty good at stepping into code compiled by someone else, provided that debug symbols were generated at compile time and that those debug symbols are visible to Spotlight. The problem here is that the cross-compile build scripts completely wall off the subordinate build from Xcode's 'guiding influence.' If you hand-built the libraries and provided the config options necessary to generate turn off optimizations and generate debug symbols, my guess is that it would work.

I also saw that the Redland projects (actually only Raptor :( now that I look )have had CMake lists added to them, which means that you can use CMake to generate Xcode projects that will subsequently build the libraries. Not only that, but once set up, doing things this way is much smoother -- the redland project builds inherit Debug/Release and Architecture settings from Xcode, during development meaning you build a lot less. If you were actively working in the redland sources themselves, this would be the only way to fly. The cross-compile scripts are great at abstracting away the third party dependency, but if that's not what you want, they become an obstacle.

I tinkered with it for a bit this morning, but I didn't see an elegant way to use the CMake-generated Xcode projects in Redland-ObjC while still preserving the (inferred) intention to not include any Redland sources in this project. It doesn't seem like the right 'knobs' exist on the CMake Xcode generator that would facilitate this.

FWIW, the "shortest path" to getting the ability to step in, is to edit all the instances of pp-configure.sh and add "-O0 -g" to the CFLAGS, and then rebuild the C libraries. (But you'll have to remember to remove those when you want to do a release build.)

p2 commented 9 years ago

We can either ask Dave to include some Xcode-specific flags in the CMake lists (he has done similar before) or make the cross-compile script look for the build configuration (Debug vs. Release) and have it pass different optimization flags.

I'm not actively maintaining this lib so don't know if and when I'd get to it.