Re:D 2.069.0 released, compiler automatically ported from C+...
by lultimouomo on Wednesday November 04, 2015 @10:42AM
(#10507296)
On Unix segfaults by default don't generate stack traces.
This makes it work on linux, don't know about OSX (put it in your main module):
[ Parent
| on HN ]
Re:D 2.069.0 released, compiler automatically ported from C+...
by thepumpkin1979 on Wednesday November 04, 2015 @11:47AM
(#10507773)
The handler works in a real ubuntu VM but not in docker (the image is probably missing glibc https://github.com/D-Programming-Language/druntime/blob/mast... so that explains "static if" in your snippet)
to be honest, it's better than nothing but still kinda difficult to work with:
etc.linux.memoryerror.NullPointerError@src/etc/linux/memoryerror.d(325)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) [0x439045]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x438f92]
??:? _Dmain [0x435c17]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x4376da]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x437630]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x437696]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x437630]
??:? _d_run_main [0x43758d]
??:? main [0x436075]
??:? __libc_start_main [0xb0fa1ec4]
Re:D 2.069.0 released, compiler automatically ported from C+...
by destructionator on Wednesday November 04, 2015 @01:49PM
(#10508613)
Are you using the new version and compiling with -g there? Those addresses should be translateable into line numbers.
You can also do it manually btw with `addr2line -e your_executable 0x435c17` and the sort.
Re:D 2.069.0 released, compiler automatically ported from C+...
by thepumpkin1979 on Wednesday November 04, 2015 @02:28PM
(#10508955)
Thanks, I tried again and it seems to be working:
$ dmd -g main.d && ./main
etc.linux.memoryerror.NullPointerError@src/etc/linux/memoryerror.d(325)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) [0x423321]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x42326e]
main.d:12 _Dmain [0x4204e5]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x421b8a]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x421ae0]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x421b46]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x421ae0]
??:? _d_run_main [0x421a3d]
??:? main [0x420597]
??:? __libc_start_main [0xdb825ec4]
this is linux, I use mac as development machine, what can I do for mac? is there a error handler for mac too?