When debugging Windows application with Ollydbg, we can add comments to assembly language output as following:
00401020 push ebp ; add comment here
Can we add comments to gdb output just like the way above?
When we input disassemble
in gdb, it shows like this:
(gdb) disassemble main
Dump of assembler code for function main:
0x0804841d <+0>: push %ebp
0x0804841e <+1>: mov %esp,%ebp
0x08048420 <+3>: and $0xfffffff0,%esp
0x08048423 <+6>: sub $0x10,%esp
0x08048426 <+9>: movl $0x80484d0,(%esp)
0x0804842d <+16>: call 0x80482f0 <puts@plt>
0x08048432 <+21>: mov $0x0,%eax
0x08048437 <+26>: leave
0x08048438 <+27>: ret
End of assembler dump.
Can we add some comments line 0x0804841d in order that gdb output like this:
(gdb) disassemble main
Dump of assembler code for function main:
0x0804841d <+0>: push %ebp ; add comment here
0x0804841e <+1>: mov %esp,%ebp
0x08048420 <+3>: and $0xfffffff0,%esp
0x08048423 <+6>: sub $0x10,%esp
0x08048426 <+9>: movl $0x80484d0,(%esp)
0x0804842d <+16>: call 0x80482f0 <puts@plt>
0x08048432 <+21>: mov $0x0,%eax
0x08048437 <+26>: leave
0x08048438 <+27>: ret
End of assembler dump.
Can we add some comments
No.
Obviously you can save GDB output into a text file and add comments there to your heart's content. But GDB will not display them next time you disas main
.