Re: Attach gdb to program?

2010-04-09 Thread Adrian von Bidder
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?)


cheers
-- vbi

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


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


Re: Attach gdb to program?

2010-04-09 Thread Adrian von Bidder
On Thursday 08 April 2010 07.21:59 Adrian von Bidder wrote:
 Just gdb -p pid /usr/bin/kmail doesn't work :-(

Arrgh!

As it turns out, gdb 7.0 (squeeze) doesn't really work with binarries from 
sid (or experimental), at least onn 32bit x86.  gdb 7.1 (sid) works fine.

cheers
-- vbi

-- 
As we found out later, our activities had both saturated an uplink two
hops up from our university, at the Nordic University Network level
and made some DoS-alarms go off at the national level. All part of a fun
release.
-- serving Debian sarge and Ubuntu Breezy CD images
   http://www.acc.umu.se/~maswan/2005-12-10/2gbit-freesoftware.html


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


Re: Attach gdb to program?

2010-04-09 Thread George Kiagiadakis
On Fri, Apr 9, 2010 at 8:10 AM, Adrian von Bidder avbid...@fortytwo.ch wrote:
 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 :-(
 

Just don't specify any binary to the gdb command line. Let it find the
correct binary from /proc:

$ gdb -p pid

This is because sometimes kdeinit4 is the binary and the application
is loaded as a shared library and gdb gets very confused if you tell
it where the binary is.

Also, always make sure that the debug symbols package is exactly the
same version as the package providing the binary. In some debug
packages dependencies are not strict and you might get version
mismatch.

Regards,
George


-- 
To UNSUBSCRIBE, email to debian-kde-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/z2rba4a6e221004090547qc44a03b2sbf7a268b9263f...@mail.gmail.com



Attach gdb to program?

2010-04-08 Thread Adrian von Bidder
Heyho!

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.)

thanks in advance
-- vbi

-- 
Wer sich an eine falsche Vorstellung gewöhnt, dem wird jeder
Irrtum willkommen sein.
-- Goethe, Maximen und Reflektionen, Nr. 1026


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


Re: Attach gdb to program?

2010-04-08 Thread Carsten Pfeiffer
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.

Cheers,
Carsten


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