Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] win32-nat.c: Add dll names if debugevents is on
Date: Fri, 13 Jun 2008 15:28:00 -0000	[thread overview]
Message-ID: <000001c8cd57$c9cf3d30$5d6db790$@u-strasbg.fr> (raw)

 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
<http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
(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 <number>
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
<http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
(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 <number>
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  <muller@ics.u-strasbg.fr>

	* 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;



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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-13 15:28 Pierre Muller [this message]
2008-06-13 15:35 ` Pedro Alves
2008-06-13 23:07   ` Pierre Muller
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='000001c8cd57$c9cf3d30$5d6db790$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.org \
    /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