This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [RFA] win32-nat.c: Add dll names if debugevents is on
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;