Jump to page: 1 2
Thread overview
[Issue 6088] New: Stack trace or some info with stack overflow
Oct 07, 2011
Andrej Mitrovic
Feb 05, 2012
Walter Bright
Feb 05, 2012
Andrej Mitrovic
Feb 05, 2012
Andrej Mitrovic
Feb 05, 2012
Yao Gomez
Feb 05, 2012
Rainer Schuetze
Feb 05, 2012
Rainer Schuetze
Feb 05, 2012
Yao Gomez
Feb 06, 2012
Walter Bright
Feb 06, 2012
Yao Gomez
Feb 06, 2012
dawg@dawgfoto.de
Feb 25, 2012
yebblies
June 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6088

           Summary: Stack trace or some info with stack overflow
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-06-02 07:20:16 PDT ---
This crashes at runtime because of a stack overflow (DMD 2.053). No stack trace, stack frame, error message or line number are shown:


int foo(int n) {
    return n ? foo(n - 1) : 1;
}
void main() {
    foo(100_000);
}


If you aren't running a debugger then receiving a nude crash is not so nice, because in a larger program there are many functions that may be the cause of a stack overflow.

So is it possible to produce a stack trace in this case too? If this is not possible, then an error message with the name of the last function called (and line number) or anything is useful. If necessary DMD may add some stack protection code in non-release mode only.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6088



--- Comment #1 from bearophile_hugs@eml.cc 2011-06-04 07:44:23 PDT ---
Regarding a stack overflow in a program Andrei has answered:

> I think a better tail call optimization would be in order.

A better compiler with better optimizations is welcome, but there are situations where even if you are able to optimize the code a lot, a stack overflow happens anyway. In such cases receiving some kind of error message (in debug builds only, if necessary) is quite useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6088



--- Comment #2 from bearophile_hugs@eml.cc 2011-06-06 11:21:53 PDT ---
This is partially a regression because if I compile that little foo+main program with DMD v2.050 it prints:

object.Error: Stack Overflow

That doesn't give a lot of information, but it explains the cause of the crash.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6088


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6088


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-10-07 07:31:02 PDT ---
Using 2.055 it only returns exit code -1073741819 on XP32 at runtime. It used to display a stack overflow error in past releases, so this has to be a regression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6088


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |WORKSFORME


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2012-02-05 00:14:48 PST ---
With 2.058 it prints:

object.Error: Stack Overflow
----------------
40B9FC
40B873
...
----------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6088



--- Comment #5 from bearophile_hugs@eml.cc 2012-02-05 04:47:19 PST ---
(In reply to comment #4)
> With 2.058 it prints:
> 
> object.Error: Stack Overflow
> ----------------
> 40B9FC
> 40B873
> ...
> ----------------

I can't reproduce it, so if someone confirms it this regression needs to be reopened. I am using Win Vista 32 bit, I compile with dmd 2.058head using the GitHub of Feb 5, and the demo code (foo + main) crashes with no messages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6088



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-02-05 09:15:37 PST ---
XP32, 2.057 and 2.058 don't print a stack trace.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6088



--- Comment #9 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-02-05 10:32:14 PST ---
(In reply to comment #8)
> It depends on the version of dbghelp.dll.
> 
> From an earlier discussion on the d-runtime mailing list: On XP I have version 5.1.2600.5512, it fails. on Win7, it is 6.1.7600.16385 and works. Also there is version 6.11.1.404 in Microsofts "Debugging Tools for Windows (x86)" which also works on XP.

What works exactly? Win7 x64: http://i.imgur.com/r2Tl4.png

Where's the stack overflow error?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6088


Yao Gomez <yao.gomez@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yao.gomez@gmail.com


--- Comment #10 from Yao Gomez <yao.gomez@gmail.com> 2012-02-05 10:37:49 PST ---
Windows 7 user here. It works and prints a nice stack trace when I compile and run my console program with rdmd, but with a Windows one (using WinMain) it doesn't.

The stack trace just print the first thrown exception, and between the dashed lines y only get some memory addresses.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2