[llvm] r358931 - DebugInfo: Emit only one kind of accelerated access/name table

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 13:35:43 PDT 2019


Thanks, I'll take a look (tracked by rdar://problem/50142073 <rdar://problem/50142073>).

-- adrian

> On Apr 23, 2019, at 1:14 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Recommitted as r359026 with a fix for DICompileUnit's
> nameTableKind:GNU so it no longer suppresses names in apple_names.
> 
> But I suspect/encourage someone at Apple to check whether they are
> accidentally getting gnu_pubnames/types in Darwin object files by
> default that they probably don't want/need.
> 
> I think this might be a reasonable patch:
> 
> --- lib/Driver/ToolChains/Clang.cpp
> +++ lib/Driver/ToolChains/Clang.cpp
> @@ -3332,15 +3332,15 @@ static void RenderDebugOptions(const ToolChain
> &TC, const Driver &D,
>       Args.getLastArg(options::OPT_ggnu_pubnames,
> options::OPT_gno_gnu_pubnames,
>                       options::OPT_gpubnames, options::OPT_gno_pubnames);
>   if (DwarfFission != DwarfFissionKind::None ||
> -      DebuggerTuning == llvm::DebuggerKind::LLDB ||
>       (PubnamesArg && checkDebugInfoOption(PubnamesArg, Args, D, TC)))
>     if (!PubnamesArg ||
>         (!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&
>          !PubnamesArg->getOption().matches(options::OPT_gno_pubnames)))
> -      CmdArgs.push_back(PubnamesArg && PubnamesArg->getOption().matches(
> -                                           options::OPT_gpubnames)
> -                            ? "-gpubnames"
> -                            : "-ggnu-pubnames");
> +      CmdArgs.push_back((PubnamesArg && PubnamesArg->getOption().matches(
> +                                            options::OPT_ggnu_pubnames)) ||
> +                                DwarfFission != DwarfFissionKind::None
> +                            ? "-ggnu-pubnames"
> +                            : "-gpubnames");
> 
> 
> (really two different things here - just removing the "DebuggerTuning
> == LLDB" case is probably all that's required to remove the
> surprising/probably wrong name table on LLDB platforms - the other
> change, I guess just amounts to a different way to write the same
> thing at that point (once the LLDB case is removed))
> 
> On Tue, Apr 23, 2019 at 11:43 AM David Blaikie <dblaikie at gmail.com> wrote:
>> 
>> Hmm, so that's curious. At least when I target darwin from linux (& it
>> looks like this'd be the same regardless of host) the Clang driver
>> passes -ggnu-pubnames down, and so the IR ends up with DICompileUnit's
>> nameTableKind:GNU. And looking at the resulting objects they have both
>> apple_names and gnu_pubnames and pubtypes.
>> 
>> Adrian - do you see that too? Is that the case, that Apple platforms
>> are getting what would appear to be by accident,
>> debug_gnu_pubnames/pubtypes?
>> 
>> (that's a driver/frontend issue - and, yeah, regardless of whether
>> that bug happens, LLVM still shouldn't respect the nameTableKind if
>> LLVM's emitting apple names - because Apple names can't support a
>> missing CU, it has to cover all the CUs in the object. So I have a fix
>> for that bit, and need some test coverage. But I feel like there's a
>> frontend bug for Apple platforms too)
>> 
>> On Tue, Apr 23, 2019 at 8:18 AM Adrian Prantl <aprantl at apple.com> wrote:
>>> 
>>> Thanks! Let me know if you need any help with the analysis.
>>> 
>>> -- adrian
>>> 
>>>> On Apr 23, 2019, at 8:02 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>>> 
>>>> (oops, this time on-list)
>>>> 
>>>> Yep, I can observe a change in size of apple_names under this patch.
>>>> Reverted in r358997 while I investigate.
>>>> 
>>>> On Mon, Apr 22, 2019 at 7:11 PM Adrian Prantl <aprantl at apple.com> wrote:
>>>>> 
>>>>> I haven't tried to reproduce the failure yet, but do you think it's possible this caused the debuginfo-tests to fail?
>>>>> 
>>>>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/55815/
>>>>> 
>>>>> It seems to be the only non-NFC change in the blamelist.
>>>>> 
>>>>> -- adrian
>>>>> 
>>>>> On Apr 22, 2019, at 3:45 PM, David Blaikie via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>>>> 
>>>>> Author: dblaikie
>>>>> Date: Mon Apr 22 15:45:11 2019
>>>>> New Revision: 358931
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=358931&view=rev
>>>>> Log:
>>>>> DebugInfo: Emit only one kind of accelerated access/name table
>>>>> 
>>>>> Currently to opt in to debug_names in DWARFv5, the IR must contain
>>>>> 'nameTableKind: Default' which also enables debug_pubnames.
>>>>> 
>>>>> Instead, only allow one of {debug_names, apple_names, debug_pubnames,
>>>>> debug_gnu_pubnames}.
>>>>> 
>>>>> nameTableKind: Default gives debug_names in DWARFv5 and greater,
>>>>> debug_pubnames in v4 and earlier - and apple_names when tuning for lldb
>>>>> on MachO.
>>>>> nameTableKind: GNU always gives gnu_pubnames
>>>>> 
>>>>> Added:
>>>>>  llvm/trunk/test/DebugInfo/X86/gnu-names.ll
>>>>>    - copied, changed from r358805, llvm/trunk/test/DebugInfo/X86/accel-tables.ll
>>>>> Modified:
>>>>>  llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
>>>>>  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>>>>  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>>>  llvm/trunk/test/DebugInfo/X86/accel-tables.ll
>>>>> 
>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp?rev=358931&r1=358930&r2=358931&view=diff
>>>>> ==============================================================================
>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp (original)
>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp Mon Apr 22 15:45:11 2019
>>>>> @@ -556,8 +556,8 @@ void llvm::emitDWARF5AccelTable(
>>>>> SmallVector<unsigned, 1> CUIndex(CUs.size());
>>>>> int Count = 0;
>>>>> for (const auto &CU : enumerate(CUs)) {
>>>>> -    if (CU.value()->getCUNode()->getNameTableKind() ==
>>>>> -        DICompileUnit::DebugNameTableKind::None)
>>>>> +    if (CU.value()->getCUNode()->getNameTableKind() !=
>>>>> +        DICompileUnit::DebugNameTableKind::Default)
>>>>>     continue;
>>>>>   CUIndex[CU.index()] = Count++;
>>>>>   assert(CU.index() == CU.value()->getUniqueID());
>>>>> 
>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=358931&r1=358930&r2=358931&view=diff
>>>>> ==============================================================================
>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Apr 22 15:45:11 2019
>>>>> @@ -1036,7 +1036,9 @@ bool DwarfCompileUnit::hasDwarfPubSectio
>>>>>   return true;
>>>>> case DICompileUnit::DebugNameTableKind::Default:
>>>>>   return DD->tuneForGDB() && !includeMinimalInlineScopes() &&
>>>>> -           !CUNode->isDebugDirectivesOnly();
>>>>> +           !CUNode->isDebugDirectivesOnly() &&
>>>>> +           DD->getAccelTableKind() != AccelTableKind::Apple &&
>>>>> +           DD->getDwarfVersion() < 5;
>>>>> }
>>>>> llvm_unreachable("Unhandled DICompileUnit::DebugNameTableKind enum");
>>>>> }
>>>>> 
>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=358931&r1=358930&r2=358931&view=diff
>>>>> ==============================================================================
>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Apr 22 15:45:11 2019
>>>>> @@ -2765,6 +2765,9 @@ void DwarfDebug::addAccelNameImpl(const
>>>>>     CU.getNameTableKind() == DICompileUnit::DebugNameTableKind::None)
>>>>>   return;
>>>>> 
>>>>> +  if (CU.getNameTableKind() == DICompileUnit::DebugNameTableKind::GNU)
>>>>> +    return;
>>>>> +
>>>>> DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
>>>>> DwarfStringPoolEntryRef Ref = Holder.getStringPool().getEntry(*Asm, Name);
>>>>> 
>>>>> 
>>>>> Modified: llvm/trunk/test/DebugInfo/X86/accel-tables.ll
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/accel-tables.ll?rev=358931&r1=358930&r2=358931&view=diff
>>>>> ==============================================================================
>>>>> --- llvm/trunk/test/DebugInfo/X86/accel-tables.ll (original)
>>>>> +++ llvm/trunk/test/DebugInfo/X86/accel-tables.ll Mon Apr 22 15:45:11 2019
>>>>> @@ -4,11 +4,11 @@
>>>>> ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
>>>>> ; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
>>>>> ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
>>>>> -; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
>>>>> +; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=PUB %s
>>>>> 
>>>>> ; Linux does has debug_names tables only if we explicitly tune for lldb
>>>>> ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
>>>>> -; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
>>>>> +; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=PUB %s
>>>>> ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
>>>>> ; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=DEBUG_NAMES %s
>>>>> 
>>>>> @@ -23,15 +23,25 @@
>>>>> ; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
>>>>> 
>>>>> ; APPLE-NOT: debug_names
>>>>> +; APPLE-NOT: pubnames
>>>>> ; APPLE: apple_names
>>>>> ; APPLE-NOT: debug_names
>>>>> +; APPLE-NOT: pubnames
>>>>> +
>>>>> +; PUB-NOT: apple_names
>>>>> +; PUB-NOT: debug_names
>>>>> +; PUB: pubnames
>>>>> +; PUB-NOT: apple_names
>>>>> +; PUB-NOT: debug_names
>>>>> 
>>>>> ; NONE-NOT: apple_names
>>>>> ; NONE-NOT: debug_names
>>>>> 
>>>>> ; DEBUG_NAMES-NOT: apple_names
>>>>> +; DEBUG_NAMES-NOT: pubnames
>>>>> ; DEBUG_NAMES: debug_names
>>>>> ; DEBUG_NAMES-NOT: apple_names
>>>>> +; DEBUG_NAMES-NOT: pubnames
>>>>> 
>>>>> @var = thread_local global i32 0, align 4, !dbg !0
>>>>> 
>>>>> 
>>>>> Copied: llvm/trunk/test/DebugInfo/X86/gnu-names.ll (from r358805, llvm/trunk/test/DebugInfo/X86/accel-tables.ll)
>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/gnu-names.ll?p2=llvm/trunk/test/DebugInfo/X86/gnu-names.ll&p1=llvm/trunk/test/DebugInfo/X86/accel-tables.ll&r1=358805&r2=358931&rev=358931&view=diff
>>>>> ==============================================================================
>>>>> --- llvm/trunk/test/DebugInfo/X86/accel-tables.ll (original)
>>>>> +++ llvm/trunk/test/DebugInfo/X86/gnu-names.ll Mon Apr 22 15:45:11 2019
>>>>> @@ -4,13 +4,13 @@
>>>>> ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
>>>>> ; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
>>>>> ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
>>>>> -; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
>>>>> +; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
>>>>> 
>>>>> ; Linux does has debug_names tables only if we explicitly tune for lldb
>>>>> ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
>>>>> -; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
>>>>> +; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
>>>>> ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
>>>>> -; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=DEBUG_NAMES %s
>>>>> +; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
>>>>> 
>>>>> ; No accelerator tables if type units are enabled, as DWARF v4 type units are
>>>>> ; not compatible with accelerator tables.
>>>>> @@ -23,16 +23,20 @@
>>>>> ; RUN:   | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
>>>>> 
>>>>> ; APPLE-NOT: debug_names
>>>>> +; APPLE-NOT: pubnames
>>>>> ; APPLE: apple_names
>>>>> ; APPLE-NOT: debug_names
>>>>> +; APPLE-NOT: pubnames
>>>>> +
>>>>> +; GNU-NOT: apple_names
>>>>> +; GNU-NOT: debug_names
>>>>> +; GNU: gnu_pub
>>>>> +; GNU-NOT: apple_names
>>>>> +; GNU-NOT: debug_names
>>>>> 
>>>>> ; NONE-NOT: apple_names
>>>>> ; NONE-NOT: debug_names
>>>>> 
>>>>> -; DEBUG_NAMES-NOT: apple_names
>>>>> -; DEBUG_NAMES: debug_names
>>>>> -; DEBUG_NAMES-NOT: apple_names
>>>>> -
>>>>> @var = thread_local global i32 0, align 4, !dbg !0
>>>>> 
>>>>> ; Function Attrs: norecurse nounwind readnone uwtable
>>>>> @@ -54,7 +58,7 @@ attributes #1 = { norecurse uwtable }
>>>>> 
>>>>> !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
>>>>> !1 = distinct !DIGlobalVariable(name: "var", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
>>>>> -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
>>>>> +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)
>>>>> !3 = !DIFile(filename: "debugger-tune.cpp", directory: "/tmp")
>>>>> !4 = !{}
>>>>> !5 = !{!0}
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at lists.llvm.org
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>>> 
>>>>> 
>>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190423/0f6ec3c1/attachment.html>


More information about the llvm-commits mailing list