我刚学linux编程, 刚刚学调试,就碰到问题!

我用gvim写了个最简单的代码?

#include

int main()

{

printf("hello 1234567890 n");

return 0;

}

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

[new@localhost hello]$ gcc -o test test2.c

[new@localhost hello]$ gdb test

GNU gdb Red Hat Linux (6.6-35.fc8rh)

Copyright (C) 2006 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 "i386-redhat-linux-gnu"...

(no debugging symbols found)

Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run

Starting program: /home/new/workspace/Linux/hello/test

warning: Missing the separate debug info file:      // 警告: 错过分开调试信息文件     /usr/lib/debug/.build-id/ac/2eeb206486bb7315d6ac4cd64de0cb50838ff6.debug

(no debugging symbols found)                          // 调试标志没有发现

(no debugging symbols found)

warning: Missing the separate debug info file:      // 警告: 错过分开调试信息文件   /usr/lib/debug/.build-id/ba/4ea1118691c826426e9410cafb798f25cefad5.debug

(no debugging symbols found)

hello 1234567890

Program exited normally.                               // 程序正常退出

(gdb) list

No symbol table is loaded.  Use the "file" command. // 符号表不被装载。使用"文件" 命令

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

不知道那个警告该如何消除! 是不是系统没有装好? 为什么列不出源代码! 问题在那里!是我的操作不对吗?

|

你都没有调式信息

改成

gcc -g -o test test2.c

|

在编译的时候加入-g参数就可以了。

cc -c -g test.c

cc -o test test.o

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