如何调试MIPS精灵? [英] How to Debug MIPS elf?

查看:191
本文介绍了如何调试MIPS精灵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个MIPS elf二进制文件(表示有人在MIPS上交叉编译/编译了MIPS linux可执行文件)

Suppose I have a MIPS elf binary (meaning someone cross compiled/compiled on MIPS a MIPS linux executable)

是否有任何Linux发行版经过编译可以在可能运行可执行文件的mips架构上运行?我环顾四周,但我只能找到 linux-mips .如果发行版已经安装到VM磁盘文件中,而您可以直接下载它,那就更好了.

Are there any linux distros that are compiled to run on mips architecture that could perhaps run the executable? I've looked around, but all I can find is linux-mips. Even better would be if the distro was already installed to a VM disk file, and you could just download it.

有没有保证的方法可以在非MIPS发行版上运行MIPS精灵?喜欢使用一些qemu设置或其他东西? (通过保证",我的意思是,如果它在MIP发行版中运行,那么它无疑应该在模拟器中运行,并且所有功能都在模拟器中绝对实现,因此无论发生什么(显然是特定于用户区的信息)也会在模拟器中出现,因此我可以确信它会正常运行.

Is there any guaranteed way to run the MIPS elf on a non MIPS distro? Like using some qemu setup or something? (By "guaranteed" I mean if it runs in a MIPs distro then it should run in the emulator without a doubt, and that ALL functionality is absolutely implemented in the emulator, so that whatever would occur (userland specific obviously) in the MIPS distro will also occur in the emulator, so that I can have some confidence that it will work properly).

最后,如果我想调试MIPS,但是我不太了解它,那么除了VM之外,是否有任何一种学习工具真的可以很好地理解MIPS在做什么?这就是我使用工具时的想法,您可以将其附加到MIPS编译的elf或x86上,当您遍历可执行文件中的指令时,可以看到从可执行文件格式进行的转换可以控制调试器转换为您选择的格式.一个不太好的替代方法仍然可行,那就是您可以将任何MIPS指令粘贴到文本框中,然后看到另一个具有等效x86指令的文本框,反之亦然.

Lastly, if I wanted to debug MIPS, but I don't understand it all that well, is there any kind of learning tool that would be really good for understanding what MIPS is doing besides a VM? Here's what I have in mind-using a tool, you could attach to either a MIPS compiled elf or a x86, and as you walk through the instructions in the executable, you can see a conversion from the format of the executable in control of the debugger to the format of your choice. A not so good alternative that would still work would be where you could past any MIPS instruction into a text box, and see another text box with the equivalent x86 instruction, or vice versa.

推荐答案

如果您拥有可以运行Linux的带有MIPS CPU的硬件,最简单的方法是使用一种Linux发行版的MIPS体系结构.常见的一种是Debian发行版,您可以在此链接.

If you are in possession of a hardware with MIPS CPU that can run Linux, the easiest way would be to use one of the Linux distributions for MIPS architecture. A common one is Debian distribution, and you can find more about Debian for MIPS at this link.

如果您无权访问MIPS硬件,则在x86主机上运行QEMU应该足够了.看看 MIPS-QEMU说明.

If you do not have access to MIPS hardware, running QEMU on your x86 host should be sufficient. Take a look at MIPS-QEMU instructions.

最后,在安装好MIPS Linux之后,将MIPS二进制文件复制到它,登录并使用它运行gdb.这应该为您提供调试它的坚实环境.说到了解MIPS汇编,该体系结构简洁明了,并且比其他arch的汇编代码更容易阅读MIPS汇编.

Last, once you have MIPS Linux in place, copy your MIPS binary to it, log in, and run gdb with it. This should give you a solid environment to debug it. Speaking of understanding MIPS assembly, the architecture is clean and simple, and it is much easier to read MIPS assembly than other arch's assembly code.

这篇关于如何调试MIPS精灵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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