当没有符号信息时,如何使用GDB for x86程序集设置断点? [英] How to set breakpoint using GDB for x86 assembly when no symbol information is present?

查看:329
本文介绍了当没有符号信息时,如何使用GDB for x86程序集设置断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有符号信息,那么如何设置使用GDB for x86汇编代码的断点,即不可能写入 b * _start

How do I set a breakpoint using GDB for x86 assembly code, when there is no symbol information, i.e. it is not possible to write b *_start.

我想立即停止执行,但写 b * 0 并不是很有用,因为这样会停止执行在地址 0 ,但是我需要在地址 x 相对于起始点(当没有符号信息存在)

I'd like to stop execution immediately, but writing b *0 isn't very useful, because this would stop execution at address 0, but I need to break execution at address x relative to the starting point (which is unknown when no symbol information is present).

推荐答案

使用类似 objdump -f 显示入口点地址的数值。

Use something like objdump -f to show you the numeric value of the entry point address.

将该值复制/粘贴到gdb命令中: b * 0x ... 在入口点断开。您可以从那里单步。

Copy/paste that value into a gdb command: b *0x... to break at the entry point. You can then single-step from there.

另请参阅 x86 标签wiki一些asm调试提示,如 layout reg

See also the bottom of the x86 tag wiki for some asm-debugging tips, like layout reg.

objdump -f

/bin/ls:     file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000404870          <<---- copy this address

这篇关于当没有符号信息时,如何使用GDB for x86程序集设置断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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