简体   繁体   English

调试 ELF 文件

[英]Debugging an ELF file

I've got this EFL file which I need to debug/step-through.我有这个 EFL 文件,我需要调试/逐步完成。 It's a reverse engineering competition.这是一场逆向工程竞赛。 All I need to do is to find out the value of a register at a particular point in time and in a particular place.我需要做的就是找出特定时间点和特定地点的寄存器的值。 I used Hopper Disassembler to find out the address of interest.我使用 Hopper Disassembler 找出感兴趣的地址。

Here's the problem.这就是问题所在。 I don't know how to debug an ELF file.我不知道如何调试 ELF 文件。 It's my first time debugging in a Linux environment.这是我第一次在 Linux 环境中调试。 Learning how to execute the ELF file itself took me a while.学习如何执行 ELF 文件本身花了我一段时间。 I execute by using ld-linux.so.2 ./[EFLFILE] [arguments]我使用ld-linux.so.2 ./[EFLFILE] [arguments]

Is there a way I can atleast attach a debugger onto the proess?有没有办法至少将调试器附加到进程上? I can't even find it with the ps command.我什至无法使用 ps 命令找到它。 Also, I've heard that it's possible to have remote debugger;另外,我听说可以有远程调试器; to have a debugger running on a windows machine and have the binary to be examined running on a linux.在 Windows 机器上运行调试器,并在 linux 上运行要检查的二进制文件。

Could anyone help me achieve just any of this?任何人都可以帮助我实现这一目标吗?

Usually an ELF file can be executed as follows:通常一个ELF文件可以按如下方式执行:

$ /path/to/elffile [arguments]

To debug it using GDB you can do:要使用GDB调试它,您可以执行以下操作:

$ gdb /path/to/elffile

Or passing arguments:或者传递参数:

$ gdb --args /path/to/elffile arguments...

In your case:在你的情况下:

$ gdb --args ./[EFLFILE] [arguments]

Then type run or simly r and press < Enter >.然后键入runr并按 < Enter >。 Type help to get help on the gdb commands.键入help以获取有关 gdb 命令的帮助。

Note: if your program needs some external libs, before running it, you should define LD_LIBRARY_PATH pointing on the folder containing those libs ( export LD_LIBRARY_PATH=/the/path/to/libs )注意:如果您的程序需要一些外部库,在运行它之前,您应该定义指向包含这些库的文件夹的export LD_LIBRARY_PATH=/the/path/to/libs ( export LD_LIBRARY_PATH=/the/path/to/libs )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM