GDB Eclipse的调试模式下无法找到STDLIB / rand.c [英] GDB on eclipse debug mode can't find stdlib/rand.c

查看:1301
本文介绍了GDB Eclipse的调试模式下无法找到STDLIB / rand.c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图把GDB在Ubuntu与Eclipse CDT的运行开始调试一些简单的程序。所以我做的步骤我认为是有必要让它运行:

I am trying to put the gdb to run with eclipse cdt on ubuntu to start debugging some simple programs. So I did the steps I reckon as necessary to get it running:

1 创建一个可执行的项目

1. Create an executable project

2 编译

3。运行

4。创建文件.gdbinit并将其放置在主项目文件夹

4. Create the file .gdbinit and place it on the main project folder

5 :设置一些调试器的<一个href=\"http://nicolas.riousset.com/eclipse-how-to-debug-a-c-console-application-using-a-native-dos-console-instead-of-the-ide-integrated-one/\"相对=nofollow>配置:

5. Set some of the debugger configuration:

5。我也试过找的 gdbinit 文件看起来有些像这样的:

5. I also tried to find a .gdbinit file that would look some like this:

set schedule-multiple

dir ~/gcc_build/4.7.2/build/gcc
dir ~/gcc_build/4.7.2/gcc
dir ~/gcc_build/4.7.2/gcc/cp
dir ~/gcc_build/4.7.2/gcc/lto
source ~/gcc_build/4.7.2/build/gcc/gdbinit.in

但我没有找到我的电脑中了类似的话,即使做了之后:

But I didn't find anything similar in my computer, even after doing a:

# find / -name .gdbinit

所以,我的文件.gdbinit结束与简单的内容 - 是的,不仅如此;

So, my file .gdbinit end up with the simple content - yes only that:

set new-console on

然后我点击应用和调试:

Then I clicked on Apply and Debug:

正常启动工作很好的GDB。我preSS按钮跳过/ F6和调试穿过code一步一步跳跃。直到点到达命令兰特()和GDB与消息挂起:

The gdb starts working nicely as expected. I press the button "step over / F6" and the debugger goes jumping through the code step by step. Until the point it reaches the command rand() and the gdb hangs with the message:

Can't find a source file at "/build/buildd/eglibc-2.19/stdlib/rand.c" 
Locate the file or edit the source lookup path to include its location.

所以我也没能成功找到rand.c更新此路径,包括它的位置:

Thus I also tried unsuccessfully to find the rand.c to update this path to include its location:

# find / -name rand.c
# find / -name stdlib

从GDB抱怨rand.c缺少错误消息后,然后我试图保持踏步......从那时起,当我重新启动调试步进模式禁用:

After the error message from GDB complaining that rand.c is missing, then I tried to keep stepping... since then the stepping mode is disable when I restart the debug:

这方面的问题发生,因为一些设置为我的文件.gdbinit不见了?或者一些GDB是如何不能够找到从C99 STDLIB的rand.c?当我编译并运行它很好地运行该程序。只有当我尝试启动调试器是GDB时崩溃。

Is this problem happening because some setting for my file .gdbinit is missing? Or some how GDB is not able to find the rand.c from stdlib from c99? When I compile and run the program it runs nicely. Only when I try to launch the debugger is when GDB crashes.

更新:我运行后缺少rand.c问题<一href=\"http://stackoverflow.com/questions/26634788/how-to-debug-libgcc-source-in-gdb-ubuntu-14-04-1?rq=1\">commands:

Update: I got the missing rand.c problem after running the commands:

# apt-get install libc6-dbg
# apt-get source libc6

但是,现在出现一个不同的错误:

But now a different error appears:

Can't find a source file at "/build/buildd/eglibc-2.19/csu/libc-start.c" 
Locate the file or edit the source lookup path to include its location.

我应该还安装库GDB?

Should I also install that library for gdb?

所有的建议都是非常AP preciated。

All suggestions are highly appreciated.

推荐答案

从我所看到您的描述......希望您发布,第四和第五映像你做得对所有必需的步骤。

From what I saw on your description... looking to the 4th and 5th image you posted, you did right all the required steps.

不过,在我看来,你的GDB连接到几个项目。这意味着,除非你真的需要,我会强烈建议你选择,你是不是正在调试的所有项目,并从调试模式下删除它们。所以,我的建议是,你已完成所有步骤后,你是到目前为止,然后去:

However, it seems to me that your GDB is attached to several projects. That means that unless you really need that, I would strongly advise you to select all project that you are not currently debugging and delete them from the debugger mode. So, my suggestion is that after you have done all the steps you did so far, then go on:

Debug Configurations > C/C++ Applications: (drop down it)

...然后点击你是不是编译每个项目,从鼠标右键选择删除 - 但不要担心,它不会删除你的项目,但只有项目到您的调试器附着模式。

... then click on each project you are not compiling, with right button from the mouse select "delete" - but don't worry, it will not delete your project, but only the attachment of that project to your debugger mode.

然后重新启动蚀。当您再次尝试在调试模式下运行,一切都将运行比以前更加顺畅。

Then restart the eclipse. When you again try to run in the debugger mode, everything will run much smoother than before.

这篇关于GDB Eclipse的调试模式下无法找到STDLIB / rand.c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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