[D-runtime] [D-Programming-Language/druntime] 1117e5: implemented proper exception chaining on Posix

Sean Kelly sean at invisibleduck.org
Wed Mar 30 10:51:31 PDT 2011


On Mar 30, 2011, at 10:47 AM, Sean Kelly wrote:

> On Mar 30, 2011, at 12:29 AM, Don Clugston wrote:
> 
>> On 30 March 2011 08:02, Brad Roberts <braddr at puremagic.com> wrote:
>>> 
>>> 
>>> I just pushed a change set to the tests that make the TdplExceptionChaining the only code paths for test4.d and eh.d.
>>> eh.d doesn't currently pass, but I figured trading the test4.d failure for the eh.d failure was a step in the right
>>> direction.
>> 
>> Note that the tests in eh.d are tough. It's currently failing the
>> simplest one. Sean, you might want to take a close look at the tests,
>> and also at the comments in deh.d
>> The thing that's difficult is that you can have multiple chains of
>> exceptions in flight at any given time. The most important feature is
>> that chaining occurs only when the exception is handled (in a catch or
>> finally), not when it's thrown, because this is when the collision
>> actually happens.
> 
> That's when chaining occurs, but it's possible I screwed up something regarding the in-flight lookup process.  I'll give it a look.

Here's the output when I run eh.d on my OSX box.  It looks like everything passed, though I'm not entirely sure about the "Never called" line:


sean$ eh
start
try 1
finally 1
try 1
finally 1
try 2
done
foo
i = 0
catch, i = 0
i = 1
catch, i = 1
i = 2
catch, i = 2
i = 3
catch, i = 3
i = 4
catch, i = 4
i = 5
catch, i = 5
i = 6
catch, i = 6
i = 7
catch, i = 7
i = 8
catch, i = 8
i = 9
catch, i = 9
foo
i = 0
catch, i = 0
i = 1
catch, i = 1
i = 2
catch, i = 2
i = 3
catch, i = 3
i = 4
catch, i = 4
i = 5
catch, i = 5
i = 6
catch, i = 6
i = 7
catch, i = 7
i = 8
catch, i = 8
i = 9
catch, i = 9
iterations 10 totals: 10, 0
a
--
tb
b
Starting test
object.Exception at eh.d(170): test1
----------------
5   eh                                  0x00002acb void eh.test4() + 159
6   eh                                  0x0000253b _Dmain + 59
7   eh                                  0x0001334b extern (C) int rt.dmain2.main(int, char**).void runMain() + 23
8   eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
9   eh                                  0x00013393 extern (C) int rt.dmain2.main(int, char**).void runAll() + 59
10  eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
11  eh                                  0x00013263 main + 179
12  eh                                  0x000024f5 start + 53
initial test.
pass
object.Exception at eh.d(198): test2
----------------
5   eh                                  0x00002d60 void eh.test4().void __dgliteral1() + 100
6   eh                                  0x00002a26 void eh.Tester.stuff() + 30
7   eh                                  0x00002bad void eh.test4() + 385
8   eh                                  0x0000253b _Dmain + 59
9   eh                                  0x0001334b extern (C) int rt.dmain2.main(int, char**).void runMain() + 23
10  eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
11  eh                                  0x00013393 extern (C) int rt.dmain2.main(int, char**).void runAll() + 59
12  eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
13  eh                                  0x00013263 main + 179
14  eh                                  0x000024f5 start + 53
Never called.
object.Exception at eh.d(239): test3
----------------
5   eh                                  0x00002dec void eh.test4().void __dgliteral2() + 100
6   eh                                  0x00002a26 void eh.Tester.stuff() + 30
7   eh                                  0x00002c67 void eh.test4() + 571
8   eh                                  0x0000253b _Dmain + 59
9   eh                                  0x0001334b extern (C) int rt.dmain2.main(int, char**).void runMain() + 23
10  eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
11  eh                                  0x00013393 extern (C) int rt.dmain2.main(int, char**).void runAll() + 59
12  eh                                  0x000132d2 extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
13  eh                                  0x00013263 main + 179
14  eh                                  0x000024f5 start + 53
Passed!
i: 2
finally
i: 1
finally
i: 0
finally
--- tctbtaone
two
three
finish
sean$ 




More information about the D-runtime mailing list