From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23640 invoked by alias); 13 Jun 2008 13:17:43 -0000 Received: (qmail 23629 invoked by uid 22791); 13 Jun 2008 13:17:41 -0000 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 13 Jun 2008 13:17:14 +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 m5DDHA7H007523 for ; Fri, 13 Jun 2008 15:17:10 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402::141]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id m5DDH9lC072366 for ; Fri, 13 Jun 2008 15:17:09 +0200 (CEST) Received: from d620muller (laocoon.u-strasbg.fr [130.79.112.72]) by mailserver.u-strasbg.fr (8.13.8/jtpda-5.5pre1) with ESMTP id m5DDH6KP089833 for ; Fri, 13 Jun 2008 15:17:09 +0200 (CEST) From: "Pierre Muller" To: Subject: [RFA] win32-nat.c: Add dll names if debugevents is on Date: Fri, 13 Jun 2008 15:28:00 -0000 Message-ID: <000001c8cd57$c9cf3d30$5d6db790$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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::156]); Fri, 13 Jun 2008 15:17:10 +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/msg00239.txt.bz2 This is a very simple patch that add a line giving the name of the newly loaded or unloaded dll, when 'set debugevents on' is used. It does not change the default behavior of cygwin/mingw32 gdb as debugevents is off by default. I always found it frustrating to get the events LOAD_DLL_DEBUG_EVENT and UNLOAD_DLL_DEBUG_EVENT without getting the name of the dll. This is the new behavior: $ gdb-dllnames.exe ./run.exe GNU gdb (GDB) 6.8.50.20080611-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin". For bug reporting instructions, please see: ... (gdb) set debugevents on (gdb) r Starting program: /usr/local/src/gdbcvs/build-bare/gdb/testsuite/gdb.base/run.ex e gdb: win32_init_thread_list gdb: kernel event for pid=4068 tid=2992 code=CREATE_PROCESS_DEBUG_EVENT) [New thread 4068.0xbb0] ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "ntdll.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\kernel32.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "E:\cygwin\home\Pierre\bin\cygwin1.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\ADVAPI32.DLL". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\RPCRT4.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\Secur32.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=EXCEPTION_DEBUG_EVENT) ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=6f8 code=CREATE_THREAD_DEBUG_EVENT) [New thread 4068.0x6f8] ContinueDebugEvent (cpid=4068, ctid=1784, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=OUTPUT_DEBUG_STRING_EVENT) ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=OUTPUT_DEBUG_STRING_EVENT) ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\user32.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\GDI32.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\IMM32.DLL". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); usage: factorial gdb: kernel event for pid=4068 tid=1784 code=EXIT_THREAD_DEBUG_EVENT) ContinueDebugEvent (cpid=4068, ctid=1784, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=LOAD_DLL_DEBUG_EVENT) Loading dll "D:\WINDOWS\system32\psapi.dll". ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: kernel event for pid=4068 tid=2992 code=EXIT_PROCESS_DEBUG_EVENT) Program exited with code 01. ContinueDebugEvent (cpid=4068, ctid=2992, DBG_CONTINUE); gdb: win32_close, inferior_ptid=2992 (gdb) q Compared to the current behavior: Pierre@d620-muller ~/gdbcvs/build-bare/gdb/testsuite/gdb.base $ ../../gdb ./run.exe GNU gdb (GDB) 6.8.50.20080611-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin". For bug reporting instructions, please see: ... (gdb) set debugevents on (gdb) r Starting program: /usr/local/src/gdbcvs/build-bare/gdb/testsuite/gdb.base/run.ex e gdb: win32_init_thread_list gdb: kernel event for pid=260 tid=2540 code=CREATE_PROCESS_DEBUG_EVENT) [New thread 260.0x9ec] ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=EXCEPTION_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=ec8 code=CREATE_THREAD_DEBUG_EVENT) [New thread 260.0xec8] ContinueDebugEvent (cpid=260, ctid=3784, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=OUTPUT_DEBUG_STRING_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=OUTPUT_DEBUG_STRING_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); usage: factorial gdb: kernel event for pid=260 tid=3784 code=EXIT_THREAD_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=3784, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=LOAD_DLL_DEBUG_EVENT) ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: kernel event for pid=260 tid=2540 code=EXIT_PROCESS_DEBUG_EVENT) Program exited with code 01. ContinueDebugEvent (cpid=260, ctid=2540, DBG_CONTINUE); gdb: win32_close, inferior_ptid=2540 (gdb) q Is this OK to commit? Pierre Muller Pascal language support maintainer for GDB ChangeLog entry: 2008-12-13 Pierre Muller * win32-nat.c (handle_load_dll): Give dll name if debug_events is on. (handle_unload_dll): Likewise. $ cvs diff -up gdb/win32-nat.c 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 11:27:18 -0000 @@ -744,6 +744,7 @@ handle_load_dll (void *dummy) if (!dll_name) return 1; + DEBUG_EVENTS (("gdb: Loading dll \"%s\".\n",dll_name)); solib_end->next = win32_make_so (dll_name, (DWORD) event->lpBaseOfDll); solib_end = solib_end->next; @@ -771,6 +772,9 @@ handle_unload_dll (void *dummy) so->next = sodel->next; if (!so->next) solib_end = so; + if (sodel->so_original_name) + DEBUG_EVENTS (("gdb: removing dll \"%s\".\n", + sodel->so_original_name)); win32_free_so (sodel); solib_add (NULL, 0, NULL, auto_solib_add); return 1;