Search code examples
linuxassemblygdb

GDB: File not found/required file not found


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!


Solution

  • 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.