From: <ta...@us...> - 2008-11-18 16:12:00
|
Revision: 6835 http://x10.svn.sourceforge.net/x10/?rev=6835&view=rev Author: tardieu Date: 2008-11-18 16:11:57 +0000 (Tue, 18 Nov 2008) Log Message: ----------- print stack trace from native runtime Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-18 14:19:59 UTC (rev 6834) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-18 16:11:57 UTC (rev 6835) @@ -8,25 +8,37 @@ // called by native runtime inside main x10 thread public void main(final x10.core.Rail<java.lang.String> args) { - // start xrx - x10.runtime.Runtime.start( - // body of main activity - new x10.core.fun.VoidFun_0_0() { - public void apply() { - // catch and rethrow checked exceptions - // (closures cannot throw checked exceptions) - try { - // call the original app-main method - #2.main(args); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.lang.Error e) { - throw e; - } catch (java.lang.Throwable t) { - throw new x10.lang.MultipleExceptions(t); - } + try { + + // start xrx + x10.runtime.Runtime.start( + // body of main activity + new x10.core.fun.VoidFun_0_0() { + public void apply() { + // catch and rethrow checked exceptions + // (closures cannot throw checked exceptions) + try { + // call the original app-main method + #2.main(args); + } catch (java.lang.RuntimeException e) { + throw e; + } catch (java.lang.Error e) { + throw e; + } catch (java.lang.Throwable t) { + throw new x10.lang.MultipleExceptions(t); + } + } + }); + + } catch (java.lang.Throwable t) { + t.printStackTrace(); + if (t instanceof x10.lang.MultipleExceptions) { + x10.core.ValRail<Throwable> exceptions = ((x10.lang.MultipleExceptions) t).exceptions; + for(int i = 0; i < exceptions.length; i++) { + exceptions.get(i).printStackTrace(); } - }); + } + } } } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 14:19:59 UTC (rev 6834) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 16:11:57 UTC (rev 6835) @@ -63,18 +63,17 @@ * Run main activity in a finish */ public static def start(body:()=>Void):Void { - try { +// temporary: printStackTrace call moved to Main template (native code) +// try { val state = new FinishState(); val activity = new Activity(body, state); Thread.currentThread().activity(activity); state.notifySubActivitySpawn(); activity.run(); state.waitForFinish(); - } catch (t:Throwable) { - // temporary measure until we have a new stacktrace mechanism - Console.OUT.println("The activity did not catch: "+t); - //t.printStackTrace(); - } +// } catch (t:Throwable) { +// t.printStackTrace(); +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |