LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-12-2009, 09:12 AM   #1
jaianand
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
No symbol/function name appears in GDB output and it prints ?? instead


Hi,

I am using gdbserver in the remote device.
>./gdbserver 127.0.0.1:20000 ./a.out
Process ./a.out created; pid = 15379
Listening on port 20000


Started GDB on the host
>gdb ./a.out
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) target remote IP:20000
Remote debugging using IP:20000
[New Thread 15379]
0x00000000 in ?? ()


I am getting ?? instead of the function name or symbols. Even if I try to print the stack trace, it prints ?? for all function names.

(Symbols are not stripped out in a.out executable)

Please let me know how to enable the function-names or a way to map the printed function address with the function name.


Thanks,
Jai
 
Old 05-12-2009, 03:52 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
There is a difference between stripping the normal symbols from the executable and not putting in extra debugging symbols in the first place.

For a normal compile, gcc will optimize away a lot of symbols because they are self-contained and not needed by external objects. In order for gcc to emit the debugging symbols, you should compile using the “-g” flag. Moreover, you may want any libraries used by your program also to have debugging symbols included (typically your distribution may keep special “debug” versions of all its libraries available).
 
Old 05-14-2009, 04:35 AM   #3
jaianand
LQ Newbie
 
Registered: May 2009
Posts: 2

Original Poster
Rep: Reputation: 0
also tried -g option

Hi,

I tried the -g option as well. But it gives the same result.
I am getting ?? in place of function names.

The function addresses "0x00000001" and "0x00000000" are incorrect and not mapping in the symbol table.

Please let me know how to get correct addresses from gdbserver, so that gdb can lookup correctly.

Thanks,
Jai
 
Old 05-15-2009, 04:59 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by jaianand View Post
The function addresses "0x00000001" and "0x00000000" are incorrect and not mapping in the symbol table.
I seemed to have hastily read your initial post. If you are getting 0x00000001 and such as function addresses, you most likely have stack corruption. In that case, you have to find out what’s happening before you get to the offending code (once the stack has been corrupted, stack unwinding/bactracing will not work). Another possibility is that you compiled with -fomit-frame-pointer (but this seems unlikely).

By the way (if you have a fairly recent gcc), you might want to compile with a stack_guard (by using the flag -fstack-protector-all). This could point out the offending function before the stack corruption, on which you could then set a breakpoint in gdb.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
when will we get GDB: function not found msg ? sunilvadranapu SUSE / openSUSE 1 12-24-2008 01:53 PM
Symbol appears in search but not in menuconfig circuit_PT Linux - Kernel 2 07-17-2007 08:34 AM
gdb hangs on function call astropirhana Programming 2 09-29-2006 08:01 AM
understanding gdb output of a C function in disassembled form. koodoo Programming 7 04-12-2006 10:55 AM
gdb won't single step thru the function frankie_DJ Programming 2 10-06-2004 05:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration