LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-19-2009, 07:15 AM   #1
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Rep: Reputation: 15
gdb questions


Hello All,

Problem: I built a product (which contains multiple C files) as debuggable version (gcc -g) and ran this binary under GDB, how to find out in which shared library the symbol got defined.

gdb $ print addEmpNumber -> function name (This command displays the memory address where this function has been loaded but i could not find out this symbol is from which shared library .so file).

Please help me to understand.

Thanks,
Deenadayalan
 
Old 01-20-2009, 04:09 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I didn't want to give this lame answer yesterday, since "zero reply" seems to matter so much in this forum and I think there is a better way, but don't know it. But since no one gave the better way yet, this way works for me:

In another shell, find out the pid of the process you are debugging. Then (in that other shell) do
Code:
less /proc/PID/maps
replacing PID with the actual pid.
Finally, look at the hex address that gdb gave you for that function and scroll down the output from /proc/PID/maps until you find the range that includes that address.

I need to do this fairly often when debugging, so if some expert posts the better way, that will help me as well.

Last edited by johnsfine; 01-20-2009 at 04:12 PM.
 
  


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
gdb sabeel Programming 2 03-26-2007 07:58 PM
gdb questions.. alaios Programming 2 09-25-2005 02:42 AM
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:43 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