From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3739 invoked by alias); 13 Jun 2008 22:01:24 -0000 Received: (qmail 3728 invoked by uid 22791); 13 Jun 2008 22:01:23 -0000 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 13 Jun 2008 22:00:58 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id m5DM0eGJ077325 ; Sat, 14 Jun 2008 00:00:40 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402::142]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id m5DM0ewM008761 ; Sat, 14 Jun 2008 00:00:40 +0200 (CEST) Received: from d620muller ([130.79.244.152]) by mailserver.u-strasbg.fr (8.13.8/jtpda-5.5pre1) with ESMTP id m5DM0Z2x028493 ; Sat, 14 Jun 2008 00:00:39 +0200 (CEST) From: "Pierre Muller" To: "'Pedro Alves'" , References: <000001c8cd57$c9cf3d30$5d6db790$@u-strasbg.fr> <200806131532.22427.pedro_alves@portugalmail.pt> In-Reply-To: <200806131532.22427.pedro_alves@portugalmail.pt> Subject: RE: [RFA] win32-nat.c: Add dll names if debugevents is on Date: Fri, 13 Jun 2008 23:07:00 -0000 Message-ID: <000001c8cda0$ec693b40$c53bb1c0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (mailhost.u-strasbg.fr [IPv6:2001:660:2402::153]); Sat, 14 Jun 2008 00:00:40 +0200 (CEST) X-Virus-Status: Clean Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00251.txt.bz2 Thanks for the comments >-----Message d'origine----- >De=A0: Pedro Alves [mailto:pedro_alves@portugalmail.pt]=20 >Envoy=E9=A0: Friday, June 13, 2008 4:32 PM >=C0=A0: gdb-patches@sourceware.org >Cc=A0: Pierre Muller >Objet=A0: 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 =3D 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=92s 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 "", 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=20 not the other... Here is an updated patch: ChangeLog entry: 2008-12-13 Pierre Muller * 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D win32_make_so (dll_name, (DWORD) event->lpBaseOfDll); solib_end =3D 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 =3D sodel->next; if (!so->next) solib_end =3D so; + if (sodel->so_name !=3D "\0") + { + DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", + (char *) &(sodel->so_name))); + } + else if (sodel->so_original_name !=3D "\0") + { + DEBUG_EVENTS (("gdb: Unloading dll \"%s\".\n", + (char *) &(sodel->so_original_name))); + } + else + DEBUG_EVENTS (("gdb: Unloading dll.\n")); win32_free_so (sodel); solib_add (NULL, 0, NULL, auto_solib_add); return 1;