gdb问题求助

软件和网站开发以及相关技术探讨
回复
youshuiyu
帖子: 7
注册时间: 2007-04-01 0:07

gdb问题求助

#1

帖子 youshuiyu » 2007-08-29 17:34

我装的是7.04的系统,装好以后,好像gdb是装好的。小弟也是新手,刚用gdb.在命令行下输入gdb后,显示如下:
GNU gdb 6.6
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 "i686-pc-linux-gnu".
(gdb)
然后输入file 和要调试的文件,输入 run 命令,运行正常。但当我输入list 命令的时候,报错如下 ;
list
1 init.c: No such file or directory.
in init.c
输入 list
No line 3 in file "init.c".
真的搞不明白,希望各位高手能给小弟详细介绍一下,小弟感激不尽。
头像
boydd
帖子: 255
注册时间: 2007-05-10 19:42
来自: 南京, Deutschland, Karlsruhe
联系:

#2

帖子 boydd » 2007-08-29 19:39

gdb找不到源代码,试着把可执行文件和源代码放到同个目录下,再gdb + 可执行文件
另外编译可执行文件时要加参数-g
youshuiyu
帖子: 7
注册时间: 2007-04-01 0:07

#3

帖子 youshuiyu » 2007-08-30 15:54

谢谢楼上的了,但是我的源代码是和可执行文件在一个目录下的呀。希望各位高手帮着看一下,谢谢了。
头像
boydd
帖子: 255
注册时间: 2007-05-10 19:42
来自: 南京, Deutschland, Karlsruhe
联系:

#4

帖子 boydd » 2007-08-30 20:17

http://www.cygwin.com/ml/gdb/2003-06/msg00112.html

this guy has same problem as u have.
That suggests that the init.c is coming from gcc/glibc, and has debug
information. It's not associated with your application.

1. make sure that, if u install the "glibc"
2. g++ -c -g -W -Wall testgdb.c

by using -W -Wall u can get more warning information

good luck
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#5

帖子 BigSnake.NET » 2007-08-30 20:49

安装配置 -> C/C++
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
youshuiyu
帖子: 7
注册时间: 2007-04-01 0:07

#6

帖子 youshuiyu » 2007-08-31 16:56

谢谢各位了,只是小弟是个菜鸟。gcc的配置还不知道如何配置,希望各位能给小弟详细介绍一下,这里感激不尽。
头像
boydd
帖子: 255
注册时间: 2007-05-10 19:42
来自: 南京, Deutschland, Karlsruhe
联系:

#7

帖子 boydd » 2007-08-31 17:25

gcc的配置?
什么方面的配置呢?
问题具体一点吧
youshuiyu
帖子: 7
注册时间: 2007-04-01 0:07

#8

帖子 youshuiyu » 2007-08-31 18:12

首先对你的帮助表示感谢。因为看到有跟帖说要配置gcc,而我的gcc是在系统装好以后就装好了的,我不知道是不是还要配置,此前我的gdb不能调试,我下载了一个准备再装一下,在gdb的README里,我看到有这样一段話:If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. 所以不知道到底问题出在哪里,也不知道该怎样做。
头像
boydd
帖子: 255
注册时间: 2007-05-10 19:42
来自: 南京, Deutschland, Karlsruhe
联系:

#9

帖子 boydd » 2007-08-31 22:55

一个linux里有多个编译其很正常,像我现在就有一个gcc3.3和一个gcc4,重要的是看你目前正在使用的是哪个版本的gcc,你可以type gcc看一下这个命令的出处,然后再用ls -l查看一下这个gcc链接到哪个版本的gcc上去了
我就是可以通过修改这个软连接来选择编译软件时的gcc版本的。

另外试一下安装glibc,你的问题也许就会解决了
还有,似乎你是准备下载gdb的源码再自己编译安装的,源里面不是就有gdb么,大家都在用,很正常。
有时不要把问题想的过于复杂,毕竟我们的目的是使用软件,而不是装软件:)
头像
suncanoe
帖子: 476
注册时间: 2005-12-07 0:17
来自: 昆明

#10

帖子 suncanoe » 2007-08-31 23:00

使用gcc编译时要使用参数-g
kukou
帖子: 18
注册时间: 2007-09-12 12:35

#11

帖子 kukou » 2007-09-20 12:24

我也有和LZ一样的问题.........
回复