Hello !

When getting runtime errors the stack trace on terminal is a lot confuse and hard to work with simple tools like scite text editor, also there is a difference between windows/linux, windows get a bit better/clean stack trace and includes line numbers, where is this info generated to try improve it ?

Chhers !

=========windows
D:\tutorial>dmd -gs -gc testStackTrace.d

D:\tutorial>testStackTrace.exe
finally: func2
[email protected](12): on func2
----------------
0x004020E4 in void testStackTrace.func2() at D:\tutorial\testStackTrace.d(12) 0x0040210C in void testStackTrace.func3() at D:\tutorial\testStackTrace.d(18)
0x00402118 in _Dmain at D:\tutorial\testStackTrace.d(22)
0x00403188 in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().void __lambda1() 0x0040315B in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x00403074 in _d_run_main
0x00402A98 in main
0x00419C91 in mainCRTStartup
0x7598A55E in BaseThreadInitThunk
0x77E48F03 in RtlInitializeExceptionChain
0x77E48ED9 in RtlInitializeExceptionChain
=========
=========linux
$:~/dev/d/tutorial$ dmd -gs -gc testStackTrace.d
$:~/dev/d/tutorial$ ./testStackTrace
finally: func2
[email protected](12): on func2
----------------
./testStackTrace(void testStackTrace.func3()+0x9) [0x434ef1]
./testStackTrace(_Dmain+0x9) [0x434f01]
./testStackTrace(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x1f) [0x438a4f] ./testStackTrace(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x4389a2] ./testStackTrace(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x30) [0x438a08] ./testStackTrace(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x4389a2]
./testStackTrace(_d_run_main+0x193) [0x438923]
./testStackTrace(main+0x25) [0x435acd]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f9227bfe76d]
=========

=========testStackTrace.d
import std.stdio;

void func1()
{
        //int x, z = 2/x;
}

void func2()
{
        try { func1(); }
        catch(Exception e) { writeln("catch %s", e.msg);}
finally {writeln("finally: func2"); throw new Exception("on func2");}
}

void func3()
{
        func2();
}

void main()
{
        func3();
}
=========

Reply via email to