GDB: 文件未找到/所需文件未找到

huangapple go评论59阅读模式
英文:

GDB: File not found/required file not found

问题

我知道这个话题已经被问过,但我已经按照每个人的步骤进行了尝试,但似乎都不起作用。

我目前正在尝试理解一个可执行文件的功能,但我没有源代码。这意味着我无法控制它的编译等。它是一个ELF 64位LSB pie可执行文件,ARM aarch64文件。

为了做到这一点,我回想起了我的计算机体系结构课程,在那里我们学习了如何使用gdb来逐步执行程序。我目前正在尝试使用这个工具,但当我尝试在gdb调试器中运行时,我遇到了一个奇怪的错误,大致如下:

/bin/bash: line 1: /home/ec2-user/filename: 无法执行:找不到所需的文件

我说“大致如下”,因为我在Ubuntu22实例和Amazon Linux实例中都尝试过这个操作。两者都返回相同类型的错误。我进行了一些基本的测试:

gdb thisfiledoesnotexist

gdb明确告诉我,一旦进入调试器,文件就不存在,而对于filename,只有当我尝试运行时才会声明它不存在。我可以设置断点,以及在没有帧或运行程序的情况下可以做的有限的事情。

需要注意的一些事项:

  1. 文件位于~/目录下。
  2. 我在~/目录中运行了gdb。
  3. 我在调试器中运行了dir /home/ec2-user
  4. 我进行了“正常”的安装,只使用sudo yum/apt install命令。

我对一个bash本机的date文件进行了测试,它确实可以工作,所以不是gdb的问题。

这让我相信以下几种可能性之一:

  1. 这个可执行文件与gdb不兼容,但与lldb也不兼容。
  2. 我没有正确配置gdb。
  3. 我在bin/bash中缺少允许此可执行文件运行的某些内容。

任何帮助将不胜感激!

英文:

I'm aware this topic has been asked, but I have followed the steps of each, and none seem to work.

I am currently attempting to understand the functionality of an executable in which I was not given source code for. This means I had no control over the compilation of it, etc. It is a ELF 64-bit LSB pie executable, ARM aarch64 file.

To do so, I thought back to my computer architecture course, where we learned how to step through a program using gdb. I am currently attempting to use this, but I am running into a strange error, something along the lines of this when I attempt to run within the gdb debugger:

/bin/bash: line 1: /home/ec2-user/filename: cannot execute: required file not found

I say "something along the lines of" because I have tried this in both an Ubuntu22 instance as well as an Amazon Linux instance. Both return their same flavors of the error above. I sanity tested with

gdb thisfiledoesnotexist

And gdb explicitly told me that the file did not exist immediately upon entering the debugger, whereas with filename, it only stated it when I attempted to run. I could set breakpoints and do what limited things you can do without a frame or a running program.

A few things to note:

  1. I have the file at ~/
  2. I ran gdb in the ~/ directory
  3. I ran dir /home/ec2-user within the debugger
  4. I did a "normal" install, so just sudo yum/apt install

I tested on a bash-native date file, which did indeed work, so it's not that gdb is the issue.

This leads me to believe one of a few things:

  1. This executable doesn't play well with gdb, but it also didn't work with lldb
  2. I'm failing to configure gdb correctly.
  3. I am missing something in bin/bash to allow this executable to run

Any help would really be appreciated!

答案1

得分: 3

"ELF 64位LSB可执行文件,ARM aarch64,版本1(SYSV),动态链接,解释器/system/bin/linker64,"

问题(很可能)是你的系统上不存在/system/bin/linker64

这可能是一个Android二进制文件(使用Bionic libc),而你正在尝试在“常规”Linux上运行它。

搜索“在Linux上运行Android应用程序”提供了许多可能的答案,尽管我不确定哪一个在这里最合适。

英文:

> ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64,

The problem (most likely) is that /system/bin/linker64 does not exist on your system.

This is possibly an Android binary (using Bionic libc), and you are trying to run it on a "regular" Linux.

Searching for "run android app on linux" provides many possible answers, though I am not sure which one is most appropriate here.

huangapple
  • 本文由 发表于 2023年5月29日 11:52:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76354580.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定