public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: orium69@gmail.com
To: gdb-gnats@sources.redhat.com
Subject: backtrace/2463: Backtracing recursive main function call
Date: Thu, 05 Jun 2008 10:18:00 -0000	[thread overview]
Message-ID: <20080605100809.12356.qmail@sourceware.org> (raw)


>Number:         2463
>Category:       backtrace
>Synopsis:       Backtracing recursive main function call
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 05 10:18:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     orium69@gmail.com
>Release:        gdb-6.8
>Organization:
>Environment:
Linux localhost 2.6.23.16 #2 SMP Thu Feb 28 23:17:05 WET 2008 i686 i686 i386 GNU/Linux
gcc version 4.2.3.
gdb 6.8, configured as "i686-pc-linux-gnu"

>Description:
The gdb fails to print a correct backtrace of a program which segfaults with stack overflow in function main().

See how to repeat for more details.
>How-To-Repeat:
Create a file (coiso.c) with:

int
main(int argc, char **argv)
{
	return main(argc+1,NULL);
}


Compile it and run it in gdb as shown:

[orium@localhost tmp]$ gcc -ggdb -O0 coiso.c
[orium@localhost tmp]$ gdb a.out 
GNU gdb 6.8
Copyright (C) 2008 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-linux-gnu"...
(gdb) r
Starting program: /tmp/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x08048362 in main (argc=261948, argv=0x0) at coiso.c:6
6               return main(argc+1,NULL);
(gdb) bt
#0  0x08048362 in main (argc=261948, argv=0x0) at coiso.c:6
(gdb) print argc
$1 = 261948

The gdb says argc is 261948 but the stack has only one function!
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2008-06-05 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05 10:18 orium69 [this message]
2008-06-05 11:38 Daniel Jacobowitz

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=20080605100809.12356.qmail@sourceware.org \
    --to=orium69@gmail.com \
    --cc=gdb-gnats@sources.redhat.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).