public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* backtrace/2463: Backtracing recursive main function call
@ 2008-06-05 10:18 orium69
  0 siblings, 0 replies; 2+ messages in thread
From: orium69 @ 2008-06-05 10:18 UTC (permalink / raw)
  To: gdb-gnats


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: backtrace/2463: Backtracing recursive main function call
@ 2008-06-05 11:38 Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2008-06-05 11:38 UTC (permalink / raw)
  To: nobody; +Cc: gdb-prs

The following reply was made to PR backtrace/2463; it has been noted by GNATS.

From: Daniel Jacobowitz <drow@false.org>
To: orium69@gmail.com
Cc: gdb-gnats@sourceware.org
Subject: Re: backtrace/2463: Backtracing recursive main function call
Date: Thu, 5 Jun 2008 07:33:44 -0400

 On Thu, Jun 05, 2008 at 10:08:09AM -0000, orium69@gmail.com wrote:
 > The gdb fails to print a correct backtrace of a program which segfaults with stack overflow in function main().
 
 Take a look at the GDB command "set backtrace past-main".
 
 -- 
 Daniel Jacobowitz
 CodeSourcery


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-05 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-05 10:18 backtrace/2463: Backtracing recursive main function call orium69
2008-06-05 11:38 Daniel Jacobowitz

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).