public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jim Marshall <jim.marshall@wbemsolutions.com>
To: cygwin@cygwin.com
Subject: Re: Issue with GDB under Cygwin and XP
Date: Wed, 13 Feb 2008 06:16:00 -0000	[thread overview]
Message-ID: <fotqic$eoq$1@ger.gmane.org> (raw)
In-Reply-To: <for5v0$qcr$1@ger.gmane.org>

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
> 5        Version     :
> 6        Copyright   : Your copyright notice
> 7        Description : Hello World in C, Ansi-style
> 8 =======================================================================
> =====
> 9        */
> 10
> 11      #include <stdio.h>
> 12      #include <stdlib.h>
> 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]
> 0x000007f4 in ?? ()
> (gdb) bt
> #0  0x000007f4 in ?? ()
> #1  0x00000000 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.


--
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/

  reply	other threads:[~2008-02-13  4:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12  9:02 Ray Hurst
2008-02-13  6:16 ` Jim Marshall [this message]
2008-02-13 19:41   ` Ray Hurst
2008-02-13 19:59     ` Marco Atzeri
2008-02-13 20:28       ` Ray Hurst
2008-02-14  8:16         ` Jim Marshall
2008-02-14  9:29           ` Jim Marshall
2008-02-16  4:45 ` Ray Hurst
2008-02-17  5:52   ` Pedro Alves
2008-02-17 13:30     ` Christopher Faylor
2008-02-18 20:44       ` Pedro Alves
2008-02-18 10:52     ` Ray Hurst
2008-02-18 21:45       ` Pedro Alves
2008-02-24  5:07 ` Ray Hurst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='fotqic$eoq$1@ger.gmane.org' \
    --to=jim.marshall@wbemsolutions.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).