unreadable gdb symbols

Asked by aeronova

Hi all,

I tried to figure out what gives seg fault with gdb, but its messages contained "?? ()" rather than readable strings. The below is what I got:

0x0000000000000001 in ?? ()
(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00007fffffffe536 in ?? ()
#2 0x0000000000000000 in ?? ()

I wonder what I need to do/install to get readable messages so that I can work on fixing my code. Please help me with this problem. Thank you in adv.

Best,
K. Lee.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gdb Edit question
Assignee:
No assignee Edit question
Solved by:
aeronova
Solved:
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

build your binary with -g to enable debugging symbols, and disable optimisations.

Revision history for this message
aeronova (aeronova) said :
#2

mycae, thanks to reply, but I already had the -g option:

CC = mpicc
CXX = mpicxx
CXXFLAGS = -m64 -c -g -Wall
LDFLAGS = -m64

Revision history for this message
mycae (mycae) said :
#3

We need to know more about your situation.

 The only way that debugging symbols are going to be missing is if you have not passed -g successfully, or have later run "strip" over the binary objects, or are calling a library that does not have debugging symbols (though higher up your call stack you should see your symbols anyway, if this is the case).

Your (makefile? env?) snippet does not show whether those flags are actually going to be passed to the compiler, or if they will be dropped at some point -- a more complete example is needed. Can you provide a complete example?

You may want to avoid using mpicc (and thus only having indirect control over gcc) and instead look at the flags that mpicc passes to gcc. Try the -echo option for mpicc.

Revision history for this message
aeronova (aeronova) said :
#4

Hi mycae,

I think I found the problem; it was caused by using the same makefile used for building a shared library to compile an executable. It was a silly mistake. I took out -shared option in linking, and it worked fine. I also tested gdb with a gdb-example on a website, and I was able to see the debug symbols. Thank you for your help.

Best,
K. Lee.