objdump, displaying without offsets
objdump, displaying without offsets
When dumping an executable file I want only code segment be printed standart output. Not offsets and binary form of codes.I can note achive it from man objdump.Is there a way?
2 Answers
2
You can suppress the object code hex dump with
--no-show-raw-insn
If you have jumps in the code then you need the offsets to make sense of them, but if you really want to strip them, filter the code with something like:
objdump -d --no-show-raw-insn myfile.o | perl -p -e 's/^s+(S+):t//;'
Example output:
0000000000000000 <foo>:
retq
lea 0x0(%rsi),%rsi
lea 0x0(%rdi),%rdi
Disassembly of section .gnu.linkonce.t.goo:
0000000000000000 <goo>:
retq
lea 0x0(%rsi),%rsi
lea 0x0(%rdi),%rdi
If you want to achieve same output as Peeter Joot showed but without using Perl command line. Then you can use Grep and Cut tool instead, like shown below.
objdump -d --no-show-raw-insn my_binary_file.o | grep "^ " | cut -f2,3
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.