强制gdb以随机地址加载共享库 [英] Force gdb to load shared library at randomized address

查看:299
本文介绍了强制gdb以随机地址加载共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试共享库。我发现在Linux主机中启用ASLR时会触发该错误,而当禁用ASLR时该错误消失。



我想用gdb进一步调试共享库。但我发现它总是将共享库加载到一个固定的地址,这使得这个bug消失。



有没有办法禁用这个gdb的功能?

$

解决方案


有没有什么办法可以禁用这个gdb的功能?

是的,您可以在运行程序之前将设置为disable-randomization off
请参阅 gdb文档的这一部分:


将disable-randomization设置为关闭

保持启动的可执行文件的行为不变。只有当程序被加载到特定的
地址时,一些错误才会使他们难以理解。如果您在GDB下运行该程序时漏洞消失,则
可能是因为默认情况下,GDB会禁用平台上的地址
随机化,例如GNU / Linux,这可以为
做到这一点,单独的节目。使用设置禁用随机化关闭尝试
重现这种难以捉摸的错误。



I'm debugging a shared library. I found that the bug can be trigger when I enable ASLR in Linux host, while the bug disappears when ASLR is disabled.

I want to further debug the shared library with gdb. But I found it always loaded the shared library at a fixed address, which made the bug disappear.

Is there any way to disable this gdb's feature?

解决方案

Is there any way to disable this gdb's feature?

Yes, you can set disable-randomization off before running the program. See this part of gdb documentation:

set disable-randomization off

Leave the behavior of the started executable unchanged. Some bugs rear their ugly heads only when the program is loaded at certain addresses. If your bug disappears when you run the program under GDB, that might be because GDB by default disables the address randomization on platforms, such as GNU/Linux, which do that for stand-alone programs. Use set disable-randomization off to try to reproduce such elusive bugs.

这篇关于强制gdb以随机地址加载共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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