-2

I would like to ask you guys for a help. I need to use objdump command on a C-code file, disassemble it and print out names (anywhere, preferably on the stdout) of the functions (and their dependency on others) in it (in format of "caller => callee"). First part is pretty easy, I just objdump the file with -d parameter. The part I can't get over is - how do I "cut out" those lines and how do I print them out? I know what I want to find (lines of the objdump containing "callq", hexadecimal adress and finally, the name of the function in pointed brackets (<>)) but I don't know how to find it and how to print that out.

Experience with shell: about 1-2 hours of studying it...

Thank you very much. Regards, C00kie

  • I am not an shell expert, I tried, but failed. Your desired logic is complicated, it's too hard to implement with 'grep', 'sed' or 'awk', why don't use python script instead? – Daniel King Mar 21 '14 at 10:04

1 Answers1

2

it seems like you just need to know the force of grep. When you call objdump on you program it will output all lines. You just want to retain the lines containing "callq", right? Then use grep.

objdump -d program | grep callq

grep will print out only the lines containing "callq"

Chris Maes
  • 35,025
  • 12
  • 111
  • 136