--- Begin Message ---
Subject: |
gcc + gdb + breakpoint => SIGSEGV (Cygwin) |
Date: |
Sat, 23 Jun 2007 23:09:41 -0700 |
User-agent: |
G2/1.0 |
Hi,
I have a problem when trying to use gdb with a program compiled with
gcc in Cygwin.
I compile this program:
<main.c>
int main(int argc, char** argv)
{
return 0;
}
</main.c>
with this command:
gcc -g main.c
and I get this file:
9757 Jun 24 09:00 a.exe
I then start gdb:
gdb a.exe
and running the program in gdb works:
(gdb) run
Starting program: /c/TEMP/a.exe
Loaded symbols for /c/WINNT/system32/ntdll.dll
Loaded symbols for /c/WINNT/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /c/WINNT/system32/advapi32.dll
Loaded symbols for /c/WINNT/system32/rpcrt4.dll
Program exited normally.
but doing the same with a breakpoint yields SIGSEGV:
gdb a.exe
(gdb) list
1 int main(int argc, char** argv)
2 {
3 return 0;
4 }
(gdb) break 3
Breakpoint 1 at 0x40107a: file main.c, line 3.
(gdb) run
Starting program: /c/TEMP/a.exe
Loaded symbols for /c/WINNT/system32/ntdll.dll
Loaded symbols for /c/WINNT/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /c/WINNT/system32/advapi32.dll
Loaded symbols for /c/WINNT/system32/rpcrt4.dll
Program received signal SIGSEGV, Segmentation fault.
[Switching to thread 5856.0x171c]
0x005c004d in ?? ()
(gdb)
What could be wrong?
-- dave
The versions I use
------------------
`gcc -v' yields:
<gcc -v>
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/
configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/
lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --
enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-
gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj --
disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --
enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry --enable-
sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
</gcc -v>
When starting gdb, I get:
<gdb>
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 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 "i686-pc-cygwin".
</gdb>
--- End Message ---
--- Begin Message ---
Subject: |
confirm af1d98c7e715224896109e8c6b76f4eb8fa58d5e |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---