Skip to content

Commit 1f8e662

Browse files
authored
[lldb/DWARF] Downgrade the "parent of variable is not CU" error (llvm#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.
1 parent f771434 commit 1f8e662

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -3828,10 +3828,9 @@ void SymbolFileDWARF::ParseAndAppendGlobalVariable(
38283828
break;
38293829

38303830
default:
3831-
GetObjectFile()->GetModule()->ReportError(
3832-
"didn't find appropriate parent DIE for variable list for {0:x8} "
3833-
"{1} ({2}).\n",
3834-
die.GetID(), DW_TAG_value_to_name(die.Tag()), die.Tag());
3831+
LLDB_LOG(GetLog(DWARFLog::Lookups),
3832+
"{0} '{1}' ({2:x8}) is not a global variable - ignoring", tag,
3833+
die.GetName(), die.GetID());
38353834
return;
38363835
}
38373836

0 commit comments

Comments
 (0)