Is it possible to get a complete disassembly (which can act as input to an assembler) of an executable?
When I use otool -tV a.out
I get to see only the text section. Other sections like data aren't visible.
When I use gdb
, the disassemble command requires a start and an end address. However I do not know how to find out the start and the end address of a binary (say a.out).
I'm trying to disassemble an executable, tinker with the assembly code and then reassemble it. Is that possible?
It'd also help if one can find out the names of all the sections in a binary.
You can use the Hopper Disassembler
quote:
It costs $59, but you can download a demo to check if it gets the job done first.
EDIT
It seems you can achieve this with
otool
as well, according to the manual.Also have a look at this short blog post (archive link, original is gone) that describes the mentioned use of
otool
, and how you can useobjdump
as mentioned by @Sjlver.