简体   繁体   English

GDB exec错误:没有这样的文件或目录

[英]GDB exec Error: No such file or directory

I have an executable, which I can read symbols from (so it seems.) My problem is this: when it comes time to run, I get the following error: 我有一个可执行文件,我可以从中读取符号(所以看起来。)我的问题是:当运行时,我收到以下错误:

(gdb) run Starting program: /home/usr/src/etcetera/etcetera/bin/theExecutable.exe Cannot exec -c exec /home/usr/src/etcetera/etcetera/bin/theExecutable.exe. Error: No such file or directory During startup program exited with code 127

obviously, I have edited the directories here. 显然,我在这里编辑了目录。 I searched how to fix this on SO, and tried some of the following solutions: 我搜索了如何解决这个问题,并尝试了以下一些解决方案:

gdb cannot see source file gdb无法看到源文件

GDB can't find source file GDB找不到源文件

gdb can not load source file? gdb无法加载源文件?

got onto this link: 进入这个链接:

https://sourceware.org/gdb/download/onlinedocs/gdb/Source-Path.html#Source-Path https://sourceware.org/gdb/download/onlinedocs/gdb/Source-Path.html#Source-Path

and am trying to change the source file directory. 我正在尝试更改源文件目录。 (The source files are not in the same location as the executable, but instead are spread over a range of different places.) Unless I am mistaken, the way of doing this is to go: (源文件与可执行文件不在同一个位置,而是分布在不同的地方。)除非我弄错了,这样做的方法是:

(gdb) directory /home/usr/src/etcetera/etcetera/rootDirectoryForSourcefiles

and have the GDB search this directory. 并让GDB搜索此目录。 I have even tried changing directory into the source directory, and then running but still, it wants to try where the executable lives. 我甚至尝试将目录更改为源目录,然后运行但仍然,它想尝试可执行文件所在的位置。

Am I completely missing the mark here in an obvious way, or is this likely to be quite obscure? 我是否完全错过了这里的标记,或者这可能是非常模糊的?

Note if you wish to downvote this question, I would appreciate an explanation as to why, so I can improve for the future 请注意,如果您希望对此问题进行投票,我将非常感谢您解释原因,以便我可以为将来做出改进

Thanks 谢谢

You are barking up the wrong tree. 你正在咆哮错误的树。 You problem has ~nothing to do with source files, and everything to do with your executable file. 您的问题与源文件无关,与您的可执行文件有关。

It may be related to something in your ~/.gdbinit , or your ~/.bashrc , or the way you invoked GDB. 它可能与~/.gdbinit ,或~/.bashrc某些内容有关,也可能与您调用GDB的方式有关。

You should start by doing a basic sanity check: 您应该首先进行基本的健全性检查:

env SHELL=/bin/sh gdb -nx /bin/date
(gdb) run

If that doesn't work, your GDB installation is screwed up. 如果这不起作用,你的GDB安装就搞砸了。

If that does work, one of the three things I mentioned above is very likely the cause of your troubles. 如果这确实有效,我上面提到的三件事之一很可能是你的麻烦的原因。

I had this problem and it turned out that the shell wasn't set correctly in the /etc/passwd file. 我遇到了这个问题,结果发现在/etc/passwd文件中没有正确设置shell。

To solve it, I opened the file with 为了解决这个问题,我打开了文件

sudo vipw

and added /bin/bash to the my account's data there. 并将/bin/bash添加到我帐户的数据中。

Try to: 尝试:

export SHELL=/bin/sh export SHELL = / bin / sh

before running gdb 在运行gdb之前

I had met same problem. 我遇到了同样的问题。 When my 当我的

SHELL=/usr/local/bin/tcsh

but I have only the file .cshrc , gdb reports the same error. 但我只有文件.cshrc ,gdb报告相同的错误。

When I change SHELL: 当我改变SHELL时:

setenv SHELL /bin/csh

Then everything goes fine. 一切都很顺利。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gdb 列表错误“没有这样的文件或目录” - gdb list error “No such file or directory” gdb 附加:没有这样的文件或目录错误 - gdb attach : No such file or directory erros Linux上的gdb fork()exec - gdb fork() exec on Linux 编译错误:“g++:尝试执行'cc1plus'时出错:execvp:没有这样的文件或目录” - Compile error: “g++: error trying to exec 'cc1plus': execvp: No such file or directory” gcc和g ++错误:尝试执行'cc1plus'时出错:execvp:没有这样的文件或目录 - gcc and g++ error: error trying to exec 'cc1plus': execvp: No such file or directory Trilinos - c ++:试图执行'cc1plus'时出错:execvp:没有这样的文件或目录 - Trilinos - c++: error trying to exec 'cc1plus': execvp: No such file or directory 尝试执行'cc1'的gcc错误:execvp:与非root用户一起运行时没有这样的文件或目录 - gcc error trying to exec 'cc1': execvp: No such file or directory when running with non-root user gdb错误不是可执行格式:无法识别文件格式 - gdb error not in executable format: File format not recognized GDB 无法加载 so 文件和错误 没有此类文件或目录 - GDB failed to load so files and errors No such file or directory 检查 gdb 版本时出错:加载共享库时出错:libpython3.10.dll:无法打开共享 object 文件:没有这样的文件或目录 - error while checking gdb version: error while loading shared libraries: libpython3.10.dll: cannot open shared object file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM