X-Spam-Check-By: sourceware.org Date: Sun, 24 Sep 2006 11:00:11 +0200 (MET DST) From: Angelo Graziosi To: cygwin AT cygwin DOT com cc: eliz AT gnu DOT org Subject: GDB and debugging symbols Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Try to debug the segment faults of Emacs-cvs buildings I have observed the following on which I would ask some comment. When one build the following test case with -g option ---------------------------------------- $ cat hello.c #include int main() { printf("Hello, World!"); return 0; } gcc -g hello.c -o hello ---------------------------------------- then GDB says "no debugging symbols found": -------------------------------------------- $ gdb ./hello.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"...(no debugging symbols found) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (gdb) -------------------------------------------- Initially I thinked that "no debugging symbols found" did refer GDB not hello.exe. But using the option '-gdwarf-2': --------------------------------- $ gcc -gdwarf-2 -g3 hello.c -o hello $ gdb ./hello.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) --------------------------------- "no debugging symbols found" disappeared. Besides this ------------------------------------------------------ (gdb) start Breakpoint 1 at 0x401075: file hello.c, line 4. Starting program: /tmp/hello.exe Loaded symbols for /c/WINDOWS/system32/ntdll.dll Loaded symbols for /c/WINDOWS/system32/kernel32.dll Loaded symbols for /usr/bin/cygwin1.dll Loaded symbols for /c/WINDOWS/system32/advapi32.dll Loaded symbols for /c/WINDOWS/system32/rpcrt4.dll main () at hello.c:4 4 { (gdb) info source Current source file is hello.c Compilation directory is /tmp/ Located in /tmp/hello.c Contains 7 lines. Source language is c. Compiled with stabs debugging format. ^^^^^^^^^^^^^^^^^^^^^^ Does not include preprocessor macro info. (gdb) ------------------------------------------------------ As you can see compiling with '-gdwarf-2' produces a program for which GDB says that it was compiled with stabs debugging format, not DWARF 2 debugging format. This is confirmed even adding '-v': ------------------------------------ $ gcc -v -gdwarf-2 -g3 hello.c -o hello Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs Configured with: /usr/build/package/orig/test.new4/gcc-3.4.4-2/configure --verbo se --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexe cdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languag es=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --en able-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-aw t --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-thread s=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 -dD -D__CYGWIN32__ -D__CYGW IN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../ ../../../include/w32api -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-gdwarf-2 -g3 -version -o /c/DOCUME~1/Angelo/IMPOST~1/ Temp/cckyExuG.s ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i6 86-pc-cygwin/include" ignoring duplicate directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686 -pc-cygwin/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/include /usr/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../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 /c/D OCUME~1/Angelo/IMPOST~1/Temp/ccktozan.o /c/DOCUME~1/Angelo/IMPOST~1/Temp/cckyExu G.s /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cy g -o hello.exe /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../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/../../.. /c/DOCUME~1/Angelo/IMPOST~1/Temp/ccktozan.o -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc $ gdb ./hello.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) start Breakpoint 1 at 0x401075: file hello.c, line 4. Starting program: /tmp/hello.exe Loaded symbols for /c/WINDOWS/system32/ntdll.dll Loaded symbols for /c/WINDOWS/system32/kernel32.dll Loaded symbols for /usr/bin/cygwin1.dll Loaded symbols for /c/WINDOWS/system32/advapi32.dll Loaded symbols for /c/WINDOWS/system32/rpcrt4.dll main () at hello.c:4 4 { (gdb) info source Current source file is hello.c Compilation directory is /tmp/ Located in /tmp/hello.c Contains 7 lines. Source language is c. Compiled with stabs debugging format. ^^^^^^^^^^^^^^^^^^^^^^^ Does not include preprocessor macro info. (gdb) ------------------------------------ I have all Cygwin installed and updated using the test packages GCC-3.4.4-2 and bash-3.1-8. Angelo. -- 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/