views:

68

answers:

2

Tests :

[1] creating divide of 0 in executable hat was compiled with optimization (O2) and debugging symbols , thus a core was generated.

[2] creating divide of 0 in shared object hat was compiled with optimization (O2) and debugging symbols , thus a core was generated.

Results:

[First] analysing the core generated by [1] was succeeded and an exact location of the crush could be seen in GDB/Totalview.

[Second] analysing the core generated by [2] was NOT succeeded and a hex numeric location was the output of the crush.

can someone tell how can i get [2] to succeed ?

+1  A: 

Check with ldd that your shared object can be found.

If not, try with shell variable LD_LIBRARY_PATH to set its path and try again gdb <executable> core.

Another option is to edit config /etc/ld.so.conf and run ldconfig.

Dmitry Yudakov
tried to set LD_LIBRARY_PATH to include the shared object path, didnt work... btw... am i supposed to see the library with ldd ? cause i cant see it when i ldd on my exec....
_Avishay_
I thought your exec is linked against this shared library. In this case you should see its name with ldd. But you're probably not and must be loading it with dlopen then?
Dmitry Yudakov
yes just checked it, its loaded with dlopen...
_Avishay_
It still should work... if you're using relative path for loading the library, make sure you run it directory where the relative path is valid. Check also for errors after running `gdb exec core`, it will give you the hint of what's wrong.
Dmitry Yudakov
i've tried gdb exec core and noticed :"Program terminated with signal 6, Aborted"
_Avishay_
i've noticed this errors while trying to debug the core with TotalView: ERROR: Failed, reading struct r_debug address=0xffffffffError getting dynamic loader base address
_Avishay_
Could you edit your question adding whole gdb output. "program terminated..." is ok, I'm not sure about the second error. Is your shared object compiled with -fPIC option?
Dmitry Yudakov
+1  A: 

Solved it , i was opening the core file like this :

  1. gdb core core-file-name
  2. file location-of-binary

then the binary symbols was loaded, BUT Not any shared objects !!!!!

going this way :

  1. gdb -c core-file-name location-of-binary

this caused binary symbols to be loaded BUT ALSO shared objects symbols to be loaded as well !!!

thanks for the help.

_Avishay_
Another note: Dont forget , the shared objects must be at the same location they were in the machine that produced the core.
_Avishay_