This is the mail archive of the cygwin 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]
Other format: [Raw text]

RE: gcc + gdb + breakpoint => SIGSEGV


Update to my original post:

The same problem does NOT occur on my second PC, where I also have Windows XP + Cygwin and EXACTLY the same versions of gcc (3.4.4) and gdb (6.5.50.20060706-cvs). On my second PC, I get a correct behavior:

    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
    Loaded symbols for /c/WINNT/system32/secur32.dll
    
    Breakpoint 1, main (argc=1, argv=0x6637d0) at main.c:3
    3           return 0;

-- dave

----------------------------------------
> From: dave_140390@hotmail.com
> To: cygwin@cygwin.com
> Subject: gcc + gdb + breakpoint => SIGSEGV
> Date: Sun, 2 Mar 2008 03:27:52 -0500
> 
> 
> Hi,
> 
> I have a problem when trying to use gdb with a program compiled with gcc in Cygwin.
> 
> I compile this program:
> 
>     
>     int main(int argc, char** argv)
>     {
>         return 0;
>     }
>     
> 
> with this command:
> 
>     gcc -g main.c
> 
> and I get this file:
> 
>     9757 Mar  1 21:27 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
>     Loaded symbols for /c/WINNT/system32/secur32.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
>     Loaded symbols for /c/WINNT/system32/secur32.dll
> 
>     Program received signal SIGSEGV, Segmentation fault.
>     [Switching to thread 44692.0xaea4]
>     0x005c004d in ?? ()
>     (gdb)
> 
> What could be wrong?
> 
> I have completely uninstalled, then reinstalled Cygwin, without help.
> 
> -- dave
> 
> The versions I use
> ------------------
> `gcc -v' yields:
> 
> 
> 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 --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc
> --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --
> infodir=/usr/share/info --enable-languages=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-threads=posix --enable-java-gc=boehm --disable-
> win32-registry --enable-sjlj-exceptions --enable-hash-synchronization
> --enable-libstdcxx-debug
> Thread model: posix
> gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
> 
> 
> When starting gdb, I get:
> 
> 
> 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".
> 
> _________________________________________________________________
> Connect and share in new ways with Windows Live.
> http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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