-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[Debuginfo] Force enum DISCR_*
to static const u64
to allow for inspection via LLDB
#133990
Conversation
This comment has been minimized.
This comment has been minimized.
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs
Outdated
Show resolved
Hide resolved
Please @rustbot author |
To format the C++ code automatically, you should be able to do:
|
@Walnut356 Just to check, there's no debuginfo api in the LLVM C API, right? |
// FIXME: Currently we force all DISCR_* values to be u64's as LLDB seems to have | ||
// problems inspecting other value types. Since DISCR_* is typically only going to be | ||
// directly inspected via the debugger visualizer - which compares it to the `tag` value | ||
// (whose type is not modified at all) it shouldn't cause any real problems. |
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.
can we file a bug for this against lldb? I think they don't have a separate repo from llvm, so it would just be against https://github.com/llvm/llvm-project
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've opened an issue for it llvm/llvm-project#119101
At a glance it looks like there is debuginfo stuff in the LLVM C API, but we currently don't use any of it. |
This comment has been minimized.
This comment has been minimized.
If i'm understanding your question correctly, everything prefixed by |
Oh, I somehow managed to miss this header? https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm-c/DebugInfo.h I see. Ah, here we go: https://llvm.org/docs/doxygen/group__LLVMCCoreDebugInfo.html#ga8780f2c20339b37b01f8878401f27d00 |
Also, is there a way to add a debuginfo test for this, to catch changes in the output? |
Well, since we currently use the C++ API for debuginfo it seems, you don't have to use the C API version of this function. I can't imagine it's trivial to make that interoperate with our current C++-using handling of debuginfo. It would be better to do that port as its own PR, so I created an issue for it. |
At the moment, I don't think so. Debuginfo tests in CI currently only run on macos, whose output shouldn't change at all after these changes. There's also the problem that debug info is generated slightly differently for DAWRF vs PDB (afaik mostly due to the requirements of the formats themselves). As such, the tests would need to be written in a platoform-agnostic way, or they would need to have separate tests per platform. I haven't looked too much into how the test runner functions so i'm not sure how possible that is, but it fixing up the test suite is a priority for those of us working on debug info |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5784073
to
70e66f5
Compare
@rustbot review |
@Walnut356 Hello! Squashy squashy? |
…s `SBTypeStaticField::GetConstantValue()`
9a082a1
to
a1191e3
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (3dc3c52): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -7.3%, secondary -0.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 763.656s -> 763.423s (-0.03%) |
see here for more info.
This change mainly helps
*-msvc
debugged with LLDB. Currently, LLDB cannot inspectstatic
struct fields, so the intended visualization for enums is only borderline functional, and niche enums with ranges of discriminant cannot be determined at all .LLDB can inspect
static const
values (though for whatever reason, non-enum/non-u64 consts don't work).This change adds the
LLVMRustDIBuilderCreateQualifiedType
to the rust FFI layer to wrap the discr type with aconst
modifier, as well as forcing all generated integer enumDISCR_*
values to be u64's. Those values will only ever be used by debugger visualizers anyway, so it shouldn't be a huge deal, but I left a fixme comment for it just in case.. Thetag
also still properly reflects the discriminant type, so no information is lost.