On 9/6/2010 3:38 PM, Christoph Pospiech wrote:
> Hi,
>
> my program currently throws an "Uncaught exception at place 0". How do I find
> out which statement causes this exception ?
>
> The traceback mentions a "matmul__closure__12". That could be a hint to the
> statement. But how could I relate this back to the line number of the X10
> source ?
Hi Christoph --

The easiest way to do this (at a high-level) is to add try/catch blocks 
to your source program.

Try of course with the entire body of the main program in the try block.
try {

S
} catch (x:Exception) {
Console.OUT.println("Caught!");
x.printStackTrace();
}

Then you can progressively decrease the size of the code in the 
try-catch. In this way, a few steps of binary splitting
should give you a fairly good idea about where the error is coming from.

Also, in general when you are debugging make sure that the body of every 
async is of the form

async {
    try {
     S
   }
   catch (e:Exception) {
    Console.OUT.println("Exception caught from async ".. add app 
specific info here..);
    e.printStackTrace();
    throw e;
}

I have found this is the best way of tracking down exceptions. as 
opposed to mucking around with gdb. Of course if you are familiar with 
gdb, that may work for you.

Best,
Vijay


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to