www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Discussion on D support in gdb

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Maybe someone knowledgeable could chime in:

http://sourceware.org/ml/gdb/2011-11/msg00066.html



Andrei
Nov 21 2011
next sibling parent Trass3r <un known.com> writes:
It's basically about this:  
http://d.puremagic.com/issues/show_bug.cgi?id=4180
Nov 22 2011
prev sibling next sibling parent reply mta`chrono <chrono mta-international.net> writes:
A noob question from my side: What is DWARF?

By the way I never touched the sources of gdb. I'm just a friendly user
of it.
Nov 22 2011
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-11-22 13:13, mta`chrono wrote:
 A noob question from my side: What is DWARF?

 By the way I never touched the sources of gdb. I'm just a friendly user
 of it.

It's a standardized debugging data format. http://en.wikipedia.org/wiki/DWARF -- /Jacob Carlborg
Nov 22 2011
prev sibling next sibling parent Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
22.11.2011 15:13, mta`chrono пишет:
 A noob question from my side: What is DWARF?

 By the way I never touched the sources of gdb. I'm just a friendly user
 of it.

http://lmgtfy.com/?q=gdb+DWARF&l=1
Nov 22 2011
prev sibling parent Dejan Lekic <dejan.lekic gmail.com> writes:
mta`chrono wrote:

 A noob question from my side: What is DWARF?

http://dwarfstd.org/
Nov 22 2011
prev sibling next sibling parent reply "Martin Nowak" <dawg dawgfoto.de> writes:
On Tue, 22 Nov 2011 04:18:47 +0100, Andrei Alexandrescu  
<SeeWebsiteForEmail erdani.org> wrote:

 Maybe someone knowledgeable could chime in:

 http://sourceware.org/ml/gdb/2011-11/msg00066.html



 Andrei

I think we should follow Tom Tromney's proposal to add the extensions under the GNU vendor space, i.e. prefix them with 0x41xx. Numbers hopefully don't fall under licensing issues. It should be fairly straightforward to improve gdb debugging support given that changes are accepted on either side. The GDB codebase is a slightly unfriendly environment but getting rid of 'p ((char*[2])str)[1]' would be great. I would volunteer to do the implementation but it would be great if someone helped with clarifying the following issues. - Can we slowly start to acquire DWARF-3/4? - Why were extensions chosen over say representing an array as two field struct? - There is this request by Robert Clipsham http://dwarfstd.org/ShowIssue.php?issue=100504.1. What's the state of this, it wouldn't be needed any longer. - We should contact http://www.zero-bugs.com, it is said to support the dwarf extensions and would need to be changed. - Find out who else is affected by changing the current extensions. - Fixing the D-ABI specification. - Are there other DWARF debuggers that we should take into account? - Adding a page to GNU wiki describing the D extensions. - We could probably use DW_TAG_GNU_template_parameter_pack for variadic template arguments. http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates martin
Nov 22 2011
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2011-11-22 16:19, Martin Nowak wrote:
 - Are there other DWARF debuggers that we should take into account?

The LLBD debugger: http://lldb.llvm.org/ -- /Jacob Carlborg
Nov 22 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-11-22 21:04, bioinfornatics wrote:
 Le mardi 22 novembre 2011 à 16:27 +0100, Jacob Carlborg a écrit :
 On 2011-11-22 16:19, Martin Nowak wrote:
 - Are there other DWARF debuggers that we should take into account?

The LLBD debugger: http://lldb.llvm.org/

LLDB seem to be great but is OSX only ;'(

I'm certain it will be available on other platforms as well. This page mentions something about Linux: http://lldb.llvm.org/build.html -- /Jacob Carlborg
Nov 22 2011
prev sibling next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 11/22/2011 04:19 PM, Martin Nowak wrote:
 On Tue, 22 Nov 2011 04:18:47 +0100, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:

 Maybe someone knowledgeable could chime in:

 http://sourceware.org/ml/gdb/2011-11/msg00066.html



 Andrei

I think we should follow Tom Tromney's proposal to add the extensions under the GNU vendor space, i.e. prefix them with 0x41xx. Numbers hopefully don't fall under licensing issues.

Practically everything you can licence is a number.
Nov 22 2011
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-11-23 13:24, Roald Ribe wrote:
 On Tue, 22 Nov 2011 12:19:00 -0300, Martin Nowak <dawg dawgfoto.de> wrote:

 - Are there other DWARF debuggers that we should take into account?

Depends on what "taking into account" means in this context. The OpenWatcom debugger (wd/wdw) supports DWARF-2, and is released for WIN32, OS/2 and Linux (wd only). It (wd) probably compiles on BSD and OS/X as well. wd is the full screen character based version. wdw is the gui version. http://www.openwatcom.org Roald

For Mac OS X it would probably need support for the Mach-O file format, if it already isn't supported. -- /Jacob Carlborg
Nov 23 2011
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/22/2011 7:19 AM, Martin Nowak wrote:
 - Can we slowly start to acquire DWARF-3/4?

Dwarf 2 is good enough, so why do 3/4?
 - Why were extensions chosen over say representing an array as two field
struct?

Because it is presumably harder to get a debugger to recognize a magic struct than explicitly give it a type.
 - There is this request by Robert Clipsham
 http://dwarfstd.org/ShowIssue.php?issue=100504.1.
 What's the state of this, it wouldn't be needed any longer.

 - We should contact http://www.zero-bugs.com, it is said to support the
 dwarf extensions and would need to be changed.

 - Find out who else is affected by changing the current extensions.

 - Fixing the D-ABI specification.

Are the issues in bugzilla?
 - Are there other DWARF debuggers that we should take into account?

 - Adding a page to GNU wiki describing the D extensions.

 - We could probably use DW_TAG_GNU_template_parameter_pack for variadic
template
 arguments.
 http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates

 martin

Nov 24 2011
prev sibling parent Kagamin <spam here.lot> writes:
Martin Nowak Wrote:

 I think we should follow Tom Tromney's proposal to add the extensions
 under the GNU vendor space, i.e. prefix them with 0x41xx.

Yeah, why use extensible debug info format and not use the extensibility feature?
Nov 24 2011
prev sibling next sibling parent bioinfornatics <bioinfornatics fedoraproject.rog> writes:
Le mardi 22 novembre 2011 =C3=A0 16:27 +0100, Jacob Carlborg a =C3=A9crit :
 On 2011-11-22 16:19, Martin Nowak wrote:
 - Are there other DWARF debuggers that we should take into account?

The LLBD debugger: http://lldb.llvm.org/ =20

LLDB seem to be great but is OSX only ;'(
Nov 22 2011
prev sibling next sibling parent "Roald Ribe" <roald.ribe hotmail.com> writes:
On Tue, 22 Nov 2011 12:19:00 -0300, Martin Nowak <dawg dawgfoto.de> wrote:

   - Are there other DWARF debuggers that we should take into account?

Depends on what "taking into account" means in this context. The OpenWatcom debugger (wd/wdw) supports DWARF-2, and is released for WIN32, OS/2 and Linux (wd only). It (wd) probably compiles on BSD and OS/X as well. wd is the full screen character based version. wdw is the gui version. http://www.openwatcom.org Roald
Nov 23 2011
prev sibling next sibling parent Jerry <jlquinn optonline.net> writes:
"Martin Nowak" <dawg dawgfoto.de> writes:

 On Tue, 22 Nov 2011 04:18:47 +0100, Andrei Alexandrescu
 <SeeWebsiteForEmail erdani.org> wrote:

 Maybe someone knowledgeable could chime in:

 http://sourceware.org/ml/gdb/2011-11/msg00066.html



 Andrei

I think we should follow Tom Tromney's proposal to add the extensions under the GNU vendor space, i.e. prefix them with 0x41xx. Numbers hopefully don't fall under licensing issues. It should be fairly straightforward to improve gdb debugging support given that changes are accepted on either side. The GDB codebase is a slightly unfriendly environment but getting rid of 'p ((char*[2])str)[1]' would be great.

I've done a bit of reading on this issue, at least with regards to D arrays. I'm not a DWARF expert, but it appears that D dynamic arrays could be represented using the existing DWARF support, without an extension. Associative arrays are another issue. The current ABI describes them an opaque type. However, for the debugger to work with them, the structure must be understood somehow by the debugger. If treating them as a void* is the right approach (it still will result in compiler incompatibility), the ABI must define functions that access AA's. And debuggers will have to call those functions to read the AA. Until then, the debugger would have to cheat to access AA's. I don't know enough about delegates to comment on the support issues there.
 I would volunteer to do the implementation but it would be great if
 someone helped with
 clarifying the following issues.

  - Can we slowly start to acquire DWARF-3/4?

  - Why were extensions chosen over say representing an array as two
 field struct?

There was a comment on the ABI page that a struct is passed to functions differently from an array, and therefore debuggers wouldn't handle D arrays correctly if described that way.
  - We could probably use DW_TAG_GNU_template_parameter_pack for
 variadic template arguments.
    http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates

Note that the C++-11 standard also provides variadic templates. Therefore DWARF probably needs to address this in some standard way if it doesn't already. I'd think that D and C++ could share the same solution.
Nov 25 2011
prev sibling next sibling parent Jerry <jlquinn optonline.net> writes:
Walter Bright <newshound2 digitalmars.com> writes:

 On 11/22/2011 7:19 AM, Martin Nowak wrote:
 - Can we slowly start to acquire DWARF-3/4?

Dwarf 2 is good enough, so why do 3/4?
 - Why were extensions chosen over say representing an array as two field
struct?

Because it is presumably harder to get a debugger to recognize a magic struct than explicitly give it a type.
 - There is this request by Robert Clipsham
 http://dwarfstd.org/ShowIssue.php?issue=100504.1.
 What's the state of this, it wouldn't be needed any longer.

 - We should contact http://www.zero-bugs.com, it is said to support the
 dwarf extensions and would need to be changed.

 - Find out who else is affected by changing the current extensions.

 - Fixing the D-ABI specification.

Are the issues in bugzilla?

Huh, I swore I had already filed a bug regarding the AA ABI. http://d.puremagic.com/issues/show_bug.cgi?id=7008 Jerry
Nov 25 2011
prev sibling parent "Martin Nowak" <dawg dawgfoto.de> writes:
On Fri, 25 Nov 2011 04:13:18 +0100, Walter Bright  
<newshound2 digitalmars.com> wrote:

 On 11/22/2011 7:19 AM, Martin Nowak wrote:
 - Can we slowly start to acquire DWARF-3/4?

Dwarf 2 is good enough, so why do 3/4?
 - Why were extensions chosen over say representing an array as two  
 field struct?

Because it is presumably harder to get a debugger to recognize a magic struct than explicitly give it a type.

upper bound, one could directly translate D arrays. GDB doesn't support it at the moment, but it basically rules out requesting an extension to the DWARF standard. I think currently the best decision is to use the existing D support in GDB. C++0x will likely lead to extended support in GDB, while llvm-db should improve the OSX debugger support. With better support for the new formats we should be able to express specific D constructs in DWARF.
 - There is this request by Robert Clipsham
 http://dwarfstd.org/ShowIssue.php?issue=100504.1.
 What's the state of this, it wouldn't be needed any longer.

 - We should contact http://www.zero-bugs.com, it is said to support the
 dwarf extensions and would need to be changed.

 - Find out who else is affected by changing the current extensions.

 - Fixing the D-ABI specification.

Are the issues in bugzilla?
 - Are there other DWARF debuggers that we should take into account?

 - Adding a page to GNU wiki describing the D extensions.

 - We could probably use DW_TAG_GNU_template_parameter_pack for variadic  
 template
 arguments.
 http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates

 martin


Nov 28 2011