如何配置gdb来调试脚本不是二进制文件[gdb:file format not recognized] [英] how to configure gdb to debug a script not a binary [gdb : file format not recognized]

查看:3147
本文介绍了如何配置gdb来调试脚本不是二进制文件[gdb:file format not recognized]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用gdb调试火炬图书馆二进制文件。当我从命令行运行:
gdb --args th

I'm trying to use gdb to debug Torch library binary file to . When I run from the command line : gdb --args th

我收到以下错误:

"/xxx/xxxx/torch/install/bin/th": not in executable format: File format not recognized

我检查了我当前安装的 gdb 是64位我安装了gdb64,当我运行

I checked if my current installation of gdb is 64 bit i installed gdb64 and when i run

gdb64 --args th


$ b $我仍然得到相同的错误,输出如下:

I still get the same error, the output of :

file /xxx/xxxx/torch/install/bin/th

是:

/xxx/xxxx/torch/install/bin/th: POSIX shell script, ASCII text executable, with very long lines 

我已经知道,问题是可执行文件不是二进制文件,而是脚本,所以gdb正在尝试调试脚本。

I have learned that the problem is that the executable file is not a binary, but a script, so gdb is trying to debug the script instead.

我的问题是如何克服这个问题,让gdb调试命令本身的执行。或者甚至将Torch安装替换为二进制执行而不是脚本。

My question is how to overcome this and let gdb debug the execution of the command itself. or even replace the Torch installation to be a binary execution instead of a script.

推荐答案

从我能够发表的评论的一些帮助通过以下方式运行gdb:通过以下方式运行gdb:

with some help from the comments i was able to run gdb over the torch script, through :

gdb64 /bin/bash    # check your gdb configuration either it's i686 or x86_64 
run /path/to/th    # th is the torch running script to be debugged

这篇关于如何配置gdb来调试脚本不是二进制文件[gdb:file format not recognized]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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