|
|
发表于 2006-11-5 20:22:16
|
显示全部楼层
有个比较笨的方法,你可能不喜欢,
也不知道复杂的命令行不行:
看例子:
souldump@BirdSky:~/bin> cat ether # eher 为保存命令的文件
step
step
step
step
step
souldump@BirdSky:~/bin>
BirdSky:/home/souldump/bin # gdb de
GNU gdb 6.4
Copyright 2005 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 "i586-suse-linux"...Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b 58
Breakpoint 1 at 0x804881c: file de.c, line 58.
(gdb) run
Starting program: /home/souldump/bin/de
Hi, I get gateway address 10.0.119.254
0:11:bb:3d:e6:ff
The gateway MAC we RETURN is :0:11:bb:3d:e6:ff
Breakpoint 1, main () at de.c:58
58 bind_gateway_mac((struct sockaddr *)&gateway, &hardaddr);
(gdb) shell cat ether #用鼠标选择,把输出内容复制,然后再粘贴上来就可以了
step
step
step
step
step
(gdb) step
bind_gateway_mac (gwip=0xbfa10ef4, hwp=0xbfa10ee4) at de.c:215
215 sockfd = socket(AF_INET, SOCK_DGRAM, 0);
(gdb) step
216 if (sockfd < 0)
(gdb) step
219 sin = (struct sockaddr *)&arpreq.arp_pa;
(gdb) step
220 memcpy(sin, gwip, sizeof(struct sockaddr));
(gdb) step
221 sin->sa_family = AF_INET;
(gdb)
.........
就是先调用shell显示内容,然后在把显示的内容复制再粘贴到gdb中,
不过不能用快捷键了,CTRL+C是信号了。
你用鼠标好了。要是你的控制台不支持鼠标就没办法了。 |
|