helpful runtime error messages

spir denis.spir at gmail.com
Wed Dec 15 09:11:05 PST 2010


On Wed, 15 Dec 2010 11:54:28 -0500
Jesse Phillips <jessekphillips+D at gmail.com> wrote:

> 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.

It was already compiled with -gc (removing this switch does not change output). I get a line only for top-level call (the number above point to the calling line in main).


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list