Chris Quenelle is a tools developer at Oracle Corp. He's worked on performance and debugging tools at Sun and Oracle for over 15 years. He reads comic books and science fiction,and has more tivos than he can keep track of.

 

May 2012
SMTWTFS
«Apr  
 12345
6789101112
13141516171819
20212223242526
2728293031 

Importing debug information into dbx

I’m sure I wrote this up somewhere before,but now I can’t find it. Just in case you guys (my two faithful readers) haven’t seen this trick yet. If you are stuck with a core file that doesn’t have debug information,you can “import”debugging information using the “loadobject -load”command. It’s especially useful for C++ to help get rid of the mangled names that show up in stack traces.

% #########################% more t.c#include "t.h"struct foo foofoo;intmain(){ foofoo.a = 1; foofoo.b = 2; * (int *) 0 = 0}% #########################% more t.hstruct foo{int a;int b};% #########################% cc -o t t.c # no debug info% #########################% ./tSegmentation Fault (core dumped)% #########################% dbx t coreReading tcore file header read successfullyReading ld.so.1Reading libc.so.1Reading libdl.so.1Reading libc_psr.so.1program terminated by signal SEGV (no mapping at the fault address)0x00010bb4:main+0x001c: clr [0](dbx) whatis foofoodbx:warning:unknown language,'c' assumed(int{assumed}) foofoo;(dbx) print foofoofoofoo = 0x1(dbx) whatis -t foodbx:"foo" is not defined in the scope `t`main`dbx:see `help scope' for details(dbx) quit% #% # You really want to see the contents of the 'foofoo'% # structure,but the binary doesn't have debug info!% # So create a dummy .so file with debug info,and load% # that into dbx manually.% # % #########################% more dummy.c#include "t.h"% #########################% cc -G -g -o dummy.so dummy.c% #########################% dbx t coreReading tcore file header read successfullyReading ld.so.1Reading libc.so.1Reading libdl.so.1Reading libc_psr.so.1program terminated by signal SEGV (no mapping at the fault address)0x00010bb4:main+0x001c: clr [0](dbx) loadobject -load dummy.soReading dummy.soLoaded loadobject:/set/dbx/somewhere/misc/coretest/dummy.so(dbx) modules | grep dummyNot Read dummy.o(dbx) module dummy.oRead dummy.o(dbx) whatis -t foostruct foo{ int a; int b};(dbx) print *(struct foo*)&foofoodbx:warning:unknown language,'c' assumed*((struct foo *) &foofoo) ={ a = 0x1  b = 0x2}
http://quenelle.org/unix/wp-content/plugins/sociofluid/images/digg_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/reddit_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/dzone_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/stumbleupon_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/delicious_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/furl_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/technorati_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/facebook_24.pnghttp://quenelle.org/unix/wp-content/plugins/sociofluid/images/twitter_24.png

Leave a Reply

  

  

  

You can use these HTML tags

<a href=""title=""><abbr title=""><acronym title=""><b><blockquote cite=""><cite><code><del datetime=""><em><i><q cite=""><strike><strong>