Application Developer
Application Developer

Reputation: 149

GDB on any executable?

Is it possible to use the GNU debugger on executables that were not compiled with GNU tools(gcc, gas, g++) and dump the assembly code?

Upvotes: 0

Views: 102

Answers (1)

user2404501
user2404501

Reputation:

Yes, you can use gdb on any executable. Without debugging symbols, some of the commands won't work, but there's plenty of commands that work at the assembly level. stepi to single-step instructions, you can print registers (using C-like expression syntax: print $rbx+($rax<<$rcx)) and modify them.

But for generating an assembly dump of the whole program, objdump -d is easier. objdump -D if there's code in weird places (which is sometimes the case with malware). And objdump -s for a view of the data segment.

Upvotes: 3

Related Questions