[llvm] r349207 - DebugInfo: Avoid using split DWARF when the split unit would be empty.

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 21 04:40:11 PST 2018


Hello David,

I hate to bring this up again, but I've found another (probably
unintended) side-effect of this change. After this patch, clang starts
duplicating the compilation directory in the list of
include_directories in the .debug_line table. See the following
example:

/tmp $ cat a.c
int main() { return  47; }
/tmp $ ~/ll/build/opt/bin/clang -gsplit-dwarf a.c -c
pavelo at unimatrix0 /tmp $ llvm-dwarfdump a.o -debug-line
a.o:    file format ELF64-x86-64

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
     total_length: 0x0000003b
          version: 4
  prologue_length: 0x00000020
  min_inst_length: 1
max_ops_per_inst: 1
  default_is_stmt: 1
        line_base: -5
       line_range: 14
      opcode_base: 13
standard_opcode_lengths[DW_LNS_copy] = 0
standard_opcode_lengths[DW_LNS_advance_pc] = 1
standard_opcode_lengths[DW_LNS_advance_line] = 1
standard_opcode_lengths[DW_LNS_set_file] = 1
standard_opcode_lengths[DW_LNS_set_column] = 1
standard_opcode_lengths[DW_LNS_negate_stmt] = 0
standard_opcode_lengths[DW_LNS_set_basic_block] = 0
standard_opcode_lengths[DW_LNS_const_add_pc] = 0
standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
standard_opcode_lengths[DW_LNS_set_isa] = 1
include_directories[  1] = '/tmp'        # <===== DUPLICATION HERE
                 Dir  Mod Time   File Len   File Name
                 ---- ---------- ---------- ---------------------------
file_names[  1]    1 0x00000000 0x00000000 a.c   # <===== REFERENCES
DIR 1 INSTEAD OF 0

Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000      1      0      1   0             0  is_stmt
0x000000000000000b      1     14      1   0             0  is_stmt
prologue_end
0x0000000000000012      1     14      1   0             0  is_stmt
end_sequence

So, basically the compilation dir is present in the line table twice,
once as the first explicit entry, and once as the implicit [0] entry.
(I've checked that .debug_info contains the correct DW_AT_comp_dir
attribute).
Reverting this patch (and those that depend on it) brings back the
original behavior -- no additional include_directories, and the
file_names array references the implicit [0] entry.

Now this doesn't make the line table invalid, and the only reason I've
found this is because of some questionable logic in lldb, which
attempts to support the PWD=/proc/self/cwd workflow by resolving the
symlinks in the compilation directory (and _only_ the compilation
directory). This now fails because none of the line entries actually
use the compilation directory. It is certainly possible to work around
this from the lldb side, but since this means (at the very least) that
llvm is producing sub-optimal line tables, I though it would be good
to bring this to your attention.

thanks,
pavel


