# How to read DWARF file



## rajukgp (Apr 18, 2009)

Hi All,
I am new to this group.I would like to know, how to read DWARF file?Is there any simple sample program that can be used for reading DWARF file.Basically I would like to retrieve file name, function name and the line number from the DWAF file.My OS is MacOSX.

Thanks in advance.
-R


----------



## SirDice (Apr 18, 2009)

Hmm.. I've never heard of a DWARF file, I had to look it up..

http://dwarfstd.org/


----------



## tangram (Apr 18, 2009)

From this section of the post description: _"Howtos & FAQs Would you like to share some of your solutions for certain problems? Tips or tricks? Post here."_

Your question would be better placed in one of the other forum section.
Welcome aboard btw


----------



## LateNiteTV (Apr 19, 2009)

you would probably have better luck with this on a mac forum.


----------



## fronclynne (Apr 19, 2009)

*I could say that about some 80% of my body*

I can't really be of great help, but I did find devel/dwarfdump.

Again, I have no clue how to use it.


----------



## LateNiteTV (Apr 19, 2009)

that probably wont help him since hes on osx. buuuuuut then again, i dont know jack about it.


----------



## fronclynne (Apr 19, 2009)

Sure, but I'm obstinately sticking to the theory that he asked on a FreeBSD forum for a reason.

And, if he researches the leads he's been given, I'm sure something OSeXy will turn up for him.


----------



## SirDice (Apr 19, 2009)

fronclynne said:
			
		

> Sure, but I'm obstinately sticking to the theory that he asked on a FreeBSD forum for a reason.


Maybe because OS-X borrowed heavily from FreeBSD? :e

Even though there's a lot of FreeBSD stuff in OS-X, DWARF isn't one of them.


----------



## SeanC (Apr 21, 2009)

Did you try readelf(1)?

http://www.freebsd.org/cgi/man.cgi?query=readelf&manpath=FreeBSD+7.1-RELEASE

It is part of the gnu/binutils, not part of a standard OSX install, but you can get the source online. It is also available via DarwinPorts.


----------



## SeanC (Apr 21, 2009)

SirDice said:
			
		

> Maybe because OS-X borrowed heavily from FreeBSD?



In this case, it doesn't actually matter. DWARF debugging symbols is supported by gcc, the default cc on both FreeBSD and OSX (with Xcode installed).


----------



## CarminPolitano (Mar 21, 2012)

*dwarfdump*

Use the terminal command dwarfdump.


----------



## SirDice (Mar 21, 2012)

CarminPolitano said:
			
		

> Use the terminal command dwarfdump.



You're responding to a post that's almost three years old. Dwarfdump has already been mentioned.


----------

