gdb错误-文件未采用可执行格式:无法识别文件格式 [英] gdb error- File not in executable format: File format not recognized

查看:670
本文介绍了gdb错误-文件未采用可执行格式:无法识别文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用gdb调试名为xdf的某个程序,但是当我运行gdb xdf时,出现以下错误:

I am trying to debug a certain program called xdf with gdb but when i run gdb xdf, i get the following error:

"/home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf": not in executable format: File format not recognized

该程序是符号链接的,并且 file /home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/的输出x86_64-pc-linux-gnu-libc2.27 / bin / xdf 是:

The program is symbolically linked and the output of file /home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf is:

/home/nealtitusthomas/X-ray_astronomy/heasoft-6.24/x86_64-pc-linux-gnu-libc2.27/bin/xdf: symbolic link to ../../ftools/x86_64-pc-linux-gnu-libc2.27/bin/xdf

此处给出的解决方案无法执行的gdb错误:无法识别文件格式,原因是安装的gdb是32位版本,程序为64位。但是,我的gdb安装是64位。这可以通过以下确认:

The solution given here gdb error not in executable format: File format not recognized says that it is because the gdb installed is a 32 bit version and the program is 64 bit. However, my gdb installation is 64 bit. This is confirmed by the following:

This GDB was configured as "x86_64-linux-gnu". 


推荐答案


file / home / nealti ...

通常,您几乎总是应该使用 file -L / home /...代替-该命令将取消引用任何符号链接,并告诉您 解析后文件是什么所有符号链接。

In general, you almost always should use file -L /home/... instead -- that command will dereference any symbolic links, and tell you what the file is after resolving all the symlinks.


POSIX shell脚本,ASCII文本可执行文件

您正在尝试调试Shell脚本。 GDB不知道该怎么做。

You are trying to debug a shell script. GDB has no idea how to do that.

您需要在外壳程序脚本中查找(),并找出所需的编辑器。最终调用什么 actual 二进制文件并对其进行调试。

You need to look inside that shell script (with an editor of your choice), find out what actual binary it eventually invokes, and debug that.

包装外壳脚本通常看起来像这样:

The wrapper shell scripts typically look something like this:

 #!/bin/sh
... some code to figure out installation directory (e.g. INSTALL_DIR)
export LD_LIBRARY_PATH="$INSTALL_DIR/lib64:..."

# Now invoke the binary:
exec "$INSTALL_DIR/bin/xdf.exe" "$@"

您要做的是将最后一行替换为:

What you'll want to do is replace the last line with:

exec /usr/bin/gdb --args "$INSTALL_DIR/bin/xdf.exe" "$@"

并正常运行 xdf shell脚本。现在它将自动神奇地调用gdb。

and run your xdf shell script normally. It will now invoke gdb auto-magically.

这篇关于gdb错误-文件未采用可执行格式:无法识别文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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