Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write an LLDB plugin for dlang #81

Open
Geod24 opened this issue Feb 19, 2021 · 7 comments
Open

Write an LLDB plugin for dlang #81

Geod24 opened this issue Feb 19, 2021 · 7 comments

Comments

@Geod24
Copy link
Member

Geod24 commented Feb 19, 2021

Description

LLDB is the LLVM debugger. It's the main debugger on Mac OSX and available on other platforms.
Currently, support for LLDB is rather poor. While GDB support has been implemented years ago by @ibuclaw (), LLDB still doesn't know much about D.

Support for language is implemented via Plugins. The goal of this project is to write such a plugin, and to upstream it.

What are rough milestones of this project?

  1. Get familiar with the capability of plugins, what is possible / isn't;
  2. Get a basic plugin architecture in place, which is called when dlang is detected;
  3. Implement demangling of D symbols, most likely integrating the same code as GDB;
  4. Recognize D-specific data structures, such as arrays, associative arrays, typeinfo...
  5. Implement support for parsing D expressions, e.g. the ability to do "foo"[0 .. 2] in myAA;

How does this project help the D community?

Currently, one of the biggest obstacle in D adoption is the tool support. Notable, the debugging experience is miles behind other established languages.

Recommended skills

C++ proficiency.
Knowledge of Linux and how binaries are generated.
Experience with debugging in other native languages, such as C / C++.
DWARF or LLVM knowledge is a plus.

What can students expect to get out of doing this project?

Deep knowledge of how debugging works at the core.
Participation in not just one, but two open source projects.

Rating

Medium - Hard

Project Type

Infrastructure/Automation

Point of Contact/Possible Mentors

@Geod24

References

The DWARF standard: http://www.dwarfstd.org/
DMD debug info generator: https://github.com/dlang/dmd/blob/master/src/dmd/backend/dwarfdbginf.d
LDC debug info generator: https://github.com/ldc-developers/ldc/blob/master/gen/dibuilder.cpp
Example of a simple D-related contribution: https://reviews.llvm.org/D79559
Previous attempt limited to demangling: https://reviews.llvm.org/D44321
Associated discussion: https://lists.llvm.org/pipermail/lldb-dev/2016-September/011321.html

@Geod24
Copy link
Member Author

Geod24 commented Feb 19, 2021

@jblachly @timotheecour @JohanEngelen would you be interested in being point of contact as well ?

@Geod24
Copy link
Member Author

Geod24 commented Feb 19, 2021

Same question for @Luhrel

@jblachly
Copy link

I cannot commit to being primary mentor, but I would be happy to co-mentor (gratis) along with another expert if a student is selected for this project.

In addition to plugin, the LLDB team have signaled that they are potential amenable to including dlang types added directly; see my patch which added support for C++20 char8_t, as well as dlang's immutable characters:

https://reviews.llvm.org/D66447

They kept the char8_t work and suggested that the dlang changes (i.e. recognizing character types by name) could be acceptable but should be split out. Unfortunately I did not complete this. This would complement Mathias' work (linked above) in which character types are recognized by size. It has been a couple years since I loooked but LDC2 last I checked emits DWARF DW_ATE_UTF irrespective of whether the char (wchar, dchar) is plain, const, or immutable. Related, I see that @Luhrel has a pending PR for DMD to add DWARF immutable tag.

@maxhaton
Copy link
Member

It would be good if this ended up with some boilerplate/guidance along the lines of "How to add D support to your toolchain" on our website, thinking about it.

@Luhrel
Copy link

Luhrel commented Feb 19, 2021

@Geod24 I've never contributed to LLVM, so I'm not sure I'll be a good mentor, unfortunately.

@JohanEngelen
Copy link

@Geod24 I like the project, but I lack the time to commit as primary mentor. I think it'd be good if we could find an LLDB developer to provide regular guidance too, because the actual source contribution would be mainly in that project. I don't know what the current status is of language/plugin support, but I think figuring out how to handle languages that are not at the core of LLVM development is the biggest issue to tackle.

@JohanEngelen
Copy link

See https://reviews.llvm.org/rG7310403e3cdf for demangling support in LLVM, which is much more than just LLDB.

@mdparker mdparker added saoc and removed gsoc2021 labels Jun 18, 2021
Teemperor pushed a commit to llvm/llvm-project that referenced this issue Nov 11, 2021
This is part of dlang/project-ideas#81 .

This patch enables support for D programming language demangler by using a
pretty printed stacktrace with demangled D symbols, when present.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Reviewed By: JDevlieghere, teemperor

Differential Revision: https://reviews.llvm.org/D110578
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
This is part of dlang/project-ideas#81 .

This patch enables support for D programming language demangler by using a
pretty printed stacktrace with demangled D symbols, when present.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Reviewed By: JDevlieghere, teemperor

Differential Revision: https://reviews.llvm.org/D110578
@RazvanN7 RazvanN7 removed the saoc label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants