我如何调试exec* = -1 enoent



我正在从汇编中构建此二进制文件,并试图将其(可能很糟糕(与libc链接。但是我的程序不会启动,execve可能无法找到一些东西。我该如何调试?

$ file ctime
ctime: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, not stripped
$ strace -f ./ctime
execve("./ctime", ["./ctime"], [/* 19 vars */]) = -1 ENOENT (No such file or directory)
fstat64(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
getpid()                                = 13784
exit_group(1)                           = ?
+++ exited with 1 +++
$ gdb ./ctime
GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
Reading symbols from ./ctime...done.
(gdb) r
Starting program: ./ctime
/bin/bash: ./ctime: No such file or directory
During startup program exited with code 127.

我该如何调试?

有关男人执行中的错误错误,请参见错误部分:

ENOENT The file filename or a script or ELF interpreter does not
      exist, or a shared library needed for the file or interpreter
      cannot be found.

此错误的最可能原因之一是:" ELF解释器不存在"。使用此命令在二进制中查看当前通往精灵解释器的路径:

readelf -l ctime | grep "Requesting program interpreter"

启动时您的程序可能无法找到。

最新更新