Find the answer to your Linux question:
Results 1 to 4 of 4
I am using RedHat 7.3 (long story). I have an object file with debug symbols including the line number table. I would like to be able to dump the line ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2004
    Location
    Minneapolis, MN
    Posts
    10

    how to dump line number table


    I am using RedHat 7.3 (long story). I have an object file with debug symbols including the line number table. I would like to be able to dump the line numbers in the object file with a range of address per line. Alternately, if I provide an address I'd like to get back the line number. I could probably take something like nm and hack it to death to produce what I want. I wonder if anything's already out there that'll do what I want. Any ideas?

    I see SysV's dump(CP) has a -l option that dumps the line number information. Anything like that around?

    --Joel

  2. #2
    Linux User
    Join Date
    Jul 2004
    Location
    Poland
    Posts
    368
    Hello, jbreazeale.
    Take a look at GNU binary utilities, especially the addr2line & objdump program. I have a premonition you'll know what to do with them. Regards.
    "I don't know what I'm running from
    And I don't know where I'm running to
    There's something deep and strange inside of me I see"

  3. #3
    Just Joined!
    Join Date
    Mar 2004
    Location
    Minneapolis, MN
    Posts
    10
    Amazing. Right here on my box and I couldn't find it! I'm cautiously optimistic that they'll do the trick! Thank you kyku!

  4. #4
    Just Joined!
    Join Date
    Mar 2004
    Location
    Minneapolis, MN
    Posts
    10
    It turns out objdump with -l really doesn't dump the line number information enmasse, but it is possible to disassemble the executable (-d/-D) and have the line number appear in the disassembly output, so then one can pick one's way back from the given address to the line of code. It, therefore, does do the trick indirectly. The addr2line program is, however, quite useful and seems to be the direct way to go. Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •