www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - GDB + ddemangle

reply ANtlord <antlord92 gmail.com> writes:
Hello! I've written a piece of glue code that helps to debug D 
code using GDB. The code glues together GDB and ddmangle. 
Checkout the link https://github.com/ANtlord/gdb-ddemangle

PRs are welcome!
Apr 19 2018
next sibling parent Craig Dillabaugh <craig.dillabaugh gmail.com> writes:
On Thursday, 19 April 2018 at 12:43:36 UTC, ANtlord wrote:
 Hello! I've written a piece of glue code that helps to debug D 
 code using GDB. The code glues together GDB and ddmangle. 
 Checkout the link https://github.com/ANtlord/gdb-ddemangle

 PRs are welcome!
Nice work.
Apr 19 2018
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 19 April 2018 at 12:43:36 UTC, ANtlord wrote:
 Hello! I've written a piece of glue code that helps to debug D 
 code using GDB. The code glues together GDB and ddmangle. 
 Checkout the link https://github.com/ANtlord/gdb-ddemangle

 PRs are welcome!
You are aware that gdb has built-in support for demangling D for 3-4 years now? http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git&a=search&h=HEAD&st=commit&s=ibuclaw I don't know if Iain got all his patches in, but it demangles a lot of symbols for me already. However, I just started using the new lldb package in Termux, and I do miss it there. Otherwise, lldb is very nice and much more stable for me on 64-bit ARM.
Apr 20 2018
next sibling parent Basile B. <b2.temp gmx.com> writes:
On Friday, 20 April 2018 at 10:03:53 UTC, Joakim wrote:
 On Thursday, 19 April 2018 at 12:43:36 UTC, ANtlord wrote:
 Hello! I've written a piece of glue code that helps to debug D 
 code using GDB. The code glues together GDB and ddmangle. 
 Checkout the link https://github.com/ANtlord/gdb-ddemangle

 PRs are welcome!
You are aware that gdb has built-in support for demangling D for 3-4 years now?
I've been told this too, not so long ago, but actually i still feed GDB output with ddemangle too (for Coedit 'GDB commander' widget).
Apr 20 2018
prev sibling parent reply drug <drug2004 bk.ru> writes:
20.04.2018 13:03, Joakim пишет:
 
 You are aware that gdb has built-in support for demangling D for 3-4 
 years now?
 
But how to enable it? It doesn't work out of box at least for me.
Apr 20 2018
next sibling parent reply Mike Wey <mike-wey example.com> writes:
On 20-04-18 12:36, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D for 3-4 
 years now?
But how to enable it? It doesn't work out of box at least for me.
It should be automatic when the executable is build with debugging info. `-g` -- Mike Wey
Apr 20 2018
next sibling parent drug <drug2004 bk.ru> writes:
20.04.2018 14:06, Mike Wey пишет:
 On 20-04-18 12:36, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D for 3-4 
 years now?
But how to enable it? It doesn't work out of box at least for me.
It should be automatic when the executable is build with debugging info. `-g`
is there a way to check feature availability? What version gdb should have etc?
Apr 20 2018
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Friday, 20 April 2018 at 11:06:47 UTC, Mike Wey wrote:
 On 20-04-18 12:36, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D 
 for 3-4 years now?
But how to enable it? It doesn't work out of box at least for me.
It should be automatic when the executable is build with debugging info. `-g`
it is not, clearly ;)
Apr 20 2018
parent Basile B. <b2.temp gmx.com> writes:
On Friday, 20 April 2018 at 12:28:03 UTC, Basile B. wrote:
 On Friday, 20 April 2018 at 11:06:47 UTC, Mike Wey wrote:
 On 20-04-18 12:36, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D 
 for 3-4 years now?
But how to enable it? It doesn't work out of box at least for me.
It should be automatic when the executable is build with debugging info. `-g`
it is not, clearly ;)
The problem is that one also needs to process the compiler output in an IDE, so finally it doesn't change anything to anything
Apr 20 2018
prev sibling parent reply Mike Franklin <slavo5150 yahoo.com> writes:
On Friday, 20 April 2018 at 10:36:25 UTC, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 
 You are aware that gdb has built-in support for demangling D 
 for 3-4 years now?
 
