public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: cygwin-patches@cygwin.com
Subject: Re: [PATCH 3/3] Cygwin: Add loaded module base address list to stackdump
Date: Sat, 29 Oct 2022 10:32:52 +0200	[thread overview]
Message-ID: <Y1zlNBjeblW9dvfW@calimero.vinschen.de> (raw)
In-Reply-To: <20221028150558.2300-4-jon.turney@dronecode.org.uk>

On Oct 28 16:05, Jon Turney wrote:
> This adds an extra section to the stackdump, which lists the loaded
> modules and their base address.  This is perhaps useful as it makes it
> immediately clear if RandomCrashInjectedDll.dll is loaded...
> 
> XXX: It seems like the 'InMemoryOrder' part of 'InMemoryOrderModuleList' is a lie?

Probably just an alternative fact...

> 
> > Loaded modules
> > 000100400000 segv-test.exe
> > 7FFF2AC30000 ntdll.dll
> > 7FFF29050000 KERNEL32.DLL
> > 7FFF28800000 KERNELBASE.dll
> > 000180040000 cygwin1.dll
> > 7FFF28FA0000 advapi32.dll
> > 7FFF29F20000 msvcrt.dll
> > 7FFF299E0000 sechost.dll
> > 7FFF29B30000 RPCRT4.dll
> > 7FFF27C10000 CRYPTBASE.DLL
> > 7FFF28770000 bcryptPrimitives.dll
> ---
>  winsup/cygwin/exceptions.cc | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
> index 1e9ea26bf..7dde44140 100644
> --- a/winsup/cygwin/exceptions.cc
> +++ b/winsup/cygwin/exceptions.cc
> @@ -383,6 +383,16 @@ cygwin_exception::dumpstack ()
>        small_printf ("End of stack trace%s\r\n",
>  		    i == DUMPSTACK_FRAME_LIMIT ?
>  		    " (more stack frames may be present)" : "");
> +
> +      small_printf ("Loaded modules\r\n");
> +      PLIST_ENTRY head = &NtCurrentTeb()->Peb->Ldr->InMemoryOrderModuleList;
> +      for (PLIST_ENTRY x = head->Flink; x != head; x = x->Flink)
> +	{
> +	  PLDR_DATA_TABLE_ENTRY mod = CONTAINING_RECORD (x, LDR_DATA_TABLE_ENTRY,
> +							 InMemoryOrderLinks);
> +	  small_printf ("%012X %S\r\n", mod->DllBase, &mod->BaseDllName);
> +	}
> +
>        if (h)
>  	NtClose (h);
>      }
> -- 
> 2.38.1

  reply	other threads:[~2022-10-29  8:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 15:05 [PATCH 0/3] Stackdump improvements Jon Turney
2022-10-28 15:05 ` [PATCH 1/3] Cygwin: Tidy up formatting of stackdump Jon Turney
2022-10-28 15:05 ` [PATCH 2/3] Cygwin: Add addresses as module offsets in .stackdump file Jon Turney
2022-10-28 15:05 ` [PATCH 3/3] Cygwin: Add loaded module base address list to stackdump Jon Turney
2022-10-29  8:32   ` Corinna Vinschen [this message]
2022-11-03 17:02     ` Jon Turney
2022-11-04 10:34       ` Corinna Vinschen
2022-10-29  8:34 ` [PATCH 0/3] Stackdump improvements Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1zlNBjeblW9dvfW@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).