[llvm] Modify llvm-gsymutil to ignore invalid file indexes. (PR #70876)
Greg Clayton via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 13:18:55 PDT 2023
================
@@ -272,14 +272,24 @@ static void parseInlineInfo(GsymCreator &Gsym, raw_ostream *Log, CUInfo &CUI,
if (auto NameIndex = getQualifiedNameIndex(Die, CUI.Language, Gsym))
II.Name = *NameIndex;
- II.CallFile = CUI.DWARFToGSYMFileIndex(
- Gsym, dwarf::toUnsigned(Die.find(dwarf::DW_AT_call_file), 0));
- II.CallLine = dwarf::toUnsigned(Die.find(dwarf::DW_AT_call_line), 0);
- // parse all children and append to parent
- for (DWARFDie ChildDie : Die.children())
- parseInlineInfo(Gsym, Log, CUI, ChildDie, Depth + 1, FI, II,
- AllInlineRanges, WarnIfEmpty);
- Parent.Children.emplace_back(std::move(II));
+ const uint64_t DwarfFileIdx =
+ dwarf::toUnsigned(Die.find(dwarf::DW_AT_call_file), UINT32_MAX);
+ std::optional<uint32_t> OptGSymFileIdx =
+ CUI.DWARFToGSYMFileIndex(Gsym, DwarfFileIdx);
+ if (OptGSymFileIdx) {
+ II.CallFile = OptGSymFileIdx.value();
+ II.CallLine = dwarf::toUnsigned(Die.find(dwarf::DW_AT_call_line), 0);
+ // parse all children and append to parent
+ for (DWARFDie ChildDie : Die.children())
+ parseInlineInfo(Gsym, Log, CUI, ChildDie, Depth + 1, FI, II,
+ AllInlineRanges, WarnIfEmpty);
+ Parent.Children.emplace_back(std::move(II));
+ } else if (Log) {
+ *Log << "error: inlined function DIE at " << HEX32(Die.getOffset())
----------------
clayborg wrote:
yes, when we run in `--quiet` mode, `Log` will be NULL.
https://github.com/llvm/llvm-project/pull/70876
More information about the llvm-commits
mailing list