coyotte508
coyotte508

Reputation: 9705

How to link against libc6-dbg instead of just libc6

I've a program, compiled in debug mode. Yet when I do ldd:

libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00821000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x0083c000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x00921000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x009ac000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x152fa000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0x0094d000)
...

I don't see any debug symbols here...

My program crashed, and I have that output in gdb bt:

#0  0x00007f2f95ca7030 in ?? ()
#1  0x00007f3013edd801 in ?? ()
#2  0x0002965300014c4c in ?? ()
#3  0x00007f305e3006c0 in ?? ()
#4  0x00007f3000000084 in ?? ()
#5  0x00007f3000000002 in ?? ()
#6  0x00007f307a57aec0 in ?? ()
#7  0x000000000494c740 in ?? ()
#8  0x00007f3092e93720 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#9  0x0000000000000030 in ?? ()
#10 0x000000000b85de60 in ?? ()
#11 0x00007f305f913000 in ?? ()
#12 0x00007f3095cbe750 in ?? ()
#13 0x00007f3089eb2390 in ?? ()
#14 0x00007f3095cc4a88 in ?? ()
#15 0x00007f30956b4d78 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#16 0x00007f3095cc3800 in ?? ()
#17 0x00007f3089eb2000 in ?? ()
#18 0x00007f3088c41230 in ?? ()
#19 0x00007f30956b4d78 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#20 0x0000000004c35488 in ?? ()
#21 0x00007f3089eb2060 in ?? ()
#22 0x00007f3095cbe738 in ?? ()
#23 0x00007f30952c83a1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#24 0x00007f309535f567 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#25 0x00007f30953349a2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#26 0x00007f30954176ce in QScriptValue::call(QScriptValue const&, QList<QScriptValue> const&) () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
... (Readable backtrace from my code)

So my question is, how do I link to the debug version of libc6? If I know what to pass to the compiler, I can then put that in the qmake file so it would be compiled that way.

I've installed libc6-dbg, too.

Thanks.

Upvotes: 1

Views: 786

Answers (2)

Employed Russian
Employed Russian

Reputation: 213576

I don't see any debug symbols here...

It's not clear how you obtained that stack trace. Chances are you didn't invoke GDB correctly.

How to link against libc6-dbg instead of just libc6

You do no such thing. libc6-dbg package supplies separate debug files. You don't link against them -- GDB knows how to load them automagically.

Upvotes: 1

Tim Meyer
Tim Meyer

Reputation: 12600

You can supply different configurations through the CONFIG macro in the qmake file:

CONFIG(debug, debug|release) {
    LIBS += -llibc6-dbg
} else {
    LIBS += -llibc6
}

If you're trying to understand the syntax: It tells qmake to check for the options debug and release in the CONFIG variable, and if it finds debug, execute the first path, otherwise the second one.

If you're having any kind of troubles, this forum thread might help you.

Upvotes: 0

Related Questions