2012년 3월 29일 목요일
disass main
G:\>gcc -c hello.c -o hello.exe
hello.c: In function `main':
hello.c:3: warning: return type of 'main' is not `int'
hello.c:6:2: warning: no newline at end of file
G:\>gdb hello.exe
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
This binary was built by Equation Solution <http://www.equation.com/>...
Reading symbols from G:\hello.exe...(no debugging symbols found)...done.
(gdb) disass main
Dump of assembler code for function printf:
0x00000000 <+0>: push %ebp
0x00000001 <+1>: mov %esp,%ebp
0x00000003 <+3>: sub $0x8,%esp
0x00000006 <+6>: and $0xfffffff0,%esp
0x00000009 <+9>: mov $0x0,%eax
0x0000000e <+14>: add $0xf,%eax
0x00000011 <+17>: add $0xf,%eax
0x00000014 <+20>: shr $0x4,%eax
0x00000017 <+23>: shl $0x4,%eax
0x0000001a <+26>: mov %eax,-0x4(%ebp)
0x0000001d <+29>: mov -0x4(%ebp),%eax
0x00000020 <+32>: call 0x25 <printf+37>
0x00000025 <+37>: call 0x2a <printf+42>
0x0000002a <+42>: movl $0x0,(%esp)
0x00000031 <+49>: call 0x36 <printf+54>
0x00000036 <+54>: leave
0x00000037 <+55>: ret
0x00000038 <+56>: nop
0x00000039 <+57>: nop
0x0000003a <+58>: nop
0x0000003b <+59>: nop
0x0000003c <+60>: nop
0x0000003d <+61>: nop
0x0000003e <+62>: nop
0x0000003f <+63>: nop
End of assembler dump.
(gdb)
hello.c: In function `main':
hello.c:3: warning: return type of 'main' is not `int'
hello.c:6:2: warning: no newline at end of file
G:\>gdb hello.exe
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
This binary was built by Equation Solution <http://www.equation.com/>...
Reading symbols from G:\hello.exe...(no debugging symbols found)...done.
(gdb) disass main
Dump of assembler code for function printf:
0x00000000 <+0>: push %ebp
0x00000001 <+1>: mov %esp,%ebp
0x00000003 <+3>: sub $0x8,%esp
0x00000006 <+6>: and $0xfffffff0,%esp
0x00000009 <+9>: mov $0x0,%eax
0x0000000e <+14>: add $0xf,%eax
0x00000011 <+17>: add $0xf,%eax
0x00000014 <+20>: shr $0x4,%eax
0x00000017 <+23>: shl $0x4,%eax
0x0000001a <+26>: mov %eax,-0x4(%ebp)
0x0000001d <+29>: mov -0x4(%ebp),%eax
0x00000020 <+32>: call 0x25 <printf+37>
0x00000025 <+37>: call 0x2a <printf+42>
0x0000002a <+42>: movl $0x0,(%esp)
0x00000031 <+49>: call 0x36 <printf+54>
0x00000036 <+54>: leave
0x00000037 <+55>: ret
0x00000038 <+56>: nop
0x00000039 <+57>: nop
0x0000003a <+58>: nop
0x0000003b <+59>: nop
0x0000003c <+60>: nop
0x0000003d <+61>: nop
0x0000003e <+62>: nop
0x0000003f <+63>: nop
End of assembler dump.
(gdb)
피드 구독하기:
글 (Atom)


