[Lldb-commits] [lldb] [lldb/DWARF] Downgrade the "parent of variable is not CU" error (PR #108806)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 16 02:34:01 PDT 2024
https://github.com/labath created https://github.com/llvm/llvm-project/pull/108806
This can legitimately happen for static function-local variables with a non-manual dwarf index. According to the DWARF spec, these variables should be (and are) included in the compiler generated indexes, but they are ignored by our manual index. Encountering them does not indicate any sort of error.
The error message is particularly annoying due to a combination of the fact that we don't cache negative hits (so we print it every time we encounter it), VSCode's aggresive tab completion (which attempts a lookup after every keypress) and the fact that some low-level libraries (e.g. tcmalloc) have several local variables called "v". The result is a console full of error messages everytime you type "v ".
We already have tests (e.g. find-basic-variable.cpp), which check that these variables are not included in the result (and by extension, that their presence does not crash lldb). It would be possible to extend it to make sure it does *not* print this error message, but it doesn't seem like it would be particularly useful.
>From baea580cd620065bbe0f4e653bfbd5316e7f63ee Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Mon, 16 Sep 2024 10:52:00 +0200
Subject: [PATCH] [lldb/DWARF] Downgrade the "parent of variable is not CU"
error
This can legitimately happen for static function-local variables with a
non-manual dwarf index. According to the DWARF spec, these variables
should be (and are) included in the compiler generated indexes, but they
are ignored by our manual index. Encountering them does not indicate any
sort of error.
The error message is particularly annoying due to a combination of the
fact that we don't cache negative hits (so we print it every time we
encounter it), VSCode's aggresive tab completion (which attempts a
lookup after every keypress) and the fact that some low-level libraries
(e.g. tcmalloc) have several local variables called "v". The result is a
console full of error messages everytime you type "v ".
We already have tests (e.g. find-basic-variable.cpp), which check that
these variables are not included in the result (and by extension, that
their presence does not crash lldb). It would be possible to extend it
to make sure it does *not* print this error message, but it doesn't seem
like it would be particularly useful.
---
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f721ca00fd3559..082c437321e38b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3828,10 +3828,8 @@ void SymbolFileDWARF::ParseAndAppendGlobalVariable(
break;
default:
- GetObjectFile()->GetModule()->ReportError(
- "didn't find appropriate parent DIE for variable list for {0:x8} "
- "{1} ({2}).\n",
- die.GetID(), DW_TAG_value_to_name(die.Tag()), die.Tag());
+ LLDB_LOG(GetLog(DWARFLog::Lookups),
+ "DIE {0:x8} is not a global variable - ignoring", die.GetID());
return;
}
More information about the lldb-commits
mailing list