But how to enable it? It doesn't work out of box at least for me.
I believe you enable it with `-demangle=dlang` The original announcement is here: https://forum.dlang.org/post/rvoqllpimfskvlabprot forum.dlang.org There are a few posts on the forum with some example usages: https://forum.dlang.org/search?q=%22demangle%3Ddlang%22&page=1 Mike
Apr 20 2018
parent reply drug <drug2004 bk.ru> writes:
20.04.2018 15:36, Mike Franklin пишет:
 On Friday, 20 April 2018 at 10:36:25 UTC, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D for 3-4 
 years now?
But how to enable it? It doesn't work out of box at least for me.
I believe you enable it with `-demangle=dlang` The original announcement is here: https://forum.dlang.org/post/rvoqllpimfskvlabprot forum.dlang.org There are a few posts on the forum with some example usages: https://forum.dlang.org/search?q=%22demangle%3Ddlang%22&page=1 Mike
thanks for reply! but gdb don't recognize this option - unknown option "--demangle=dlang" ``` $gdb --version GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. ... ``` Or it is intended to work only using `objdump` etc?
Apr 20 2018
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On 20 April 2018 at 14:54, drug via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:
 20.04.2018 15:36, Mike Franklin пишет:

 On Friday, 20 April 2018 at 10:36:25 UTC, drug wrote:
 20.04.2018 13:03, Joakim пишет:
 You are aware that gdb has built-in support for demangling D for 3-4
 years now?
But how to enable it? It doesn't work out of box at least for me.
I believe you enable it with `-demangle=dlang` The original announcement is here: https://forum.dlang.org/post/rvoqllpimfskvlabprot forum.dlang.org There are a few posts on the forum with some example usages: https://forum.dlang.org/search?q=%22demangle%3Ddlang%22&page=1 Mike
thanks for reply! but gdb don't recognize this option - unknown option "--demangle=dlang" ``` $gdb --version GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. ... ``` Or it is intended to work only using `objdump` etc?
GDB auto-detects the language based on DW_LANG tag in the debug info. If you are starting up gdb without a program to debug, you can explicitly switch with: set lang d Then try something like: demangle _D3fooFiZv Or if you want it to start up in D mode: gdb -ex 'set lang d'
Apr 20 2018
parent reply drug <drug2004 bk.ru> writes:
20.04.2018 16:49, Iain Buclaw пишет:
 
 GDB auto-detects the language based on DW_LANG tag in the debug info.
 
 If you are starting up gdb without a program to debug, you can
 explicitly switch with: set lang d
 Then try something like: demangle _D3fooFiZv
 
 Or if you want it to start up in D mode: gdb -ex 'set lang d'
 
it works, thank you. But not in all cases. For example when gdb stops on breakpoint it demangle, but if I do `bt` - backtrace isn't demangled.
Apr 20 2018
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On 20 April 2018 at 17:40, drug via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:
 20.04.2018 16:49, Iain Buclaw пишет:
 GDB auto-detects the language based on DW_LANG tag in the debug info.

 If you are starting up gdb without a program to debug, you can
 explicitly switch with: set lang d
 Then try something like: demangle _D3fooFiZv

 Or if you want it to start up in D mode: gdb -ex 'set lang d'
it works, thank you. But not in all cases. For example when gdb stops on breakpoint it demangle, but if I do `bt` - backtrace isn't demangled.
Using a compiler that implements 2.077 or later (IIRC) probably won't, due to gdb being too old. They broke ABI by introducing back referencing, no release of gdb supports that yet.
Apr 20 2018
next sibling parent drug <drug2004 bk.ru> writes:
20.04.2018 20:55, Iain Buclaw пишет:
 
 Using a compiler that implements 2.077 or later (IIRC) probably won't,
 due to gdb being too old.  They broke ABI by introducing back
 referencing, no release of gdb supports that yet.
 
I see. Thanks for clarification. Aren't plugins for gdb like subj more simple way to extend dlang support in gdb then?
Apr 20 2018
prev sibling next sibling parent reply ANtlord <antlord92 gmail.com> writes:
On Friday, 20 April 2018 at 17:55:12 UTC, Iain Buclaw wrote:
 On 20 April 2018 at 17:40, drug via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com> wrote:

 Using a compiler that implements 2.077 or later (IIRC) probably 
 won't, due to gdb being too old.  They broke ABI by introducing 
 back referencing, no release of gdb supports that yet.
I launched gdb with command `gdb -ex 'set lang d' test` disabling my plugin and I don't see demangling anywhere. Source file is compiled with command `dmd -g test.d` DMD 2.079 GDB 8.1 Did I miss something?
Apr 24 2018
parent reply Joakim <dlang joakim.fea.st> writes:
On Wednesday, 25 April 2018 at 05:09:28 UTC, ANtlord wrote:
 On Friday, 20 April 2018 at 17:55:12 UTC, Iain Buclaw wrote:
 On 20 April 2018 at 17:40, drug via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com> wrote:

 Using a compiler that implements 2.077 or later (IIRC) 
 probably won't, due to gdb being too old.  They broke ABI by 
 introducing back referencing, no release of gdb supports that 
 yet.
I launched gdb with command `gdb -ex 'set lang d' test` disabling my plugin and I don't see demangling anywhere. Source file is compiled with command `dmd -g test.d` DMD 2.079 GDB 8.1 Did I miss something?
Yes, read two posts back, by Iain.
Apr 24 2018
parent ANtlord <antlord92 gmail.com> writes:
On Wednesday, 25 April 2018 at 05:12:37 UTC, Joakim wrote:
 On Wednesday, 25 April 2018 at 05:09:28 UTC, ANtlord wrote:
 On Friday, 20 April 2018 at 17:55:12 UTC, Iain Buclaw wrote:
 On 20 April 2018 at 17:40, drug via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com> wrote:

 Using a compiler that implements 2.077 or later (IIRC) 
 probably won't, due to gdb being too old.  They broke ABI by 
 introducing back referencing, no release of gdb supports that 
 yet.
I launched gdb with command `gdb -ex 'set lang d' test` disabling my plugin and I don't see demangling anywhere. Source file is compiled with command `dmd -g test.d` DMD 2.079 GDB 8.1 Did I miss something?
Yes, read two posts back, by Iain.
My bad. I wasn't aware on the morning. I mess the sentence
 They broke ABI by introducing back referencing, no release of 
 gdb supports that yet
Apr 25 2018
prev sibling parent reply Arun Chandrasekaran <aruncxy gmail.com> writes:
On Friday, 20 April 2018 at 17:55:12 UTC, Iain Buclaw wrote:
 On 20 April 2018 at 17:40, drug via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com> wrote:
 20.04.2018 16:49, Iain Buclaw пишет:
[...]
it works, thank you. But not in all cases. For example when gdb stops on breakpoint it demangle, but if I do `bt` - backtrace isn't demangled.
Using a compiler that implements 2.077 or later (IIRC) probably won't, due to gdb being too old. They broke ABI by introducing back referencing, no release of gdb supports that yet.
This stays broken after 1 year. How do we fix this?
Apr 26 2019
parent Basile B. <b2.temp gmx.com> writes:
On Friday, 26 April 2019 at 07:08:45 UTC, Arun Chandrasekaran 
wrote:
 On Friday, 20 April 2018 at 17:55:12 UTC, Iain Buclaw wrote:
 On 20 April 2018 at 17:40, drug via Digitalmars-d-announce 
 <digitalmars-d-announce puremagic.com> wrote:
 20.04.2018 16:49, Iain Buclaw пишет:
[...]
it works, thank you. But not in all cases. For example when gdb stops on breakpoint it demangle, but if I do `bt` - backtrace isn't demangled.
Using a compiler that implements 2.077 or later (IIRC) probably won't, due to gdb being too old. They broke ABI by introducing back referencing, no release of gdb supports that yet.
This stays broken after 1 year. How do we fix this?
I recognize your name from IRC, where you posted a related question yesterday. The person in charge for D in GDB had answered: The problem is that the mangling scheme has changed (to produce shorter mangles). Demangling will be eventually supported when D will be in GCC for good (GCC 10) and then he would port the demangling from GCC to GDB. So for now demangling of D in GDB only work if the binary is compiled with a very old version of the compiler, i.e prior to the new mangling method.
Apr 26 2019