below
below

Reputation: 958

Why can't I set a breakpoint in my library?

the goal is to debug a method deep within a library.

We can debug c functions in that same library (as long as they are not in the .m files), but apparently no Objective-C code, or even c code within any .m file.

When I try to set breakpoints manually, (break set -n), I get: WARNING: Unable to resolve breakpoint to any actual locations.

The code does get called, the trusty logger confirms that.

My hunch is that debugging information gets lost somewhere along the way: We are building a static library, then another static library ("Framework" style), and finally we are linking this into our app. Yes, that's complicated but, historical reasons, you know.

I have tried to examine the first .a file to see what is going on, but when I try to load it into lldb I have to create a target. And target creation fails for either architecture:

target create -d --arch i386 libFoo.a error: 'libFoo.a' doesn't contain the architecture i386

target create -d --arch armv7 libFoo.a
error: 'libFoo.a' doesn't contain any 'remote-ios' platform architectures: arm64, armv7, armv7f, armv7k, armv7s, armv7m, armv7em, armv6m, armv6, armv5, armv4, arm, thumbv7, thumbv7k, thumbv7s, thumbv7f, thumbv7m, thumbv7em, thumbv6m, thumbv6, thumbv5, thumbv4t, thumb

lipo -info libFoo.a Architectures in the fat file: libFoo.a are: armv7 i386

Does anyone have a good idea how to best tackle this issue? The code is definitely linked, working, but lldb can not set breakpoints.

Thanks a lot

Addendum:

I have created the most simple setup I could think of, and I see very, very odd results:

If I try to lookup certain things, some will return a file and a line number, others will not:

image lookup -s Foo::faz() 1 symbols match 'Foo::faz()' in […]/Build/Products/Debug-iphoneos/Test.app/Test: Address: Test[0x00010334] (Test.__TEXT.__text + 22060) Summary: Test'Foo::faz() at Foo.cpp:858 image lookup -s FazBar 1 symbols match 'FazBar' in […]/Build/Products/Debug-iphoneos/Test.app/Test: Address: Test[0x00038eb4] (Test.__TEXT.__text + 188844) Summary: Test'FazBar

Trying to set breakpoints in the corresponding files yields, well, expected results:

(lldb) break set -f Foo.cpp -l 877 Breakpoint 5: where = Test'Foo::faz() + 76 at Foo.cpp:877, address = 0x000cb380 (lldb) break set -f bar.c -l 585 Breakpoint 6: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations.

How can I dig into the .a file to see why certain files are not found?

Upvotes: 2

Views: 1494

Answers (3)

below
below

Reputation: 958

Well, someone (actually not me, had the absolutely bright idea of setting GCC_GENERATE_DEBUGGING_SYMBOLS = NO somewhere hidden deep.

Setting it to yes, well, you guessed it, solves the issue

Alex

Upvotes: 1

ssb
ssb

Reputation: 1

Try using DYLD_BIND_AT_LOAD environment variable set. This should disable lazy binding, which often fails to hit symbolic breaküpints

Upvotes: 0

enter image description here

set exception break point like above

go to brekpoint navigation click on + and slecte add exception brak point

enter image description here

Upvotes: 0

Related Questions