-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
Add debug info for labels to Odin #4385
base: master
Are you sure you want to change the base?
Conversation
Additional comments: The way this is done in I've tested the code on |
); | ||
_ZN4llvm9DIBuilder11insertLabelEPNS_7DILabelEPKNS_10DILocationEPNS_10BasicBlockE( | ||
m->debug_builder, | ||
llvm_label, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: llvm_label could be nullptr here? Although IIRC, LLVM uses new
in a bunch of places and doesn't specify std::nothrow
, even in the C API, so I think exceptions would kill odin
before it returns nullptr
anyways.
src/llvm_backend_debug.cpp
Outdated
// TODO(tf2spi): Work with gingerBill to see if we can patch LLVM-C | ||
// to export DILabel functions for the C API on Windows | ||
// or to determine whether it is worthwhile to do this. | ||
// Until then, unimplemented, so just return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not want to change the LLVM-C API. It has to be whatever the official one is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect, I now realize this is the more wise approach. Better to ask llvm-project to add a new C API that we can eventually use. This ORCv2/LLJIT issue is a fairly recent example of them adding the API fairly quickly when they detect a valid use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR adding DebugInfo labels got added recently. Whenever it's convenient and useful to update the LLVM-C
DLL for Windows, I can add a case for Windows to use the new functions.
This is a PR that adds debug info for labels in the
Odin
compiler, so now labels attached to statements in general likeif
,block
,for
, etc., have debug info.This is useful because debuggers can discern the location of code given a function and label and do actions to it like putting breakpoints on it. It's less finnicky than line breakpoints when it comes to source code changes.