#include
#include
#include
#include
#include
int main(int argc,char** argv)
{
printf("\ntest generic function 11\n");
exit(1);
printf("\ntest generic function 31\n");
return 0;
}[/code](gdb) b main
Breakpoint 1 at 0x804847d: file hook1.c, line 10.
(gdb) disas exit
Dump of assembler code for function exit@plt:
0x080483b0
0x080483b6
0x080483bb
End of assembler dump.
(gdb) r
Starting program: /home/zyd/projects/test
Missing separate debuginfo for /lib/ld-linux.so.2
Try: zypper install -C "debuginfo(build-id)=d7706cbaa0ca09319cb645eac789cb8399078797"
Missing separate debuginfo for /usr/lib/libstdc++.so.6
Try: zypper install -C "debuginfo(build-id)=7a23cb3bcf4e7a44325f46051276e8e7872f0ec7"
Missing separate debuginfo for /lib/libm.so.6
Try: zypper install -C "debuginfo(build-id)=a488c775caa0433cb23f9764d683150f40872ef1"
Missing separate debuginfo for /lib/libgcc_s.so.1
Try: zypper install -C "debuginfo(build-id)=d7d12f7fa08cc56782efdf6ec887bb02452b3646"
Missing separate debuginfo for /lib/libc.so.6
Try: zypper install -C "debuginfo(build-id)=ee302691046515fe3766ae3b7d47afd3e3a8d063"
Breakpoint 1, main (argc=1, argv=0xbffff104) at hook1.c:10
10 printf("\ntest generic function 11\n");
Current language: auto
The current source language is "auto; currently c++".
(gdb) disas exit
Dump of assembler code for function exit:
0xb7d59140
0xb7d59141
0xb7d59146
0xb7d5914c
0xb7d5914f
0xb7d59157
0xb7d5915d
0xb7d59161
0xb7d59165
0xb7d59168
End of assembler dump.
(gdb)
在执行(gdb) r前后可以发现,exit对应的汇编代码内容发生了变化,这个是为什么呢 ?
vfdff 于 2010-11-14 12:24:10发表:
(gdb) b main
Breakpoint 1 at 0x8048487: file hook1.c, line 15.
(gdb) b printf
Function "printf" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (printf) pending.
(gdb) b exit
Breakpoint 3 at 0x80483b0
(gdb)
为什么对同样的库函数,exit就定义了,而printf则没有定义呢 ?