强制 gdb 在随机地址加载共享库
Force gdb to load shared library at randomized address
我正在调试共享库。我发现当我在 Linux 主机中启用 ASLR 时会触发该错误,而当禁用 ASLR 时该错误会消失。
我想用gdb 进一步调试共享库。但是我发现它总是在固定地址加载共享库,这使得错误消失了。
有什么方法可以禁用这个 gdb 的功能吗?
Is there any way to disable this gdb's feature?
是的,您可以在 运行 程序之前 set disable-randomization off
。
见这部分 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.
我正在调试共享库。我发现当我在 Linux 主机中启用 ASLR 时会触发该错误,而当禁用 ASLR 时该错误会消失。
我想用gdb 进一步调试共享库。但是我发现它总是在固定地址加载共享库,这使得错误消失了。
有什么方法可以禁用这个 gdb 的功能吗?
Is there any way to disable this gdb's feature?
是的,您可以在 运行 程序之前 set disable-randomization off
。
见这部分 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.