[Issue 1001] print stack trace (in debug mode) when program die

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 26 04:25:28 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=1001


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #22 from bearophile_hugs at eml.cc 2010-05-26 04:25:20 PDT ---
This is an example of Python program that gives a stack trace (here I have used
a lambda also to show that stack trace printing code sometimes has problems
with anonymous functions):

reverser = lambda s: s[-1] + reverser(s[:-1]) if s else ""
print reverser("this is a test" * 200)

After battling with huge stack traces in Python, there's another feature that
I'd like to have in D (I am not sure if on default or not): stack trace
compression. If a recursive function keeps calling itself, or two functions
keep calling each other (other possibilities exist, but those two cover most
cases), the stack trace can become too much long to print and read.

So just looking at the latest stack frame printed and penultimate stack frame
printed it can compress it, reporting only how many time the last one or the
last two ones are repeated (the uncompressed stack trace can be obtained too
(on request if the compressed one is on default, otherwise it's the compressed
one that's on request), that shows all the line numbers too).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list