[llvm] r358734 - [DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 14:51:37 PDT 2019


Can the interesting input be generated by llvm-mc? I guess not,
because it's in the line table (& llvm-mc won't produce a bad line
table)?

Fair enough.

On Mon, Apr 29, 2019 at 12:11 AM Fāng-ruì Sòng <maskray at google.com> wrote:
>
> I think I'll need to patch ObjectYAML/DWARFEmitter (used by DWARFDebugInfoTest.cpp:TestDwarfVerifyInvalidLineFileIndex) first. It doesn't support DWARF v5 yet.
>
> On Tue, Apr 23, 2019 at 3:52 AM David Blaikie <dblaikie at gmail.com> wrote:
>>
>> Was this change addressing a failing test on a buildbot? Or should it
>> have a new test case of some kind?
>>
>> On Thu, Apr 18, 2019 at 8:32 PM Fangrui Song via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> >
>> > Author: maskray
>> > Date: Thu Apr 18 20:34:28 2019
>> > New Revision: 358734
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=358734&view=rev
>> > Log:
>> > [DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732
>> >
>> > Modified:
>> >     llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
>> >
>> > Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=358734&r1=358733&r2=358734&view=diff
>> > ==============================================================================
>> > --- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
>> > +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Thu Apr 18 20:34:28 2019
>> > @@ -705,7 +705,6 @@ void DWARFVerifier::verifyDebugLineRows(
>> >        continue;
>> >
>> >      // Verify prologue.
>> > -    uint32_t MaxFileIndex = LineTable->Prologue.FileNames.size();
>> >      uint32_t MaxDirIndex = LineTable->Prologue.IncludeDirectories.size();
>> >      uint32_t FileIndex = 1;
>> >      StringMap<uint16_t> FullPathMap;
>> > @@ -763,13 +762,16 @@ void DWARFVerifier::verifyDebugLineRows(
>> >        }
>> >
>> >        // Verify file index.
>> > -      if (Row.File > MaxFileIndex) {
>> > +      if (!LineTable->hasFileAtIndex(Row.File)) {
>> >          ++NumDebugLineErrors;
>> > +        bool isDWARF5 = LineTable->Prologue.getVersion() >= 5;
>> >          error() << ".debug_line["
>> >                  << format("0x%08" PRIx64,
>> >                            *toSectionOffset(Die.find(DW_AT_stmt_list)))
>> >                  << "][" << RowIndex << "] has invalid file index " << Row.File
>> > -                << " (valid values are [1," << MaxFileIndex << "]):\n";
>> > +                << " (valid values are [" << (isDWARF5 ? "0," : "1,")
>> > +                << LineTable->Prologue.FileNames.size()
>> > +                << (isDWARF5 ? ")" : "]") << "):\n";
>> >          DWARFDebugLine::Row::dumpTableHeader(OS);
>> >          Row.dump(OS);
>> >          OS << '\n';
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at lists.llvm.org
>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
> --
> 宋方睿


More information about the llvm-commits mailing list