Debugging with GDB and ASLR

Luis Machado luis.machado@arm.com
Thu Apr 25 10:13:29 GMT 2024


On 4/25/24 11:01, Eli Zaretskii via Gdb wrote:
> Hi,
> 
> It is well known that ASLR can get in the way of debugging some
> problems because the addresses of data change between runs, and so
> what you have learned from one debugging session cannot always be
> safely used in another session, when ASLR is in effect.
> 
> I'm told that GDB disables ASLR, at least on GNU/Linux, for that
> reason.  If that is true, could someone please point me to the code
> which achieves that?  Also, is this done on other systems as well, and
> specifically on MS-Windows when debugging native Windows programs?
> 
> TIA

On Linux, it does so through the personality function in gdb/nat/linux-personality.c.

I heard there were issues with disabling ASLR for Windows, but we seem to try to do
it in gdb/nat/windows-nat.c:create_process_wrapper. Maybe the call to UpdateProcThreadAttribute
attempts to do it?


More information about the Gdb mailing list