Hello! I'm having problem to debug my C++ programs using GDB under cygwin. I get a seg-fault in the c-startup before the main function has been started.
The following test program is used: [EMAIL PROTECTED] /cygdrive/c/testcase$ more /cygdrive/c/testcase/test.cpp #include <iostream> #include <string> int main() { std::string t; std::cout << "Hello world!" << std::endl; std::cin >> t; std::cout << "Hello " << t << "!" << std::endl; } Trying to compile and run this program in cygwin give me the following result: [EMAIL PROTECTED] ~$ cd /cygdrive/c/testcase/ [EMAIL PROTECTED] /cygdrive/c/testcase$ ls a.exe test.cpp test.cpp~ [EMAIL PROTECTED] /cygdrive/c/testcase$ /bin/g++ -v Reading specs from /bin/../lib/gcc/i686-pc-cygwin/3.4.4/specs Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr -- exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --man dir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77, java,objc --enable-nls --without-included-gettext --enable-version-specific-runt ime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --ena ble-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=b oehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchroniza tion --enable-libstdcxx-debug : (reconfigured) Thread model: posix gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) [EMAIL PROTECTED] /cygdrive/c/testcase$ /usr/bin/g++ -g test.cpp [EMAIL PROTECTED] /cygdrive/c/testcase$ /bin/gdb a.exe GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special) Copyright 2004 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) run Starting program: /cygdrive/c/testcase/a.exe Program received signal SIGSEGV, Segmentation fault. 0x610ae938 in pthread_key_create () from /usr/bin/cygwin1.dll (gdb) bt #0 0x610ae938 in pthread_key_create () from /usr/bin/cygwin1.dll #1 0x6108dd7f in _sigfe () from /usr/bin/cygwin1.dll #2 0x59432d52 in ?? () #3 0x004ce348 in ?? () #4 0x004ce31b in ?? () #5 0x004ce348 in ?? () #6 0x0022edc8 in ?? () #7 0x610af6b7 in pthread::once () from /usr/bin/cygwin1.dll #8 0x610af6b7 in pthread::once () from /usr/bin/cygwin1.dll #9 0x6108dd7f in _sigfe () from /usr/bin/cygwin1.dll #10 0x0022edf8 in ?? () #11 0x0040f5c5 in _Unwind_SjLj_Register () at /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/iostream:77 #12 0x0040f5c5 in _Unwind_SjLj_Register () at /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/iostream:77 #13 0x004011a4 in main () at test.cpp:6 (gdb) exit Undefined command: "exit". Try "help". (gdb) quit The program is running. Exit anyway? (y or n) y [EMAIL PROTECTED] /cygdrive/c/testcase$ Seems like the initialization of the static iostream objects causes the seg-fault. I've tried to download gcc version 4.0 and a new gdb as tarballs and compiled it from source. Using these tools it seems to work. But it is not a good solution for us to have a separate compiler from the rest of the distribution. Any ideas how to fix this? --- Mikael R
cygcheck.out
Description: cygcheck.out
-- 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/