On Wed, 19 Dec 2018 at 10:36, Pavel Labath <labath at google.com> wrote:
>
> Thanks for the quick fix.
>
> pl
>
> On Tue, 18 Dec 2018 at 20:44, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > Should be fixed in r349528  - thanks for identifying this!
> >
> > On Tue, Dec 18, 2018 at 10:54 AM David Blaikie <dblaikie at gmail.com> wrote:
> >>
> >> And... I was running an old clang built from before this change (usually I do a check-all often enough that my clang-tot is pretty up to date).
> >>
> >> Looking into this
> >>
> >> On Tue, Dec 18, 2018 at 8:51 AM David Blaikie <dblaikie at gmail.com> wrote:
> >>>
> >>> Thanks for letting me know, Pavel!
> >>>
> >>> Looking into this now, and my first attempt at reproducing this didn't seem to show the behavior you're seeing (& indeed if it had done so across the board I'd expect we would've seen some other test failures). Perhaps there are some other parameters being passed I would need to use to reproduce this?
> >>>
> >>> $ clang++-tot -v -gsplit-dwarf test.cpp -c && llvm-dwarfdump-tot test.dwo
> >>> clang version 8.0.0 (trunk 349415) (llvm/trunk 349196)
> >>> ...
> >>> test.dwo:       file format ELF64-x86-64
> >>>
> >>> .debug_info.dwo contents:
> >>> 0x00000000: Compile Unit: length = 0x00000044 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000048)
> >>>
> >>> 0x0000000b: DW_TAG_compile_unit
> >>>               DW_AT_GNU_dwo_name        ("test.dwo")
> >>>               DW_AT_producer    ("clang version 8.0.0 (trunk 349415) (llvm/trunk 349196)")
> >>>               DW_AT_language    (DW_LANG_C_plus_plus)
> >>>               DW_AT_name        ("test.cpp")
> >>>               DW_AT_GNU_dwo_id  (0xe9ee94e9755dc4ee)
> >>> 0x00000019:   DW_TAG_namespace
> >>>                 DW_AT_name      ("ns1")
> >>> 0x0000001b:     DW_TAG_variable
> >>>                   DW_AT_name    ("value")
> >>>                   DW_AT_type    (0x00000028 "int")
> >>>                   DW_AT_external        (true)
> >>>                   DW_AT_decl_file       (0x01)
> >>>                   DW_AT_decl_line       (4)
> >>>                   DW_AT_location        (DW_OP_GNU_addr_index 0x0)
> >>>                   DW_AT_linkage_name    ("_ZN3ns15valueE")
> >>> 0x00000027:     NULL
> >>> 0x00000028:   DW_TAG_base_type
> >>>                 DW_AT_name      ("int")
> >>>                 DW_AT_encoding  (DW_ATE_signed)
> >>>                 DW_AT_byte_size (0x04)
> >>> 0x0000002c:   DW_TAG_subprogram
> >>>                 DW_AT_low_pc    ( indexed (00000001) address = <no .debug_addr section>)
> >>>                 DW_AT_high_pc   (0x00000017)
> >>>                 DW_AT_frame_base        (DW_OP_reg6 RBP)
> >>>                 DW_AT_linkage_name      ("_Z4testv")
> >>>                 DW_AT_name      ("test")
> >>>                 DW_AT_decl_file (0x01)
> >>>                 DW_AT_decl_line (7)
> >>>                 DW_AT_external  (true)
> >>> 0x00000038:     DW_TAG_lexical_block
> >>>                   DW_AT_low_pc  ( indexed (00000002) address = <no .debug_addr section>)
> >>>                   DW_AT_high_pc (0x0000000c)
> >>> 0x0000003e:       DW_TAG_imported_module
> >>>                     DW_AT_decl_file     (0x01)
> >>>                     DW_AT_decl_line     (9)
> >>>                     DW_AT_import        (0x00000019)
> >>> 0x00000045:       NULL
> >>> 0x00000046:     NULL
> >>> 0x00000047:   NULL
> >>>
> >>>
> >>> On Tue, Dec 18, 2018 at 4:38 AM Pavel Labath <labath at google.com> wrote:
> >>>>
> >>>> Hello David,
> >>>>
> >>>> I think this patch had some unintended side effect on the DWO
> >>>> generation. The effect of it is missing block scope information in
> >>>> some DWO files. The simplest reproducer I have is this file:
> >>>>
> >>>> =====
> >>>> void print(int);
> >>>>
> >>>> namespace ns1 {
> >>>> int value = 100;
> >>>> }
> >>>>
> >>>> void test() {
> >>>>      do {
> >>>>          using namespace ns1;
> >>>>          print(value);
> >>>>      } while(0);
> >>>> }
> >>>> =====
> >>>>
> >>>> Compiling this (with -gsplit-dwarf) after this patch produces the
> >>>> following DWARF in the dwo file:
> >>>> =====
> >>>> 0x0000002c:   DW_TAG_subprogram
> >>>>                  DW_AT_low_pc   ( indexed (00000001) address = <no
> >>>> .debug_addr section>)
> >>>>                  DW_AT_high_pc  (0x00000017)
> >>>>                  DW_AT_frame_base       (DW_OP_reg6 RBP)
> >>>>                  DW_AT_linkage_name     ("_Z4testv")
> >>>>                  DW_AT_name     ("test")
> >>>>                  DW_AT_decl_file        (0x01)
> >>>>                  DW_AT_decl_line        (7)
> >>>>                  DW_AT_external (true)
> >>>> =====
> >>>> Notice how the information about the blocks and their scopes is
> >>>> missing from the dwo file. After reverting this patch, I get the
> >>>> expected lexical_block and imported_module tags.
> >>>> =====
> >>>> 0x0000002c:   DW_TAG_subprogram
> >>>>                  DW_AT_low_pc   ( indexed (00000001) address = <no
> >>>> .debug_addr section>)
> >>>>                  DW_AT_high_pc  (0x00000017)
> >>>>                  DW_AT_frame_base       (DW_OP_reg6 RBP)
> >>>>                  DW_AT_linkage_name     ("_Z4testv")
> >>>>                  DW_AT_name     ("test")
> >>>>                  DW_AT_decl_file        (0x01)
> >>>>                  DW_AT_decl_line        (7)
> >>>>                  DW_AT_external (true)
> >>>>
> >>>> 0x00000038:     DW_TAG_lexical_block
> >>>>                    DW_AT_low_pc ( indexed (00000002) address = <no
> >>>> .debug_addr section>)
> >>>>                    DW_AT_high_pc        (0x0000000c)
> >>>>
> >>>> 0x0000003e:       DW_TAG_imported_module
> >>>>                      DW_AT_decl_file    (0x01)
> >>>>                      DW_AT_decl_line    (9)
> >>>>                      DW_AT_import       (cu + 0x0019)
> >>>>
> >>>> 0x00000045:       NULL
> >>>> =====
> >>>>
> >>>> I found this because some of the tests in the lldb test suite started
> >>>> failing after this patch, but unfortunately I don't have a good bot I
> >>>> could point you at this point.
> >>>>
> >>>> Could you please check this out?
> >>>>
> >>>> thanks,
> >>>> pavel
> >>>>
> >>>>
> >>>>
> >>>> On Mon, 17 Dec 2018 at 22:14, David Blaikie via llvm-commits
> >>>> <llvm-commits at lists.llvm.org> wrote:
> >>>> >
> >>>> > Fixed in r349395
> >>>> >
> >>>> > On Mon, Dec 17, 2018 at 1:11 PM David Blaikie <dblaikie at gmail.com> wrote:
> >>>> >>
> >>>> >> Thanks Galina - looking into it!
> >>>> >>
> >>>> >> On Mon, Dec 17, 2018 at 12:43 PM Galina Kistanova <gkistanova at gmail.com> wrote:
> >>>> >>>
> >>>> >>> Hello David,
> >>>> >>>
> >>>> >>> It looks like this commit broke test to couple lto builders:
> >>>> >>> The builders were already broken on build step and did not reach test steps. And did not send notifications also on this.
> >>>> >>>
> >>>> >>> http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu
> >>>> >>> http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu
> >>>> >>> . . .
> >>>> >>> Failing Tests (1):
> >>>> >>>     LLVM :: tools/gold/X86/split-dwarf.ll
> >>>> >>>
> >>>> >>> Please have a look?
> >>>> >>>
> >>>> >>> Thanks
> >>>> >>>
> >>>> >>>
> >>>> >>> Galina
> >>>> >>>
> >>>> >>> On Fri, Dec 14, 2018 at 2:47 PM David Blaikie via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> >>>> >>>>
> >>>> >>>> Author: dblaikie
> >>>> >>>> Date: Fri Dec 14 14:44:46 2018
> >>>> >>>> New Revision: 349207
> >>>> >>>>
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=349207&view=rev
> >>>> >>>> Log:
> >>>> >>>> DebugInfo: Avoid using split DWARF when the split unit would be empty.
> >>>> >>>>
> >>>> >>>> In ThinLTO many split CUs may be effectively empty because of the lack
> >>>> >>>> of support for cross-unit references in split DWARF.
> >>>> >>>>
> >>>> >>>> Using a split unit in those cases is just a waste/overhead - and turned
> >>>> >>>> out to be one contributor to a significant symbolizer performance issue
> >>>> >>>> when global variable debug info was being imported (see r348416 for the
> >>>> >>>> primary fix) due to symbolizers seeing CUs with no ranges, assuming
> >>>> >>>> there might still be addresses covered and walking into the split CU to
> >>>> >>>> see if there are any ranges (when that split CU was in a DWP file, that
> >>>> >>>> meant loading the DWP and its index, the index was extra large because
> >>>> >>>> of all these fractured/empty CUs... and so was very expensive to load).
> >>>> >>>>
> >>>> >>>> (the 3rd fix which will follow, is to assume that a CU with no ranges is
> >>>> >>>> empty rather than merely missing its CU level range data - and to not
> >>>> >>>> walk into its DIEs (split or otherwise) in search of address information
> >>>> >>>> that is generally not present)
> >>>> >>>>
> >>>> >>>> Modified:
> >>>> >>>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >>>> >>>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> >>>> >>>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
> >>>> >>>>     llvm/trunk/test/DebugInfo/X86/fission-cu.ll
> >>>> >>>>     llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
> >>>> >>>>     llvm/trunk/test/DebugInfo/X86/string-offsets-table-order.ll
> >>>> >>>>     llvm/trunk/test/DebugInfo/X86/string-offsets-table.ll
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> >>>> >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -568,25 +568,10 @@ void DwarfDebug::addGnuPubAttributes(Dwa
> >>>> >>>>    U.addFlag(D, dwarf::DW_AT_GNU_pubnames);
> >>>> >>>>  }
> >>>> >>>>
> >>>> >>>> -// Create new DwarfCompileUnit for the given metadata node with tag
> >>>> >>>> -// DW_TAG_compile_unit.
> >>>> >>>> -DwarfCompileUnit &
> >>>> >>>> -DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) {
> >>>> >>>> -  if (auto *CU = CUMap.lookup(DIUnit))
> >>>> >>>> -    return *CU;
> >>>> >>>> -  StringRef FN = DIUnit->getFilename();
> >>>> >>>> -  CompilationDir = DIUnit->getDirectory();
> >>>> >>>> -
> >>>> >>>> -  auto OwnedUnit = llvm::make_unique<DwarfCompileUnit>(
> >>>> >>>> -      InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
> >>>> >>>> -  DwarfCompileUnit &NewCU = *OwnedUnit;
> >>>> >>>> +void DwarfDebug::finishUnitAttributes(const DICompileUnit *DIUnit,
> >>>> >>>> +                                      DwarfCompileUnit &NewCU) {
> >>>> >>>>    DIE &Die = NewCU.getUnitDie();
> >>>> >>>> -  InfoHolder.addUnit(std::move(OwnedUnit));
> >>>> >>>> -  if (useSplitDwarf()) {
> >>>> >>>> -    NewCU.setSkeleton(constructSkeletonCU(NewCU));
> >>>> >>>> -    NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
> >>>> >>>> -                  Asm->TM.Options.MCOptions.SplitDwarfFile);
> >>>> >>>> -  }
> >>>> >>>> +  StringRef FN = DIUnit->getFilename();
> >>>> >>>>
> >>>> >>>>    for (auto *IE : DIUnit->getImportedEntities())
> >>>> >>>>      NewCU.addImportedEntity(IE);
> >>>> >>>> @@ -640,11 +625,6 @@ DwarfDebug::getOrCreateDwarfCompileUnit(
> >>>> >>>>                      dwarf::DW_FORM_data1, RVer);
> >>>> >>>>    }
> >>>> >>>>
> >>>> >>>> -  if (useSplitDwarf())
> >>>> >>>> -    NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());
> >>>> >>>> -  else
> >>>> >>>> -    NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
> >>>> >>>> -
> >>>> >>>>    if (DIUnit->getDWOId()) {
> >>>> >>>>      // This CU is either a clang module DWO or a skeleton CU.
> >>>> >>>>      NewCU.addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8,
> >>>> >>>> @@ -654,9 +634,31 @@ DwarfDebug::getOrCreateDwarfCompileUnit(
> >>>> >>>>        NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
> >>>> >>>>                        DIUnit->getSplitDebugFilename());
> >>>> >>>>    }
> >>>> >>>> +}
> >>>> >>>> +// Create new DwarfCompileUnit for the given metadata node with tag
> >>>> >>>> +// DW_TAG_compile_unit.
> >>>> >>>> +DwarfCompileUnit &
> >>>> >>>> +DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) {
> >>>> >>>> +  if (auto *CU = CUMap.lookup(DIUnit))
> >>>> >>>> +    return *CU;
> >>>> >>>> +
> >>>> >>>> +  CompilationDir = DIUnit->getDirectory();
> >>>> >>>> +
> >>>> >>>> +  auto OwnedUnit = llvm::make_unique<DwarfCompileUnit>(
> >>>> >>>> +      InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
> >>>> >>>> +  DwarfCompileUnit &NewCU = *OwnedUnit;
> >>>> >>>> +  InfoHolder.addUnit(std::move(OwnedUnit));
> >>>> >>>> +
> >>>> >>>> +  if (useSplitDwarf()) {
> >>>> >>>> +    NewCU.setSkeleton(constructSkeletonCU(NewCU));
> >>>> >>>> +    NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());
> >>>> >>>> +  } else {
> >>>> >>>> +    finishUnitAttributes(DIUnit, NewCU);
> >>>> >>>> +    NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
> >>>> >>>> +  }
> >>>> >>>>
> >>>> >>>>    CUMap.insert({DIUnit, &NewCU});
> >>>> >>>> -  CUDieMap.insert({&Die, &NewCU});
> >>>> >>>> +  CUDieMap.insert({&NewCU.getUnitDie(), &NewCU});
> >>>> >>>>    return NewCU;
> >>>> >>>>  }
> >>>> >>>>
> >>>> >>>> @@ -851,7 +853,12 @@ void DwarfDebug::finalizeModuleInfo() {
> >>>> >>>>      // If we're splitting the dwarf out now that we've got the entire
> >>>> >>>>      // CU then add the dwo id to it.
> >>>> >>>>      auto *SkCU = TheCU.getSkeleton();
> >>>> >>>> -    if (useSplitDwarf()) {
> >>>> >>>> +    if (useSplitDwarf() && !empty(TheCU.getUnitDie().children())) {
> >>>> >>>> +      finishUnitAttributes(TheCU.getCUNode(), TheCU);
> >>>> >>>> +      TheCU.addString(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_name,
> >>>> >>>> +                      Asm->TM.Options.MCOptions.SplitDwarfFile);
> >>>> >>>> +      SkCU->addString(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_name,
> >>>> >>>> +                      Asm->TM.Options.MCOptions.SplitDwarfFile);
> >>>> >>>>        // Emit a unique identifier for this CU.
> >>>> >>>>        uint64_t ID =
> >>>> >>>>            DIEHash(Asm).computeCUSignature(DWOName, TheCU.getUnitDie());
> >>>> >>>> @@ -870,6 +877,8 @@ void DwarfDebug::finalizeModuleInfo() {
> >>>> >>>>          SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
> >>>> >>>>                                Sym, Sym);
> >>>> >>>>        }
> >>>> >>>> +    } else if (SkCU) {
> >>>> >>>> +      finishUnitAttributes(SkCU->getCUNode(), *SkCU);
> >>>> >>>>      }
> >>>> >>>>
> >>>> >>>>      // If we have code split among multiple sections or non-contiguous
> >>>> >>>> @@ -882,7 +891,9 @@ void DwarfDebug::finalizeModuleInfo() {
> >>>> >>>>
> >>>> >>>>      // We don't keep track of which addresses are used in which CU so this
> >>>> >>>>      // is a bit pessimistic under LTO.
> >>>> >>>> -    if (!AddrPool.isEmpty())
> >>>> >>>> +    if (!AddrPool.isEmpty() &&
> >>>> >>>> +        (getDwarfVersion() >= 5 ||
> >>>> >>>> +         (SkCU && !empty(TheCU.getUnitDie().children()))))
> >>>> >>>>        U.addAddrTableBase();
> >>>> >>>>
> >>>> >>>>      if (unsigned NumRanges = TheCU.getRanges().size()) {
> >>>> >>>> @@ -2483,8 +2494,6 @@ void DwarfDebug::emitDebugMacinfo() {
> >>>> >>>>
> >>>> >>>>  void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
> >>>> >>>>                                    std::unique_ptr<DwarfCompileUnit> NewU) {
> >>>> >>>> -  NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
> >>>> >>>> -                  Asm->TM.Options.MCOptions.SplitDwarfFile);
> >>>> >>>>
> >>>> >>>>    if (!CompilationDir.empty())
> >>>> >>>>      NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> >>>> >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -540,6 +540,8 @@ class DwarfDebug : public DebugHandlerBa
> >>>> >>>>    /// Create new DwarfCompileUnit for the given metadata node with tag
> >>>> >>>>    /// DW_TAG_compile_unit.
> >>>> >>>>    DwarfCompileUnit &getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit);
> >>>> >>>> +  void finishUnitAttributes(const DICompileUnit *DIUnit,
> >>>> >>>> +                            DwarfCompileUnit &NewCU);
> >>>> >>>>
> >>>> >>>>    /// Construct imported_module or imported_declaration DIE.
> >>>> >>>>    void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)
> >>>> >>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -39,13 +39,14 @@ void DwarfFile::emitUnit(DwarfUnit *TheU
> >>>> >>>>    if (TheU->getCUNode()->isDebugDirectivesOnly())
> >>>> >>>>      return;
> >>>> >>>>
> >>>> >>>> -  DIE &Die = TheU->getUnitDie();
> >>>> >>>> -  MCSection *USection = TheU->getSection();
> >>>> >>>> -  Asm->OutStreamer->SwitchSection(USection);
> >>>> >>>> +  MCSection *S = TheU->getSection();
> >>>> >>>>
> >>>> >>>> -  TheU->emitHeader(UseOffsets);
> >>>> >>>> +  if (!S)
> >>>> >>>> +    return;
> >>>> >>>>
> >>>> >>>> -  Asm->emitDwarfDIE(Die);
> >>>> >>>> +  Asm->OutStreamer->SwitchSection(S);
> >>>> >>>> +  TheU->emitHeader(UseOffsets);
> >>>> >>>> +  Asm->emitDwarfDIE(TheU->getUnitDie());
> >>>> >>>>  }
> >>>> >>>>
> >>>> >>>>  // Compute the size and offset for each DIE.
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
> >>>> >>>> +++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -25,18 +25,18 @@ source_filename = "test/DebugInfo/X86/fi
> >>>> >>>>  ; CHECK: Abbrev table for offset: 0x00000000
> >>>> >>>>  ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no
> >>>> >>>>  ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset
> >>>> >>>> -; CHECK: DW_AT_GNU_dwo_name      DW_FORM_strp
> >>>> >>>>  ; CHECK: DW_AT_comp_dir  DW_FORM_strp
> >>>> >>>> +; CHECK: DW_AT_GNU_dwo_name      DW_FORM_strp
> >>>> >>>>  ; CHECK: DW_AT_GNU_dwo_id        DW_FORM_data8
> >>>> >>>>
> >>>> >>>>  ; Check that we're using the right forms.
> >>>> >>>>  ; CHECK: .debug_abbrev.dwo contents:
> >>>> >>>>  ; CHECK: Abbrev table for offset: 0x00000000
> >>>> >>>>  ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
> >>>> >>>> -; CHECK: DW_AT_GNU_dwo_name  DW_FORM_GNU_str_index
> >>>> >>>>  ; CHECK: DW_AT_producer  DW_FORM_GNU_str_index
> >>>> >>>>  ; CHECK: DW_AT_language  DW_FORM_data2
> >>>> >>>>  ; CHECK: DW_AT_name      DW_FORM_GNU_str_index
> >>>> >>>> +; CHECK: DW_AT_GNU_dwo_name  DW_FORM_GNU_str_index
> >>>> >>>>  ; CHECK-NOT: DW_AT_low_pc
> >>>> >>>>  ; CHECK-NOT: DW_AT_stmt_list
> >>>> >>>>  ; CHECK-NOT: DW_AT_comp_dir
> >>>> >>>> @@ -58,48 +58,48 @@ source_filename = "test/DebugInfo/X86/fi
> >>>> >>>>  ; CHECK: .debug_info contents:
> >>>> >>>>  ; CHECK: DW_TAG_compile_unit
> >>>> >>>>  ; CHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)
> >>>> >>>> -; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
> >>>> >>>> -; CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
> >>>> >>>> +; CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000000] = "/usr/local/google/home/echristo/tmp")
> >>>> >>>> +; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000024] = "baz.dwo")
> >>>> >>>>  ; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
> >>>> >>>>
> >>>> >>>>  ; Check that the rest of the compile units have information.
> >>>> >>>>  ; CHECK: .debug_info.dwo contents:
> >>>> >>>>  ; CHECK: DW_TAG_compile_unit
> >>>> >>>> -; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] ( indexed (00000000) string = "baz.dwo")
> >>>> >>>> -; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000001) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
> >>>> >>>> +; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000002) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
> >>>> >>>>  ; CHECK: DW_AT_language [DW_FORM_data2]        (DW_LANG_C99)
> >>>> >>>> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]    ( indexed (00000002) string = "baz.c")
> >>>> >>>> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]    ( indexed (00000003) string = "baz.c")
> >>>> >>>> +; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "baz.dwo")
> >>>> >>>>  ; CHECK-NOT: DW_AT_low_pc
> >>>> >>>>  ; CHECK-NOT: DW_AT_stmt_list
> >>>> >>>>  ; CHECK-NOT: DW_AT_comp_dir
> >>>> >>>>  ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
> >>>> >>>>  ; CHECK: DW_TAG_variable
> >>>> >>>> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000003) string = "a")
> >>>> >>>> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000000) string = "a")
> >>>> >>>>  ; CHECK: DW_AT_type [DW_FORM_ref4]       (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]}
> >>>> >>>>  ; CHECK: DW_AT_external [DW_FORM_flag_present]   (true)
> >>>> >>>>  ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
> >>>> >>>>  ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
> >>>> >>>>  ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0)
> >>>> >>>>  ; CHECK: [[TYPE]]: DW_TAG_base_type
> >>>> >>>> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000004) string = "int")
> >>>> >>>> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000001) string = "int")
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_str contents:
> >>>> >>>> -; CHECK: 0x00000000: "baz.dwo"
> >>>> >>>> -; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
> >>>> >>>> +; CHECK: 0x00000000: "/usr/local/google/home/echristo/tmp"
> >>>> >>>> +; CHECK: 0x00000024: "baz.dwo"
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_str.dwo contents:
> >>>> >>>> -; CHECK: 0x00000000: "baz.dwo"
> >>>> >>>> -; CHECK: 0x00000008: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
> >>>> >>>> -; CHECK: 0x0000003d: "baz.c"
> >>>> >>>> -; CHECK: 0x00000043: "a"
> >>>> >>>> -; CHECK: 0x00000045: "int"
> >>>> >>>> +; CHECK: 0x00000000: "a"
> >>>> >>>> +; CHECK: 0x00000002: "int"
> >>>> >>>> +; CHECK: 0x00000006: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)"
> >>>> >>>> +; CHECK: 0x0000003b: "baz.c"
> >>>> >>>> +; CHECK: 0x00000041: "baz.dwo"
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_str_offsets.dwo contents:
> >>>> >>>>  ; CHECK: 0x00000000: 00000000
> >>>> >>>> -; CHECK: 0x00000004: 00000008
> >>>> >>>> -; CHECK: 0x00000008: 0000003d
> >>>> >>>> -; CHECK: 0x0000000c: 00000043
> >>>> >>>> -; CHECK: 0x00000010: 00000045
> >>>> >>>> +; CHECK: 0x00000004: 00000002
> >>>> >>>> +; CHECK: 0x00000008: 00000006
> >>>> >>>> +; CHECK: 0x0000000c: 0000003b
> >>>> >>>> +; CHECK: 0x00000010: 00000041
> >>>> >>>>
> >>>> >>>>  ; Object file checks
> >>>> >>>>  ; For x86-64-linux we should have this set of relocations for the debug info section
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-ranges.ll?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/test/DebugInfo/X86/fission-ranges.ll (original)
> >>>> >>>> +++ llvm/trunk/test/DebugInfo/X86/fission-ranges.ll Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -8,8 +8,8 @@
> >>>> >>>>  ; CHECK: .debug_info contents:
> >>>> >>>>  ; CHECK: DW_TAG_compile_unit
> >>>> >>>>  ; CHECK-NEXT: DW_AT_stmt_list
> >>>> >>>> -; CHECK-NEXT: DW_AT_GNU_dwo_name
> >>>> >>>>  ; CHECK-NEXT: DW_AT_comp_dir
> >>>> >>>> +; CHECK-NEXT: DW_AT_GNU_dwo_name
> >>>> >>>>  ; CHECK-NEXT: DW_AT_GNU_dwo_id
> >>>> >>>>  ; CHECK-NEXT: DW_AT_GNU_ranges_base
> >>>> >>>>  ; CHECK-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]                   (0x00000000)
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/test/DebugInfo/X86/string-offsets-table-order.ll
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/string-offsets-table-order.ll?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/test/DebugInfo/X86/string-offsets-table-order.ll (original)
> >>>> >>>> +++ llvm/trunk/test/DebugInfo/X86/string-offsets-table-order.ll Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -13,11 +13,11 @@
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_info contents:
> >>>> >>>>  ; CHECK:   DW_TAG_compile_unit
> >>>> >>>> -; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000001) string = "X3")
> >>>> >>>> +; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000000) string = "X3")
> >>>> >>>>  ; CHECK:   DW_TAG_compile_unit
> >>>> >>>> -; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000002) string = "X2")
> >>>> >>>> +; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000001) string = "X2")
> >>>> >>>>  ; CHECK:   DW_TAG_compile_unit
> >>>> >>>> -; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000003) string = "X1")
> >>>> >>>> +; CHECK:     DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000002) string = "X1")
> >>>> >>>>  ; CHECK: .debug_info.dwo contents:
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_str contents:
> >>>> >>>> @@ -27,10 +27,10 @@
> >>>> >>>>
> >>>> >>>>  ; CHECK: .debug_str_offsets contents:
> >>>> >>>>  ; CHECK: Format = DWARF32, Version = 5
> >>>> >>>> -; CHECK-NEXT: 00000000 "foo.dwo"
> >>>> >>>>  ; CHECK-NEXT: [[X3]] "X3"
> >>>> >>>>  ; CHECK-NEXT: [[X2]] "X2"
> >>>> >>>>  ; CHECK-NEXT: [[X1]] "X1"
> >>>> >>>> +; CHECK-NEXT: "foo.dwo"
> >>>> >>>>  ; CHECK-EMPTY:
> >>>> >>>>
> >>>> >>>>
> >>>> >>>>
> >>>> >>>> Modified: llvm/trunk/test/DebugInfo/X86/string-offsets-table.ll
> >>>> >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/string-offsets-table.ll?rev=349207&r1=349206&r2=349207&view=diff
> >>>> >>>> ==============================================================================
> >>>> >>>> --- llvm/trunk/test/DebugInfo/X86/string-offsets-table.ll (original)
> >>>> >>>> +++ llvm/trunk/test/DebugInfo/X86/string-offsets-table.ll Fri Dec 14 14:44:46 2018
> >>>> >>>> @@ -59,8 +59,8 @@
> >>>> >>>>  ; SPLIT:      DW_TAG_compile_unit
> >>>> >>>>  ; SPLIT-NOT:  {{DW_TAG|contents:}}
> >>>> >>>>  ; SPLIT:      DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
> >>>> >>>> -; SPLIT:      DW_AT_GNU_dwo_name [DW_FORM_strx1] ( indexed (00000000) string = "foo.dwo")
> >>>> >>>> -; SPLIT:      DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000001) string = "/home/test")
> >>>> >>>> +; SPLIT:      DW_AT_comp_dir [DW_FORM_strx1] ( indexed (00000000) string = "/home/test")
> >>>> >>>> +; SPLIT:      DW_AT_GNU_dwo_name [DW_FORM_strx1] ( indexed (00000001) string = "foo.dwo")
> >>>> >>>>
> >>>> >>>>  ; Check for the split CU in .debug_info.dwo.
> >>>> >>>>  ; SPLIT:      .debug_info.dwo contents:
> >>>> >>>> @@ -73,18 +73,18 @@
> >>>> >>>>  ; SPLIT-NOT:  contents:
> >>>> >>>>  ; SPLIT:      DW_TAG_enumerator
> >>>> >>>>  ; SPLIT-NOT:  {{DW_TAG|NULL}}
> >>>> >>>> -; SPLIT:      DW_AT_name [DW_FORM_strx1]    ( indexed (00000004) string = "a")
> >>>> >>>> +; SPLIT:      DW_AT_name [DW_FORM_strx1]    ( indexed (00000001) string = "a")
> >>>> >>>>  ; SPLIT-NOT:  contents:
> >>>> >>>>  ; SPLIT:      DW_TAG_enumerator
> >>>> >>>>  ; SPLIT-NOT:  {{DW_TAG|NULL}}
> >>>> >>>> -; SPLIT:      DW_AT_name [DW_FORM_strx1]    ( indexed (00000005) string = "b")
> >>>> >>>> +; SPLIT:      DW_AT_name [DW_FORM_strx1]    ( indexed (00000002) string = "b")
> >>>> >>>>  ;
> >>>> >>>>  ; Extract the string offsets referenced in the main file by the skeleton unit.
> >>>> >>>>  ; SPLIT:      .debug_str contents:
> >>>> >>>> -; SPLIT-NEXT: 0x00000000: "foo.dwo"
> >>>> >>>> -; SPLIT-NEXT: 0x[[STRING2SPLIT:[0-9a-f]*]]: "/home/test"
> >>>> >>>> -; SPLIT-NEXT: 0x[[STRING3SPLIT:[0-9a-f]*]]: "E"
> >>>> >>>> -; SPLIT-NEXT: 0x[[STRING4SPLIT:[0-9a-f]*]]: "glob"
> >>>> >>>> +; SPLIT-NEXT: 0x[[STRHOMETESTSPLIT:[0-9a-f]*]]: "/home/test"
> >>>> >>>> +; SPLIT-NEXT: 0x[[STRESPLIT:[0-9a-f]*]]: "E"
> >>>> >>>> +; SPLIT-NEXT: 0x[[STRGLOBSPLIT:[0-9a-f]*]]: "glob"
> >>>> >>>> +; SPLIT-NEXT: 0x[[STRFOODWOSPLIT:[0-9a-f]*]]: "foo.dwo"
> >>>> >>>>  ;
> >>>> >>>>  ; Extract the string offsets referenced in the .dwo file by the split unit.
> >>>> >>>>  ; SPLIT:      .debug_str.dwo contents:
> >>>> >>>> @@ -98,8 +98,8 @@
> >>>> >>>>  ; referenced by the debug info.
> >>>> >>>>  ; SPLIT:      .debug_str_offsets contents:
> >>>> >>>>  ; SPLIT-NEXT: 0x00000000: Contribution size = 12, Format = DWARF32, Version = 5
> >>>> >>>> -; SPLIT-NEXT: 0x00000008: 00000000 "foo.dwo"
> >>>> >>>> -; SPLIT-NEXT: 0x0000000c: [[STRING2SPLIT]] "/home/test"
> >>>> >>>> +; SPLIT-NEXT: 0x00000008: [[STRHOMETESTSPLIT]] "/home/test"
> >>>> >>>> +; SPLIT-NEXT: 0x0000000c: [[STRFOODWOSPLIT]] "foo.dwo"
> >>>> >>>>  ; SPLIT-EMPTY:
> >>>> >>>>
> >>>> >>>>  ; SPLIT:      .debug_str_offsets.dwo contents:
> >>>> >>>>
> >>>> >>>>
> >>>> >>>> _______________________________________________
> >>>> >>>> llvm-commits mailing list
> >>>> >>>> llvm-commits at lists.llvm.org
> >>>> >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >>>> >
> >>>> > _______________________________________________
> >>>> > llvm-commits mailing list
> >>>> > llvm-commits at lists.llvm.org
> >>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list