A working backtrace for linux

Leandro Lucarella luca at llucax.com.ar
Tue Aug 3 08:21:16 PDT 2010


David Bryant, el  3 de agosto a las 14:47 me escribiste:
> Hi all,
> 
> I've been using D under Ubuntu for some time and the kinds of
> backtraces I get when assertion fails look like this:
> 
> core.exception.AssertError at doodle.dia.standard_tools(71): Assertion failure
> ----------------
> ./bin/doodler() [0x8102086]
> ./bin/doodler() [0x804e38f]
> ./bin/doodler() [0x81022b1]
> ./bin/doodler() [0x81021d9]
> ./bin/doodler() [0x8102188]
> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x289bd6]
> ./bin/doodler() [0x8049a01]
> 
> And for segment faults I don't get a stack trace at all.
> 
> I am interested in knowing if this is the case for other users and
> if so, what is being done about it in druntime?
> 
> I've attached my own implementation of backtrace that I find useful.
> It is quick and dirty, but it works. It gives an output like the
> following when exceptions are thrown and segmentation faults
> triggered:
> 
> core.exception.AssertError at doodle.dia.standard_tools(71): Assertion failure
> ----------------
> [0x0810bbf8] onAssertError
> [0x081022c6] _d_assertm
> [0x0804e43f] void doodle.dia.standard_tools.__assert(int)
> [0x0804dfb8] bool
> doodle.dia.standard_tools.ZoomTool.handle_scroll(class
> doodle.dia.icanvas.Viewport, const(class
> doodle.tk.events.ScrollEvent))
> [0x0804e951] bool
> doodle.dia.tool_layer.ToolLayer.handle_scroll(class
> doodle.dia.icanvas.Viewport, const(class
> doodle.tk.events.ScrollEvent))
> [0x0804b607] bool doodle.gtk.canvas.Canvas.on_scroll(struct
> gtkc.gdktypes.GdkEventScroll*, class gtk.Widget.Widget)
> [0x080672c5] extern (C) int gtk.Widget.Widget.callBackScroll(struct
> gtkc.gtktypes.GtkWidget*, struct gtkc.gdktypes.GdkEventScroll*,
> class gtk.Widget.Widget)
> [0x08062155] void gtk.Main.Main.run()
> [0x08049e7b] _Dmain
> [0x08102594] extern (C) int rt.dmain2.main(int, char**) . void runMain()
> [0x081024f9] extern (C) int rt.dmain2.main(int, char**) . void
> tryExec(void delegate())
> 
> Using it couldn't be easier, just import the module and link the object.

You might be interested in this thread:
http://thread.gmane.org/gmane.comp.lang.d.phobos/1468


-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Un camión lleno de amigos, míos.
Cada uno dando vueltas, en su cabeza.
Mientras yo, sufro la picadura de mi propia abeja.


More information about the Digitalmars-d mailing list