public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Debugging with GDB and ASLR
@ 2024-04-25 10:01 Eli Zaretskii
  2024-04-25 10:13 ` Luis Machado
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-04-25 10:01 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debugging with GDB and ASLR
  2024-04-25 10:01 Debugging with GDB and ASLR Eli Zaretskii
@ 2024-04-25 10:13 ` Luis Machado
  2024-04-25 15:17   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2024-04-25 10:13 UTC (permalink / raw)
  To: Eli Zaretskii, gdb, Tom Tromey; +Cc: nd

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debugging with GDB and ASLR
  2024-04-25 10:13 ` Luis Machado
@ 2024-04-25 15:17   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-04-25 15:17 UTC (permalink / raw)
  To: Luis Machado; +Cc: gdb, tom, nd

> Date: Thu, 25 Apr 2024 11:13:29 +0100
> Cc: nd <nd@arm.com>
> From: Luis Machado <luis.machado@arm.com>
> 
> 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?

Right, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-25 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 10:01 Debugging with GDB and ASLR Eli Zaretskii
2024-04-25 10:13 ` Luis Machado
2024-04-25 15:17   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).