|
发表于 2005-6-1 14:05:09
|
显示全部楼层
如何使用gdb查看一个进程的环境变量
int main(){}
将上面这一行写入一个文件,例如test.c
gcc test.c
这样将得到一个a.out
用gdb 启动a.out
gdb a.out
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
设置断点
(gdb)b main
执行
(gdb)r
然后a.out将在main函数入口处停住
然后以字符串方式检查堆栈
(gdb)x/1000s $esp
不断的按回车直到出现
0xc0000000: <Address 0xc0000000 out of bounds>
相信这时你已经看到了 |
|