日期:2014-05-16  浏览次数:20624 次

C新手,在使用调试工具GDB命令时的小问题
我是自学C和linux,因为对C和linux系统很感兴趣

在看过一些视频和书籍后,我就开始折腾。

但在调试这里我就卡住了,就是GDB命令,我照着书上和视频上弄,可结果不一样。

它老是报一个说我的文件和目录不存在,详细过程如下:

[cgy@linux asm]$ ls
main.c  run

[cgy@linux asm]$ gcc -g main.c -o tst

[cgy@linux asm]$ ls
main.c  run  tst

[cgy@linux asm]$ gdb tst
GNU gdb (GDB) Fedora 7.6.1-46.fc19
Copyright (C) 2013 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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/cgy/workspace/C\C++/test/asm/tst...done.

(gdb) b main
Breakpoint 1 at 0x400554: file main.c, line 30.

(gdb) run
Starting program: /home/cgy/workspace/C\C++/test/asm/tst 
/bin/bash: /home/cgy/workspace/CC++/test/asm/tst: 没有那个文件或目录
During startup program exited with code 127.

(gdb) l
21 "POP EBP\n"
22 "RET\n"
23 };
24 }
25 */
26 int main()
27 {
28 short img[256][256];
29 int i,j;
30 for(i = 0;i < 256; ++i)

(gdb)


一运行它就报
(gdb) run
Starting program: /home/cgy/workspace/C\C++/test/asm/tst 
/bin/bash: /home/cgy/workspace/CC++/test/asm/tst: 没有那个文件或目录
During startup program exited with code 127.
我是新手,我不知道是什么原因

------解决方案--------------------
是否程序已经运行结束了阿?
------解决方案--------------------
C C++ 文件夹名字之间有空格吧
------解决方案--------------------
尽量避免在路径中使用特殊字符,你注意一下下面的2个路径不一致,可能是特殊字符造成的
Starting program: /home/cgy/workspace/C\C++/test/asm/tst 
/bin/bash: /home/cgy/workspace/CC++/test/asm/tst