Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Pedro Alves'" <pedro_alves@portugalmail.pt>,
	        <gdb-patches@sourceware.org>
Subject: RE: [RFA] win32-nat.c: Add dll names if debugevents is on
Date: Fri, 13 Jun 2008 23:07:00 -0000	[thread overview]
Message-ID: <000001c8cda0$ec693b40$c53bb1c0$@u-strasbg.fr> (raw)
In-Reply-To: <200806131532.22427.pedro_alves@portugalmail.pt>

Thanks for the comments

>-----Message d'origine-----
>De : Pedro Alves [mailto:pedro_alves@portugalmail.pt] 
>Envoyé : Friday, June 13, 2008 4:32 PM
>À : gdb-patches@sourceware.org
>Cc : Pierre Muller
>Objet : Re: [RFA] win32-nat.c: Add dll names if debugevents is on
>
>Thanks, I've wanted this before too.
>
>A Friday 13 June 2008 14:17:11, Pierre Muller wrote:
>
>>
>> +  DEBUG_EVENTS (("gdb: Loading dll \"%s\".\n",dll_name));
>>    solib_end->next = win32_make_so (dll_name, (DWORD)
event->lpBaseOfDll);
>
>While you're at it, would it be useful to also include the dll
>load base in the output?

  It’s a good idea, that I implemented easily, see below.
I choose to use the solib struct to be closer to 'info dll' output.
The only caveat is that it doesn't match the values given by 'info dll'
later
because of the 0x1000 offset added to the start of each Dll,
should I add  this 0x1000?

>> +       if (sodel->so_original_name)
>> +         DEBUG_EVENTS (("gdb: removing dll \"%s\".\n",
>
>Small nit, wouldn't "gdb: Unloading dll" be clearer (and mirror
>the other message) ?  And perhaps output "<unknown name>", if
>there's no so_original_name to print?  Can that happen?  I
>can't remember off-hand.

  It seems like so_original_name is never empty,
because if the dll name is not found, the dll is not recorded at all.
  And I finally realized that my code was wrong because
so_original_name and so_name are char array, not pointers...
I nevertheless check both so_name and so_original_name
in that order, without knowing if one can be set and 
not the other...


Here is an updated patch:


ChangeLog entry:

2008-12-13  Pierre Muller  <muller@ics.u-strasbg.fr>

	* win32-nat.c (handle_load_dll): Give dll name and load address
	if debug_events is on.
	(handle_unload_dll): Likewise.


$ cat dllnames.patch
Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.152
diff -u -p -r1.152 win32-nat.c
--- gdb/win32-nat.c     20 May 2008 18:36:36 -0000      1.152
+++ gdb/win32-nat.c     13 Jun 2008 21:51:19 -0000
@@ -747,6 +747,9 @@ handle_load_dll (void *dummy)
   solib_end->next = win32_make_so (dll_name, (DWORD) event->lpBaseOfDll);
   solib_end = solib_end->next;

+  DEBUG_EVENTS (("gdb: Loading dll \"%s\" at 0x%lx.\n", solib_end->so_name,
+                (DWORD) solib_end->lm_info->load_addr));
+
   return 1;
 }

@@ -771,6 +774,18 @@ handle_unload_dll (void *dummy)
        so->next = sodel->next;
        if (!so->next)
          solib_end = so;
+       if (sodel->so_name != "\0")
+         {
+           DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n",
+                          (char *) &(sodel->so_name)));
+         }
+       else if (sodel->so_original_name != "\0")
+         {
+           DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n",
+                          (char *) &(sodel->so_original_name)));
+         }
+       else
+         DEBUG_EVENTS (("gdb: Unloading <unknown name> dll.\n"));
        win32_free_so (sodel);
        solib_add (NULL, 0, NULL, auto_solib_add);
        return 1;



  reply	other threads:[~2008-06-13 22:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-13 15:28 Pierre Muller
2008-06-13 15:35 ` Pedro Alves
2008-06-13 23:07   ` Pierre Muller [this message]
2008-06-14  0:16     ` Pedro Alves
2008-06-14  3:20       ` [RFA-v3] " Pierre Muller
2008-06-16  1:26         ` Christopher Faylor
2008-06-16  6:38           ` Pedro Alves
2008-06-17  9:51             ` Christopher Faylor
2008-06-17 18:21               ` Christopher Faylor
2008-06-18  1:43               ` Pierre Muller
2008-06-18  7:33                 ` Christopher Faylor
2008-06-18 13:40                   ` Pierre Muller
2008-06-16 11:43           ` Pierre Muller

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='000001c8cda0$ec693b40$c53bb1c0$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro_alves@portugalmail.pt \
    /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