This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with Mingw32's gdb

I am having a strange problem. Whenever I use 'gdb' (the standalone Mingw32
package version), 'gdb' itself generates a SEGMENTATION fault and dies
whenever it receives SIGINT (Control-C). I thought that this was working fine
before, but I must have been mistaken. I'm seeing this problem whether I run
the program in a DOS shell or a Cygwin BASH shell.

Here's a simple sample program:

#include <stdio.h>

int main(int argc, char *argv[])
    while (1)

Compile the program as a Mingw32 executable. This means that you should either
use 'gcc' that comes with the standalone Mingw32 package, or that you should
use the -mno-cygwin switch of the 'gcc' that comes with Cygwin. If you use the
standalone Mingw32 package, you can compile in a DOS shell or a Cygwin BASH
shell. (I've compiled in both to find the same problem). Thus, compile like

standalone Mingw32: gcc -g -o simple simple.c
Cygwin		: gcc -mno-cygwin -g -o simple simple.c

Now, run the standalone version of Mingw32's 'gdb'. Do not use Cygwin's 'gdb'
because the problem doesn't exist there. Here's my sample output...

$ /usr/gcc-2_95-mingw32/bin/gdb
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-mingw32".
(gdb) l
1       #include <stdio.h>
3       int main(int argc, char *argv[])
4       {
5           printf("Started\n");
6           while (1)
7               ;
8       }
(gdb) run
Starting program: e:\tmp\xx/simple.exe
77630000:C:/WINNT/system32/crtdll.dll"C:/WINNT/system32/crtdll.dll": error
ng line numbers

77f00000:C:/WINNT/system32/KERNEL32.dll"C:/WINNT/system32/KERNEL32.dll": error
eading line numbers



Now I hit CTRL-C, and I see the following:

[Switching to thread 168.0xb3]

Program received signal SIGINT, Interrupt.
0x77f2b5c9 in ?? ()


And then Windows generates a Message Box with the following title and message:

Title: gdb.exe - Application Error

Message: The instruction at "0x004b0341" referenced memory at "0x00000004".
The memory could not be "read".


And then the application (gdb) dies.

Cygwin's version of 'gdb' doesn't have this problem. And most people might
tell me to go ahead and use Cygwin's version of 'gdb'. The problem with that
is that Cygwin's version of 'gdb' doesn't support threads, and the standalone
Mingw32's version does (and usually works).

What I really need is ONE debugger that both supports signal handling AND

Has anyone else seen this problem? Can anyone else re-produce this problem?

System Information
Windows NT Server 4.0
Mingw32 gcc 2.95

Jon Leichter

Want to unsubscribe from this list?
Send a message to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]