[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Attach gdb to program?

On Thursday 08 April 2010 16.04:39 Carsten Pfeiffer wrote:
> Am Donnerstag, 8. April 2010 schrieb Adrian von Bidder:
> > Given a Debian package (kmail, in this case, with installed kdepim-dbg
> > package) and an extracted source package: how do I properly start gdb
> > (or ddd or ...) so that it finds both the debugging symbols and the
> > source code?
> > 
> > Just gdb -p <pid> /usr/bin/kmail doesn't work :-(
> > 
> > (I've only ever used gdb on locally compiled simple projects, I've
> > never worked with the separate symbol files as delivered in -dbg
> > packages.)
> Not sure if this is the same as your example, but I usually used
> gdb kmail
> attach <pid>
> But check the output of ps aux | grep kmail -- if kmail is launched via
> kdeinit or kdeinit4, you need to run "gdb kdeinit" or kdeinit4.

Ok, I wasn't specific enough.  Sorry about that.

What I meant with "doesn't work" is: it doesn't load the symbols.

I have now tried "gdb /usr/lib/debug/usr/bin/kmail <pid>", and this gives me 
the symbols for the main binary (and if pwd is ok or I add "-d <path>" to 
the cmdline, it even shows the source code, so that's fine, too), but for 
all the shared libraries, I'm still stuck.

add-symbol-file wants an address (where would I get this?); plain "symbol-
file" crashes gdb (and in any case: wouldn't this *replace* the symbol table 
instead of add to it?)

-- vbi

Anyone can invent a security system that he himself cannot break.
        -- Schneier's Law

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply to: