This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
win32/1428: gdb crashes on Windows when the debugged program calls a DLL function
- From: fabrizio dot ge at tiscali dot it
- To: gdb-gnats at sources dot redhat dot com
- Date: 25 Oct 2003 00:40:13 -0000
- Subject: win32/1428: gdb crashes on Windows when the debugged program calls a DLL function
- Reply-to: fabrizio dot ge at tiscali dot it
>Number: 1428
>Category: win32
>Synopsis: gdb crashes on Windows when the debugged program calls a DLL function
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 25 00:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: fabrizio.ge@tiscali.it
>Release: unknown-1.0
>Organization:
>Environment:
>Description:
I was debugging a Windows program, compiled with MinGW, which loaded a DLL with LoadLibrary, got some function pointers with GetProcAddress, and called those functions. At the first such call, gdb crashed.
Note that the debugged program works outside gdb.
I checked out gdb from CVS on October 24th and compiled it with Cygwin. Then I used gdb to debug gdb itself.
This is part of the backtrace at the time of crash:
#0 check_typedef (type=0x0) at gdbtypes.c:1373
#1 0x0049849c in create_array_type (result_type=0x134a020, element_type=0x0, range_type=0x1349fc0) at gdbypes.c:748
#2 0x004f67ac in decode_type (cs=0xddee60, c_type=1855, aux=0x612110) at coffread.c:1739
#3 0x004f67e4 in decode_type (cs=0xddee60, c_type=7391, aux=0x612110) at coffread.c:1708
#4 0x004f67e4 in decode_type (cs=0xddee60, c_type=29535, aux=0x612110) at coffread.c:1708
#5 0x004f607e in process_coff_symbol (cs=0xddee60, aux=0x612110, objfile=0x1343df0) at coffread.c:1509
etc.
My interpretation: decode_type calls itself recursively to get base_type. That call returns 0, so base_type is NULL. Then, create_array_type is called with a NULL second argument, and the crash happens when that pointer is dereferenced.
>How-To-Repeat:
I haven't tried other programs. What I did is:
-compile with MinGW a program which makes use of LoadLibrary and GetProcAddress, and at a point calls a function pointer gotten through GetProcAddress.
-debug that program with gdb. The crash happens when the debugged program calls that pointer to function.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: