[PATCH] Set a debugger "target" to guide DWARF choices
Paul Robinson
Paul_Robinson at playstation.sony.com
Wed May 6 15:53:58 PDT 2015
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:211-219
@@ -211,1 +210,11 @@
+ // Make sure we know our "debugger tuning."
+ if (Asm->TM.Options.DebuggerTuning == DebuggerKind::Default) {
+ if (IsDarwin)
+ Asm->TM.Options.DebuggerTuning = DebuggerKind::LLDB;
+ else if (Triple(A->getTargetTriple()).isPS4CPU())
+ Asm->TM.Options.DebuggerTuning = DebuggerKind::SCE;
+ else
+ Asm->TM.Options.DebuggerTuning = DebuggerKind::GDB;
+ }
+
----------------
echristo wrote:
> I might have lost this part of the discussion but I thought the default was "no tuning"?
>
> At least not in the backend.
That did come up, and it was not clear what it should mean, so I fell back on preserving the prior behavior, which effectively defaults to GDB except for Darwin and PS4.
So, what would no-tuning mean? "No non-standard things" seems reasonably clear, but should it include all the optional-but-standard things that LLVM knows how to do? Which I guess would be pubnames + aranges + type units (are there more?).
It would smoke out all the tests that have been relying on the triple to get the right effect, though, which could be viewed as a Good Thing.
Presumably you'd want Clang to tell LLVM what tuning to use, though? Having Clang default to "no tuning" seems user-hostile.
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:224
@@ -214,3 +223,3 @@
if (DwarfAccelTables == Default)
HasDwarfAccelTables = IsDarwin;
else
----------------
Should this become tuneDebugForLLDB()?
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:234
@@ -224,3 +233,3 @@
if (DwarfPubSections == Default)
- HasDwarfPubSections = !IsDarwin && !IsPS4;
+ HasDwarfPubSections = !IsDarwin && !tuneDebugForSCE();
else
----------------
echristo wrote:
> This should be simplified to tuneDebugForGDB().
Okay. Not being Darwin-aware or an LLDB user, I was a bit reluctant to convert all the Darwin decision-making right away.
================
Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:244
@@ -236,1 +243,3 @@
+ // and GDB always wants the GNU opcode.
+ UseGNUTLSOpcode = DwarfVersion < 3 || tuneDebugForGDB();
----------------
echristo wrote:
> I don't think this is a tuning option, and that's the problem. This is a correctness issue in that it just won't work rather than being inefficient or superfluous.
Yeah, trying to work around a GDB bug. GDB can't tolerate the standard opcode; SCE can't tolerate the GNU opcode; I don't know what LLDB thinks, but Adrian liked having the standard opcode.
Do you have an alternate suggestion? Leaving it target-based seems worse, except for the historical consistency.
================
Comment at: test/DebugInfo/X86/dwarf-public-names.ll:7-10
@@ -6,1 +6,6 @@
; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=NOPUB %s
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=sce -filetype=obj -o %t.o < %s
+; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=NOPUB %s
+; RUN: llc -mtriple=x86_64-scei-ps4 -debugger-tune=gdb -filetype=obj -o %t.o < %s
+; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=LINUX %s
+
----------------
echristo wrote:
> I think I'd like this split out into a different test file.
Ironically, this is one of the tests that would break if LLVM defaulted to no-tuning; the triples would need to be replaced by tuning options. And if tuning isn't premised on the triple, then the non-default triple/tuning combos wouldn't need testing, and the new RUN lines would just go away.
http://reviews.llvm.org/D8506
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list