www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - helpful runtime error messages

reply spir <denis.spir gmail.com> writes:
Hello,


Am I the only one who gets, as only kind of runtime errors, spectacularly h=
elpful messages like:

int f () {return 0;}
void main () {
    assert (f() =3D=3D 1);
}
=3D=3D>
spir o:~/prog/d/Text$ ./__trials__
core.exception.AssertError __trials__(44): Assertion failure
----------------
./__trials__() [0x804bb86]
./__trials__() [0x8049642]
./__trials__() [0x804960b]
./__trials__() [0x804bd76]
./__trials__() [0x804bcd0]
./__trials__() [0x804bdba]
./__trials__() [0x804bcd0]
./__trials__() [0x804bc76]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x292bd6]

Thankfully, D is a static language, so that I have rather few runtime error=
s. But what am I missing to get a stack trace? Sometimes, I don't even have=
 the (last) faulty line of code (dunno why).


Denis
-- -- -- -- -- -- --
vit esse estrany =E2=98=A3

spir.wikidot.com
Dec 14 2010
parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
spir Wrote:

 Hello,
 
 
 Am I the only one who gets, as only kind of runtime errors, spectacularly
helpful messages like:
 
 int f () {return 0;}
 void main () {
     assert (f() == 1);
 }
 ==>
 spir o:~/prog/d/Text$ ./__trials__
 core.exception.AssertError __trials__(44): Assertion failure
That is the location of the assertion failure. The stack trace actually needs to have -L--export-dynamic as an argument this should be in the latest dmd.conf file already. Also compile with -gc will help, didn't seem to be required though.
Dec 14 2010
parent spir <denis.spir gmail.com> writes:
On Tue, 14 Dec 2010 13:44:27 -0500
Jesse Phillips <jessekphillips+D gmail.com> wrote:

 spir Wrote:
=20
 Hello,
=20
=20
 Am I the only one who gets, as only kind of runtime errors, spectacular=
ly helpful messages like:
=20
 int f () {return 0;}
 void main () {
     assert (f() =3D=3D 1);
 }
 =3D=3D>
 spir o:~/prog/d/Text$ ./__trials__
 core.exception.AssertError __trials__(44): Assertion failure
=20 That is the location of the assertion failure. The stack trace actually n=
eeds to have -L--export-dynamic as an argument this should be in the latest= dmd.conf file already. Also compile with -gc will help, didn't seem to be = required though. -gc does not seems to change anything (symbols are still rather cryptic, wi= th some mangling and hex codes). What is it supposed to do, actually? Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 15 2010