Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
June 14, 2018 Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all. So I was thinking why don't we use a existing and proven library for this, instead of roll our own? |
June 14, 2018 Re: Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | On Thursday, 14 June 2018 at 01:19:30 UTC, Yuxuan Shui wrote: > Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all. > > So I was thinking why don't we use a existing and proven library for this, instead of roll our own? Druntime does use externally supplied backtrace, if available: https://github.com/dlang/druntime/blob/master/src/core/runtime.d#L727 |
June 14, 2018 Re: Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joakim | On Thursday, 14 June 2018 at 05:42:22 UTC, Joakim wrote:
> On Thursday, 14 June 2018 at 01:19:30 UTC, Yuxuan Shui wrote:
>> Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all.
>>
>> So I was thinking why don't we use a existing and proven library for this, instead of roll our own?
>
> Druntime does use externally supplied backtrace, if available:
>
> https://github.com/dlang/druntime/blob/master/src/core/runtime.d#L727
Hmm, but not on DWARF platforms like linux or macOS, I see what you mean. Should be pretty easy for you to modify that code to do what you want though.
|
June 14, 2018 Re: Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | Am Thu, 14 Jun 2018 01:19:30 +0000 schrieb Yuxuan Shui: > Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all. > > So I was thinking why don't we use a existing and proven library for this, instead of roll our own? GDC uses libbacktrace since 2013: https://github.com/D-Programming-GDC/ GDC/blob/master/libphobos/libdruntime/gcc/backtrace.d I think the main problem for DMD/LDC is that libbacktrace is not an installed library, it's only available while building GCC. -- Johannes |
June 14, 2018 Re: Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | On Thursday, 14 June 2018 at 17:26:50 UTC, Johannes Pfau wrote: > Am Thu, 14 Jun 2018 01:19:30 +0000 schrieb Yuxuan Shui: > >> Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all. >> >> So I was thinking why don't we use a existing and proven library for this, instead of roll our own? > > GDC uses libbacktrace since 2013: https://github.com/D-Programming-GDC/ GDC/blob/master/libphobos/libdruntime/gcc/backtrace.d > > I think the main problem for DMD/LDC is that libbacktrace is not an installed library, it's only available while building GCC. libbacktrace is a standalone library: https://github.com/ianlancetaylor/libbacktrace GCC is using it. |
June 15, 2018 Re: Why are we not using libbacktrace for backtrace? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | Am Thu, 14 Jun 2018 20:57:05 +0000 schrieb Yuxuan Shui: > On Thursday, 14 June 2018 at 17:26:50 UTC, Johannes Pfau wrote: >> Am Thu, 14 Jun 2018 01:19:30 +0000 schrieb Yuxuan Shui: >> >>> Just ran into a problem where program will crash during stack trace. Turns out not only does druntime not support compressed debug info, it cannot handle it at all. >>> >>> So I was thinking why don't we use a existing and proven library for this, instead of roll our own? >> >> GDC uses libbacktrace since 2013: https://github.com/D-Programming-GDC/ GDC/blob/master/libphobos/libdruntime/gcc/backtrace.d >> >> I think the main problem for DMD/LDC is that libbacktrace is not an installed library, it's only available while building GCC. > > libbacktrace is a standalone library: https://github.com/ianlancetaylor/libbacktrace > > GCC is using it. It was initially developed for GCC and only available in the GCC tree. Ian Lance Taylor is a GCC developer. However, my point is that libbacktrace does not install as a .so shared library. Try to find packages for debian, rhel, ... It's just not distributed. As there is a standalone github repo now, the DMD builds could probably compile the source code into libdruntime like GCC does, but it's not as simple as linking a library. -- Johannes |
Copyright © 1999-2021 by the D Language Foundation