免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3273 | 回复: 8
打印 上一主题 下一主题

gdb的警告 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-31 15:02 |只看该作者 |倒序浏览
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /home/godlongv/code/cwork/c/hou

warning: Missing the separate debug info file: /usr/lib/debug/.build-id/ac/2eeb206486bb7315d6ac4cd64de0cb50838ff6.debug

warning: Missing the separate debug info file: /usr/lib/debug/.build-id/ba/4ea1118691c826426e9410cafb798f25cefad5.debug
0

Program exited with code 02.
有上边的两警告,没法调试怎么回事?

论坛徽章:
0
2 [报告]
发表于 2007-12-31 20:36 |只看该作者
编译的时候没加-g选项?

论坛徽章:
0
3 [报告]
发表于 2007-12-31 20:43 |只看该作者
原帖由 cugb_cat 于 2007-12-31 20:36 发表
编译的时候没加-g选项?

告诉人家,-g 是带调试符号的

论坛徽章:
0
4 [报告]
发表于 2008-01-01 11:01 |只看该作者
我发誓,一定加了"-g"了。

论坛徽章:
0
5 [报告]
发表于 2008-01-01 13:50 |只看该作者
你的调试信息被分离在了单独的文件中,调试时,gdb通过符号表文件里的链接又找不到单独
存放调试信息的那个文件。请确认一下你的调试环境和编译环境是否一致?根据错误信息查看
指定目录和指定文件是否存在并确认错误原因。如果文件存在,再通过设置gdb的调试信息文件
目录来让gdb找到它。

论坛徽章:
0
6 [报告]
发表于 2008-01-10 17:21 |只看该作者
原帖由 雨丝风片 于 2008-1-1 13:50 发表
你的调试信息被分离在了单独的文件中,调试时,gdb通过符号表文件里的链接又找不到单独
存放调试信息的那个文件。请确认一下你的调试环境和编译环境是否一致?根据错误信息查看
指定目录和指定文件是否存在并确认错误原因。如果文件存在,再通过设置gdb的调试信息文件
目录来让gdb找到它。


通过google搜索到了这里。

问题和楼主一模一样。 编译环境和调试环境完全一样, 它指定的那个文件压根不存在。

我的程序:

#include <stdio.h>

const char array[] = "\x6b\xc0\xe8\x2e\x7e\xf6\xff\xe8\xd1\x16\xf2\xff\xb8\x01\x00\x00\x00\xe8\xaa\x1c\xf4\xff\x89\xd8\x83\xc4\x10\x5b\x5d\xc3\x90\x90\x90\x55\x89\xe5\x53\x83\xec\x0c\x8b\x48\x04\x8b\x11\x39\xc2\x74\x18\x89\x54\x24\x08\x89\x44\x24\x04\xc7\x04\x24\xbe\x32\x6b\xc0";

int main(int argc, char *argv[])
{
    printf("%p\n", array);
    *(int *)0 = 0;

    return 0;
}



大家可以自己试试有没有这个问题。 我是在gdb中run时出现的警告。

论坛徽章:
0
7 [报告]
发表于 2008-01-10 19:31 |只看该作者
原帖由 albcamus 于 2008-1-10 17:21 发表


通过google搜索到了这里。

问题和楼主一模一样。 编译环境和调试环境完全一样, 它指定的那个文件压根不存在。

我的程序:

#include

const char array[] = "\x6b\xc0\xe8\x2e\x7e\xf6\xff\xe ...


我这里没有问题,似乎是gdb的问题。
  1. fixend% gdb -v
  2. GNU gdb 6.6-debian
  3. Copyright (C) 2006 Free Software Foundation, Inc.
  4. GDB is free software, covered by the GNU General Public License, and you are
  5. welcome to change it and/or distribute copies of it under certain conditions.
  6. Type "show copying" to see the conditions.
  7. There is absolutely no warranty for GDB.  Type "show warranty" for details.
  8. This GDB was configured as "i486-linux-gnu".
复制代码

  1. fixend% uname -a
  2. Linux ubuntu 2.6.22-14-F #12 Wed Jan 9 20:19:22 CST 2008 i686 GNU/Linux
复制代码

论坛徽章:
0
8 [报告]
发表于 2008-01-11 09:02 |只看该作者
应该是具体环境的问题,从现象上来看,是调试环境中的库采用了分离调试信息文件的方式,而又没有另外安装调试信息文件。
网上搜到下面内容,给出了一些解决办法的邮件链接,可以参考一下。

GDB Messages Enhanced To Indicate Missing Debuginfo Files

A query from NealBecker asked[1] why running gdb on a program now produced many warnings of the form "Missing the separate debug info file: /usr/lib/debug/.build-id/XXXXXXX.debug". AndrewHaley responded[2] that the problem was that the appropriate "-debug" packages for the shared libraries were not installed and suggested that the absence of specific information as to which libraries were missing was a bug.

[1] https://www.redhat.com/archives/ ... nuary/msg00300.html

[2] https://www.redhat.com/archives/ ... nuary/msg00302.html

While acknowledging that it was slightly awkward to find the information MattMiller suggested[3] enabling the debuginfo repository so that YUM could be used to install the missing filename's package. JesseKeating added[4] that it was easier to use debuginfo-install <appname> which would automatically enable the debuginfo repository and install the requisite debuginfo packages. A very informative post from JanKratochvil, a Red Hat employee primarily focusing on GDB, followed[5]. Jan's post showed how to find the name of the library missing debuginfo ls -l /usr/lib/debug/.build-id/fa/XXXX.debug, how to find the RPM package name to install the debuginfo repoquery -qf /usr/lib/debug/.build-id/fa/XXXXX.debug and as suggested previously by MattMiller how to simply install the missing debuginfo package with yum install /usr/lib/debug/.build-id/fa/XXXXX.debug. Jan cautioned that debuginfo-install <appname> method might not work due to multiple simultaneous debuginfo versions present and he also encouraged discussion on how to improve the output.

[3] https://www.redhat.com/archives/ ... nuary/msg00306.html

[4] https://www.redhat.com/archives/ ... nuary/msg00307.html

[5] https://www.redhat.com/archives/ ... nuary/msg00308.html

Further discussion between AndrewHaley and Jan on how to improve the ability of GDB to suggest the correct debuginfo packages uncovered some constraints. Jan pointed[6] out that debuginfo-install will have problems with dynamically opened libraries, that printing out a suggested RPM package would unacceptably tie GDB to Fedora. These debuginfo files are the result of work by RolandMcGrath and others on BuildID, which is a Fedora 8 feature[7][8], which extended the information in core files to include specific versions of binaries and dynamic shared objects. This enables precise replication of a problem for debugging. Implementing this required changes to the kernel[8a], ld and other parts of the compiler toolchain and so are of general interest, non-exclusive to Fedora. AndrewHaley suggested[9] that a local (to Fedora) patch could produce his version of perfection, which would be to suggest a specific yum installation command. JamesAntill thought[10] that if perfection and local patching were being considered then tighter integration with rpm or yum could allow the use of debuginfo-install <packagename>.

[6] https://www.redhat.com/archives/ ... nuary/msg00312.html

[7] http://fedoraproject.org/wiki/Releases/FeatureBuildId

[8] Section 15.2 of the gdb info file explains that a build-id is a section of the executable file which is a unique identification hash which remains constant across multiple builds of the same build tree.

[8a] http://www.uwsg.indiana.edu/hype ... el/0707.1/1702.html

[9] https://www.redhat.com/archives/ ... nuary/msg00317.html

[10] https://www.redhat.com/archives/ ... nuary/msg00339.html

When TomLondon experimented[11] with debuginfo-install and got a large list of dependencies Jan asked[12] why debuginfo packages were pulling in binary packages and suggested a patch to the redhat rpm macros. RolandMcGrath responded[13] with a suggestion that redhat-rpm-config should also change.

[11] https://www.redhat.com/archives/ ... nuary/msg00350.html

[12] https://www.redhat.com/archives/ ... nuary/msg00353.html

[13] https://www.redhat.com/archives/ ... nuary/msg00362.html

In closing DavidNielsen suggested[14] that PackageKit might aid in figuring out which packages were missing and offering to install them for the user.

[14] https://www.redhat.com/archives/ ... nuary/msg00355.html

论坛徽章:
0
9 [报告]
发表于 2008-03-22 10:58 |只看该作者
不知道LZ这个问题解决了没有?我遇到了和你完全相同的问题,到底该怎么处理呢?我是新手,麻烦各位帮忙。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP