-
Notifications
You must be signed in to change notification settings - Fork 12.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
vtable symbols are not marked artificial in DWARF #125126
Comments
We have !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "<std::rt::lang_start::{closure_env#0}<()> as core::ops::function::Fn<()>>::{vtable}", scope: null, file: !2, type: !3, isLocal: true, isDefinition: true)
!2 = !DIFile(filename: "<unknown>", directory: "")
!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "<std::rt::lang_start::{closure_env#0}<()> as core::ops::function::Fn<()>>::{vtable_type}", file: !2, size: 384, align: 64, flags: DIFlagArtificial, elements: !4, vtableHolder: !14, templateParams: !23, identifier: "83627f9f9db11820e9b7128180480645") But there's no sign of that in the output DWARF, neither on the variable nor its type:
|
For regular variables, the flag is applied here, because that --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -200,6 +200,9 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
else
addGlobalName(GV->getName(), *VariableDIE, DeclContext);
+ if (GTy && GTy->isArtificial())
+ addFlag(*VariableDIE, dwarf::DW_AT_artificial);
+
addAnnotation(*VariableDIE, GV->getAnnotations());
if (uint32_t AlignInBytes = GV->getAlignInBytes()) And now I do see it in DWARF:
I'll try an LLVM PR with this change soon. |
Is this a duplicate of #90653 or? I mean, I'd close that issue since this one is better enumerated, if they are, but |
That looks the same, yes. |
I tried this code, from the gdb testsuite:
I compiled with
-g
.Examining the resulting DWARF, I see:
I think this should be marked with
DW_AT_artificial
, as it does not correspond to any user-written code in the CU. This will let gdb filter out these variables when displaying globals from a CU.The text was updated successfully, but these errors were encountered: