GDB不能找到在CentOS调试信息 [英] gdb can not find debug info on Centos

查看:506
本文介绍了GDB不能找到在CentOS调试信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出一个很奇怪的问题。我的CentOS 6.5系统,使用gdb:

I am trying to figure out a very strange issue. I have CentOS 6.5 system with gdb:

GNU GDB(GDB)的红帽企业Linux(7.2-75.el6)

GNU gdb (GDB) Red Hat Enterprise Linux (7.2-75.el6)

和GCC:

海湾合作委员会(GCC)4.8.2 20131212(红帽4.8.2-8)

gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-8)

我有这个文件:

#include<stdio.h>
int main()
{
    printf("OK!");
    return 0;
}

我与编译:

which I compile with:

GCC -o一个交流转换器-g -O0

gcc -o a a.c -g -O0

该文件似乎是罚款:

The file seems to be fine:

$ file a
a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

但是当我尝试调试它,这种情况发生:

But when I try to debug it, this happens:

$ gdb a
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-75.el6)
Copyright (C) 2010 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 a...done.
(gdb) b main
Breakpoint 1 at 0x4004e4
(gdb) r 
Starting program: a 

Breakpoint 1, 0x00000000004004e4 in main ()
(gdb) l
1   /* Run time dynamic linker.
2      Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3      This file is part of the GNU C Library.
4   
5      The GNU C Library is free software; you can redistribute it and/or
6      modify it under the terms of the GNU Lesser General Public
7      License as published by the Free Software Foundation; either
8      version 2.1 of the License, or (at your option) any later version.
9   
10     The GNU C Library is distributed in the hope that it will be useful,
(gdb) l main
No line number known for main.

即,GDB拒绝看到任何调试信息。任何人有一个想法,这可能是一个问题在这里?

I.e., gdb refuses to see any debug information. Anybody has an idea what could be a problem here?

推荐答案

您GDB是pretty岁。你的GCC是相当新的。

Your GDB is pretty old. Your GCC is fairly new.

我怀疑你的GCC根据的 DWARF4 调试信息(默认为GCC-4.8 GCC-4.8 / changes.html相对=nofollow>发行说明),你的GDB不承认。

I suspect that your GCC is emitting DWARF4 debug info (default as of gcc-4.8 according to release notes), which your GDB does not recognize.

你得到与 -gdwarf-2更好的结果而不是 -g

如果是这样,升级您的GDB或使用 -gdwarf-2 这个编译器。

If so, upgrade your GDB or use -gdwarf-2 with this compiler.

这篇关于GDB不能找到在CentOS调试信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