LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 09-21-2004, 05:21 PM   #1
jbreazeale
LQ Newbie
 
Registered: Feb 2003
Posts: 2

Rep: Reputation: 0
looking for a way to dump line number info


I would like to be able to take an address and convert it to a function/line number. I see the SysV program dump(CP) has a -l option to dump line number information. I'll guess the information contains the function name, line number, and address range.

Anyone know of a way to get the information I'm seeking, whether directly or indirectly?

Thanks,
Joel
 
Old 09-21-2004, 05:44 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,627
Blog Entries: 10

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
Hi, and welcome to LQ!

Can you give an example of what you're trying
to achieve? I have no idea what you're talking
about when you say addresses ...

If you just need to e.g. copy a file and prepend
every line in it with a number that would be a nice
job for awk

awk '{print NR "\t"$0}' <filename> > <newfile>


Cheers,
Tink
 
Old 09-22-2004, 12:02 PM   #3
jbreazeale
LQ Newbie
 
Registered: Feb 2003
Posts: 2

Original Poster
Rep: Reputation: 0
I am trying to figure out the backtrace of my program when a certain function is being called. There are three examples of this procedure here. In no case do any of the examples produce functions with line numbers. If and when I have a backtrace with function names and offsets or straight addresses I would like to be able to get a function name and line number.

It turns out addr2line and objdump [apparently a port of dump(CP)] do exist on my flavor on Linux, so I will check them out to see if I can get what I want out of them.

[I'll gladly accept advice on getting the backtrace with line numbers. What I've been doing with some success has been to invoke gdb against my own process and make gdb give me the backtrace. In my particular case it seems the atexit() function has been called twice so a certain function atexitFunc() is called twice. Inside atexitFunc() I'm using system() to call a shell script with my pid -- gdb uses my pid to attach to the caller of system() and then do a backtrace. Unfortunately, this solution does not work in all cases -- the first time around the backtrace via gdb looks good -- the second time gdb says the process does not exist. My solution in this case is to use the LinuxJournal article's example 1 and generate a backtrace within the program -- unfortunately I do not get line numbers, hence the desire to convert addresses of executable code to function names and line numbers.]

Thank you for any help you can render on this issue. It would be nice if there were more support for backtraces with line numbers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting line number s_shenbaga Linux - Newbie 1 10-21-2005 05:52 AM
Number of hard disks/drives info? mali Linux - Enterprise 3 01-10-2005 03:59 PM
Stray at line number vipinsharma Programming 1 05-21-2004 09:27 AM
RH9 reinstall - dump/restore - DNS info not seen gandalf2041 Red Hat 0 02-08-2004 04:16 PM
Printing a line number gummimann Programming 2 11-06-2003 06:09 AM


All times are GMT -5. The time now is 01:05 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration