This is the mail archive of the cygwin@sourceware.cygnus.com 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]

B20.1: Thread support seems to be broken in 'gdb'


I could not find mention of this problem in the Cygwin FAQs or the mailing
list.

I can't use 'gdb' with threaded applications at all. Here's a sample program:

--------------------------------------------------------------
#include <stdio.h>
#include <windows.h>
#include <process.h>

void printmsg1(void *arg)
{
    fprintf(stdout, "Msg 1\n");
}

void printmsg2(void *arg)
{
    fprintf(stdout, "Msg 2\n");
}

int main(int argc, char *argv[])
{
    unsigned long thread1, thread2;

    thread1 = _beginthread(printmsg1, 0, NULL);
    thread2 = _beginthread(printmsg2, 0, NULL);

    WaitForSingleObject((HANDLE) thread1, INFINITE);
    WaitForSingleObject((HANDLE) thread2, INFINITE);
}
---------------------------------------------------------------------

I compiled using the Mingw32 support of Cygwin's gcc compiler (updated to
2.95). I have altered my gcc 'specs' file, but the basic compiler invocation
would look like this:

$ gcc -mno-cygwin -nostdinc -g -o xx xx.c -I/usr/mingw32/include \
	-L/usr/mingw32/lib

In the /usr/mingw32 hierarchy, I have installed Anders Norlander's updated
Win32 API headers and libraries.

Here is the 'gdb' session output:

$ gdb xx
GNU gdb 4.17.1
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 "i586-cygwin32"...
(gdb) tb printmsg1
Breakpoint 1 at 0x4010fe: file xx.c, line 7.
(gdb) tb printmsg2
Breakpoint 2 at 0x40112a: file xx.c, line 12.
(gdb) run
Starting program: /tmp/xx.exe

[failed reading symbols from DLL]
"//C/WINNT/system32/crtdll.dll": error reading line numbers

[failed reading symbols from DLL]
"//C/WINNT/system32/KERNEL32.dll": error reading line numbers

Program received signal SIGTRAP, Trace/breakpoint trap.
0x77f6829b in ?? ()

----

I always get a signal SIGTRAP message whenever I try to debug any threaded
application. The rest of the 'gdb' session is completely unusable. I can run
this program (outside of the debugger) with no problem.

I'll point out that the version of 'gdb' provided with Mingw32's standalone
package does not have this problem.

---

System Information
------------------
Pentium II 400 MHz
128 MB RAM
Windows NT Server 4.0
Cygwin B20.1
gcc 2.95 (core and Mingw32-extras patches applied)
Anders Norlander's Win32 APIs installed

Jon Leichter
jon@symas.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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