[Lldb-commits] [PATCH] D73921: Assert that a subprogram should have a name when parsing DWARF

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 3 14:47:59 PST 2020


aprantl added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:832
+  if (tag == DW_TAG_subprogram && !attrs.name) {
+    LLDB_LOGF(log, "Parsing a Subprogram that has no name");
+    assert(false && "Subprograms require a name");
----------------
The message should be:

"DWARF validation error: DW_TAG_subprogram without DW_AT_name"

Can you double-check that we don't already have an error reporting mechanism for malformed debug info?


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:833
+    LLDB_LOGF(log, "Parsing a Subprogram that has no name");
+    assert(false && "Subprograms require a name");
+  }
----------------
"Subprograms require a name" raises more questions than it answers:
- does that mean that LLDB will crash when this happens?
- since there is an assertion it definitely means that this code path is untested ...

If LLDB doesn't crash, then perhaps say something like:

"this is a bug in the producer"

In any case you need to be prepared for the possibility that somebody will find a compiler out in the wild that produces this kind of DWARF and will ask you to remove the assertion again. So it's probably better to leave this out.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73921/new/

https://reviews.llvm.org/D73921





More information about the lldb-commits mailing list