Can I tell which version of newlib I have?
I'd like to know which version of newlib I have. Has anybody written a heap walker for the malloc routines. Ray -- 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/
Re: Can I tell which version of newlib I have?
Brian Dessent wrote: Brian Dessent wrote: The version you are using is whatever was current in CVS when the version of Cygwin you're using was built. Newlib doesn't really do versions, other than a token release every year around December. But that's completely irrelevant for anything relating to malloc, as Cygwin does not use newlib for malloc. Oh and as for the second part of the question, here is a quote from how-to-debug-cygwin.txt: 7. Heap corruption If your program crashes at malloc() or free() or when it references some malloc()'ed memory, it looks like heap corruption. You can configure and build special version of cygwin1.dll which includes heap sanity checking. To do it, just add --enable-malloc-debugging option to configure. Be warned, however, that this version of dll is _very_ slow (10-100 times slower than normal), so use it only when absolutely necessary. Brian It was my understanding that if I write a C program and compiled it with gcc that gcc used newlib for all of the stdlib functions including malloc, realloc and free. Ray -- 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/
Re: Can I tell which version of newlib I have?
Brian Dessent wrote: Brian Dessent wrote: The version you are using is whatever was current in CVS when the version of Cygwin you're using was built. Newlib doesn't really do versions, other than a token release every year around December. But that's completely irrelevant for anything relating to malloc, as Cygwin does not use newlib for malloc. Oh and as for the second part of the question, here is a quote from how-to-debug-cygwin.txt: 7. Heap corruption If your program crashes at malloc() or free() or when it references some malloc()'ed memory, it looks like heap corruption. You can configure and build special version of cygwin1.dll which includes heap sanity checking. To do it, just add --enable-malloc-debugging option to configure. Be warned, however, that this version of dll is _very_ slow (10-100 times slower than normal), so use it only when absolutely necessary. Brian Brian, It was my understanding that if I write a C program and compiled it with gcc that gcc used newlib for all of the stdlib functions including malloc, realloc and free. Ray -- 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/
Re: Can I tell which version of newlib I have?
Brian Dessent wrote: Ray Hurst wrote: It was my understanding that if I write a C program and compiled it with gcc that gcc used newlib for all of the stdlib functions including malloc, realloc and free. Gcc doesn't have any choice in the matter. All it knows is that there's a C library on the system, that's it. It doesn't know nor care where or how the C library is implemented. In the case of Cygwin, the C library is provided by Cygwin, in the form of cygwin1.dll. Cygwin relies on newlib to implement some things, but malloc is not one of them. Brian Brian, Technically you are correct. gcc does not care. However, gcc is typically used to invoke the linker which does care where the C library is. Most command lines that use gcc to compile and link do not specify where the C library is as gcc or the linker knows where it is. What I am asking is how do these programs find the C library on a cygwin system running on windows? Specifically. I am looking for the library that contains the malloc function but I would like the general info also. Ray -- 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/
Re: Can I tell which version of newlib I have?
Dave Korn wrote: On 25 April 2007 00:19, Ray Hurst wrote: Brian Dessent wrote: In the case of Cygwin, the C library is provided by Cygwin, in the form of cygwin1.dll. Cygwin relies on newlib to implement some things, but malloc is not one of them. Technically you are correct. gcc does not care. However, gcc is typically used to invoke the linker which does care where the C library is. Most command lines that use gcc to compile and link do not specify where the C library is as gcc or the linker knows where it is. What I am asking is how do these programs find the C library on a cygwin system running on windows? Specifically. I am looking for the library that contains the malloc function but I would like the general info also. Take a look at the output from "gcc -v" when compiling and linking a "Hello World": 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) /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1.exe -quiet -v -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../include/w3 2api -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include /w32api hello.c -quiet -dumpbase hello.c -mtune=pentiumpro -auxbase hello -version -o /win/c/DOCUME~1/dk/LOCALS~1/Temp/ycor.s #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/include /usr/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../include/w3 2api /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include /w32api End of search list. GNU C version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) (i686-pc-cygwin) compiled by GNU C version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/as.exe -o /win/c/DOCUME~1/dk/LOCALS~1/Temp/cc8gFoYM.o /win/c/DOCUME~1/dk/LOCALS~1/Temp/ycor.s This is the interesting bit: the linker commandline. /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cyg -o hello.exe /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/crt0.o -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. /win/c/DOCUME~1/dk/LOCALS~1/Temp/cc8gFoYM.o -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc Gcc just supplies the relevant search paths for the libraries. The standard system libraries to link against are this bit: -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc Where do they come from? Look at the start of the output again: Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs That's the specs file. Specs are an internal set of options that gcc uses to specify how to parse a commandline and pass options on to the substages (preprocessing, compilation, assembly, linking) of the whole process: see section 3.15, "Specifying subprocesses and the switches to pass to them" in "info gcc" for more detail. The stuff it contains is actually built-in to the gcc compile driver as well. Look at the output of "gcc --help": /tmp $ gcc --help Usage: gcc [options] file... Options: -pass-exit-codes Exit with highest error code from a phase --help Display this information --target-helpDisplay target s
Issue with GDB under Cygwin and XP
I'm running under Windows XP and Cygwin. I ran GDB on a simple C program and captured the output (below). I have a few questions: Why can I run the program several times with no errors but as soon as I set a breakpoint at main it gets a SIGSEGV fault? Why does the backtrace show only addresses? C:\Documents and Settings\Ray Hurst\workspace\CDT\HelloWorld-ANSIC\Debug>gdb Hel loWorld-ANSIC.exe 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) list 5Version : 6Copyright : Your copyright notice 7Description : Hello World in C, Ansi-style 8 === = 9*/ 10 11 #include 12 #include 13 14 int main(void) { (gdb) list 20 15 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ 16 return EXIT_SUCCESS; 17 } (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) b main Breakpoint 1 at 0x401050: file ../src/HelloWorld-ANSIC.c, line 14. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll Program received signal SIGSEGV, Segmentation fault. [Switching to thread 4896.0x1314] 0x07f4 in ?? () (gdb) bt #0 0x07f4 in ?? () #1 0x in ?? () (gdb) Ray -- 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/
Re: Issue with GDB under Cygwin and XP
Jim Marshall wrote: Ray Hurst wrote: I'm running under Windows XP and Cygwin. I ran GDB on a simple C program and captured the output (below). I have a few questions: Why can I run the program several times with no errors but as soon as I set a breakpoint at main it gets a SIGSEGV fault? Why does the backtrace show only addresses? C:\Documents and Settings\Ray Hurst\workspace\CDT\HelloWorld-ANSIC\Debug>gdb Hel loWorld-ANSIC.exe 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) list 5Version : 6Copyright : Your copyright notice 7Description : Hello World in C, Ansi-style 8 === = 9*/ 10 11 #include 12 #include 13 14 int main(void) { (gdb) list 20 15 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ 16 return EXIT_SUCCESS; 17 } (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) b main Breakpoint 1 at 0x401050: file ../src/HelloWorld-ANSIC.c, line 14. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll Program received signal SIGSEGV, Segmentation fault. [Switching to thread 4896.0x1314] 0x07f4 in ?? () (gdb) bt #0 0x07f4 in ?? () #1 0x in ?? () (gdb) Ray Works fine on my Windows XP Pro machine using the same GDB and gcc version 3.4.4. What gcc version do you have? The stack trace would indicate that the crash is occurring before it gets to your main function, since that code doesn't have debug symbols you get addresses. Jim, It's definitely crashing before getting to main and I don't know why. The tools versions are: gcc 4.2.3, binutils 2.17.50, and gdb 6.5.50. Ray -- 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/
Re: Issue with GDB under Cygwin and XP
Marco Atzeri wrote: --- Ray Hurst <[EMAIL PROTECTED]> ha scritto: Works fine on my Windows XP Pro machine using the same GDB and gcc version 3.4.4. What gcc version do you have? The stack trace would indicate that the crash is occurring before it gets to your main function, since that code doesn't have debug symbols you get addresses. Jim, It's definitely crashing before getting to main and I don't know why. The tools versions are: gcc 4.2.3, binutils 2.17.50, and gdb 6.5.50. Ray Hi Ray I will bet on Gcc 4.2.3. there are some reasons why on cygwin gcc 3.4.4 is still the default version. Regards Marco ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html Actually I was incorrect. The dump I gave you was for gcc 3.4.4. I got it to run under gcc 4.2.3 using Insight. I modified the program as follows: /* Name: HelloWorld.c Author : Ray Hurst Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style */ #include #include int main(void) { int a,b,c; a = 10; b = 20; c = 30; puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ printf("\na = %d, b = %d, c = %d\n", a,b,c); return EXIT_SUCCESS; } When I step through the program I cannot get the Local Variables window to update the variables when I step over the lines setting the variable. I look at the stack area in memory they definitely are updating. Ray -- 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/
Re: Issue with GDB under Cygwin and XP
Here is a run of a HellowWorld program (listed below in gdb). Can someone tell me why the variables a, b, c are not the correct values. I dumped the local stack and the variables are correct on the stack. I'm running Windows XP under cygwin. gcc 4.2.3 The gdb run is as follows: 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) list ,20 11 #include 12 #include 13 14 int main(void) { 15 int a,b,c; 16 a = 10; 17 b = 20; 18 c = 30; 19 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ 20 printf("\na = %d, b = %d, c = %d\n", a,b,c); (gdb) b main Breakpoint 1 at 0x401050: file ../src/HelloWorld.c, line 14. (gdb) run Starting program: /cygdrive/c/projects/Eclipse/WorkSpaces/cdt/HelloWorld/Debug/H elloWorld.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll Breakpoint 1, main () at ../src/HelloWorld.c:14 14 int main(void) { (gdb) n 16 a = 10; (gdb) n 17 b = 20; (gdb) n 18 c = 30; (gdb) n 19 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ (gdb) print a $1 = 1627408910 (gdb) print b $2 = 1627408208 (gdb) print c $3 = 264 (gdb) Ray -- 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/
Re: Issue with GDB under Cygwin and XP
Pedro Alves wrote: A Friday 15 February 2008 23:21:45, Ray Hurst wrote: Here is a run of a HellowWorld program (listed below in gdb). Can someone tell me why the variables a, b, c are not the correct values. I dumped the local stack and the variables are correct on the stack. I'm running Windows XP under cygwin. gcc 4.2.3 http://sourceware.org/ml/gdb-patches/2007-11/msg00567.html Pedro, Di I need to actually take the source changes from this thread and apply them to my build? Or is there a patch file available? Ray -- 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/
Re: Issue with GDB under Cygwin and XP
I compiled the latest gcc and gdb and it now works under cygwin. The versions I'm using are: D:\projects\Eclipse\CDT\HelloWorld2\Debug>gcc --version gcc (GCC) 4.2.3 Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. D:\projects\Eclipse\CDT\HelloWorld2\Debug>c:\cygwin\usr\local\bin\gdb --version GNU gdb 6.7.1 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin". Thanks for your help. Ray Ray Hurst wrote: I'm running under Windows XP and Cygwin. I ran GDB on a simple C program and captured the output (below). I have a few questions: Why can I run the program several times with no errors but as soon as I set a breakpoint at main it gets a SIGSEGV fault? Why does the backtrace show only addresses? C:\Documents and Settings\Ray Hurst\workspace\CDT\HelloWorld-ANSIC\Debug>gdb Hel loWorld-ANSIC.exe 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) list 5Version : 6Copyright : Your copyright notice 7Description : Hello World in C, Ansi-style 8 === = 9*/ 10 11 #include 12 #include 13 14 int main(void) { (gdb) list 20 15 puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ 16 return EXIT_SUCCESS; 17 } (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll !!!Hello World!!! Program exited normally. (gdb) b main Breakpoint 1 at 0x401050: file ../src/HelloWorld-ANSIC.c, line 14. (gdb) run Starting program: /cygdrive/c/Documents and Settings/Ray Hurst/workspace/CDT/Hel loWorld-ANSIC/Debug/HelloWorld-ANSIC.exe Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/cygwin1.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll Program received signal SIGSEGV, Segmentation fault. [Switching to thread 4896.0x1314] 0x07f4 in ?? () (gdb) bt #0 0x07f4 in ?? () #1 0x in ?? () (gdb) Ray -- 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/
Re: gcc + gdb + breakpoint => SIGSEGV
I had the same issue a couple of weeks ago. I never figured it out. I ended up updating the compiler to v4.2.3 then I updated gdb to v6.7.1. Everything started working. You might try just updating gdb and see what happens. The issue was only with cygwin. The same versions you have below ran under linux just find. Ray Dave Ohlsson wrote: 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/
Re: gcc + gdb + breakpoint => SIGSEGV
Dave, I downloaded the GDB 6.7.1 source and built it. Ray Dave Ohlsson wrote: Hi, This is what I did: 1) Removed several applications (including MtSQL 5.0) and rebooted. => no help. 2) Downgraded gdb from version 6.5.50.20060706-cvs to version 6.3.50_2004-12-28-cvs (I couldn't find gdb version 6.7.1 that Ray mentioned in his post). => IT WORKS! Thanks! -- dave _ 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/