ddd gdb 调试程序时 向程序输入文件

gdb hexdump2
GNU gdb 6.8
Copyright (C) 2008 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-linux-gnu"...
(gdb)

--------------------------------------------------------------------------------------------------------------------

但hexdump2需要输入一个普通文件才可继续运行。添加被调试程序的参数文件: 

(gdb) run < makefile
Starting program: /home/shadowwalker/Documents/asmsbs3e/chapter10/hexdump2/hexdump2 < makefile
68 65 78 64 75 6D 70 32 3A 20 68 65 78 64 75 6D |hexdump2: hexdum|
70 32 2E 6F 0A 09 6C 64 20 2D 6F 20 68 65 78 64 |p2.o..ld -o hexd|
75 6D 70 32 20 68 65 78 64 75 6D 70 32 2E 6F 0A |ump2 hexdump2.o.|
68 65 78 64 75 6D 70 32 2E 6F 3A 20 68 65 78 64 |hexdump2.o: hexd|
75 6D 70 32 2E 61 73 6D 0A 09 6E 61 73 6D 20 2D |ump2.asm..nasm -|
66 20 65 6C 66 20 2D 67 20 2D 46 20 73 74 61 62 |f elf -g -F stab|
73 20 68 65 78 64 75 6D 70 32 2E 61 73 6D 0A 00 |s hexdump2.asm..|

Program exited normally.

在ddd中。F2运行程序时会提示需要的参数,此时在对话框中输入 < makefile即可。

posted @ 2012-11-05 21:56  Mr.Shadow  阅读(939)  评论(0编辑  收藏  举报