调试装配
如何调试汇编代码?我在 Linux 上并且有 gdb 方便。我知道我可以查看寄存器。调试汇编代码的方法有哪些?
How do I debug assembly code? I'm on Linux and have gdb handy. I know I can watch registers. What are some methods for debugging assembly code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您当然可以像使用 C 或任何其他编译语言一样使用 断点,也。 这篇文章稍微介绍了调试汇编程序的过程。
You can of course use breakpoints just as with C or any other compiled language, too. This article describes the process of debugging an assembly program a bit.
使用 "disassemble" gdb 命令可以看到汇编代码即将被执行。这与监视寄存器相结合,可以让您深入了解 CPU 的实际用途。
Using the "disassemble" gdb command you can see the assembly code that is about to be executed. This, in conjunction with watching registers, can give you insight into what the CPU is really doing.
当然,您可以使用带有可执行 elf 文件参数的 nm 命令,它会显示可用的标签和地址。由此,您可以在特定地址上设置断点,然后使用“si”调试命令执行单个指令。
Of course you can use nm command with a parameter of executable elf file, it will shows you the available labels with address. From this you can set a breakpoint on a specific address, then execute a single instruction by using "si" debug command.