Operating System - Linux
1826004 Members
3301 Online
109690 Solutions
New Discussion

Re: Extracting function names from a C object file

 
SOLVED
Go to solution
Leslie Chaim
Regular Advisor

Extracing function names from a C object file.

Is there a tool (or something else) to extract the function names from a C object file.

Thanks for any help.
If life serves you lemons, make lemonade
7 REPLIES 7
Alan Riggs
Honored Contributor

Re: Extracing function names from a C object file.

what filename
strings filename
Leslie Chaim
Regular Advisor

Re: Extracing function names from a C object file.

Alan,

Neither 'what' nor 'strings' works.

I just compiled funcs.c into funcs.o, and would like to extract the function names from the *.o file.
If life serves you lemons, make lemonade
Andreas Voss
Honored Contributor
Solution

Re: Extracing function names from a C object file.

Hi,

try this:

nm file.o

Regards
Andreas Voss
Honored Contributor

Re: Extracing function names from a C object file.

Hi,

try this:

nm file.o

Regards
Alan Riggs
Honored Contributor

Re: Extracing function names from a C object file.

Ah, I misunderstood. Andreas is correct, nm should work for that.
amit1209
Occasional Contributor

Re: Extracing function names from a C object file.

nm works fine. Can you please let me know hw to interpret the other output shown.
It works in executable as well. I want to know if one can see the source filename and pathname as well.

Amit
Dennis Handly
Acclaimed Contributor

Re: Extracting function names from a C object file

nm -px will show a list of symbols. For functions it either has a "T" or "t" (for static).

>Can you please let me know how to interpret the other output shown.

See nm(1). For -px, it is value, letter then symbol.

>I want to know if one can see the source filename and pathname as well.

You could use odump -comp, or elfdump -dc (for PA64 or IPF).

If you have debug info, you can see with "info source".