helpful runtime error messages
Jesse Phillips
jessekphillips+D at gmail.com
Wed Dec 15 08:54:28 PST 2010
spir Wrote:
> For the following prog, I get:
>
> int element(int[] elements, uint i) {return elements[i];}
> void main () {
> int[] elements = [3,2,1];
> auto e = elements[9];
> }
>
> spir at o:~/prog/d$ dmd -ofprog -w -debug -unittest -L--export-dynamic prog.d
> spir at o:~/prog/d$ ./prog
> core.exception.RangeError at prog(20): Range violation
> ----------------
> ./prog(_d_array_bounds+0x16) [0x807cad6]
> ./prog(_D4prog7__arrayZ+0x12) [0x807a54a]
> ./prog(_Dmain+0x38) [0x807a524]
> ./prog(extern (C) int rt.dmain2.main(int, char**)) [0x807cc76]
> ./prog(extern (C) int rt.dmain2.main(int, char**)) [0x807cbd0]
> ./prog(extern (C) int rt.dmain2.main(int, char**)) [0x807ccba]
> ./prog(extern (C) int rt.dmain2.main(int, char**)) [0x807cbd0]
> ./prog(main+0x96) [0x807cb76]
> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x1ddbd6]
> ./prog() [0x807a401]
>
> Do you have (even) nicer error reports on some OS's or using some switches?
I believe this is where compiling with -gc (debug info that looks like C) as it should give you line numbers.
More information about the Digitalmars-d-learn
mailing list