mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
DWARFv5: Disable DW_OP_convert for configurations that don't yet support it
Testing reveals that lldb and gdb have some problems with supporting DW_OP_convert - gdb with Split DWARF tries to resolve the CU-relative DIE offset relative to the skeleton DIE. lldb tries to treat the offset as absolute, which judging by the llvm-dsymutil support for DW_OP_convert, I guess works OK in MachO? (though probably llvm-dsymutil is producing invalid DWARF by resolving the relative reference to an absolute one?). Specifically this disables DW_OP_convert usage in DWARFv5 if: * Tuning for GDB and using Split DWARF * Tuning for LLDB and not targeting MachO
This commit is contained in:
parent
42624a2b20
commit
8b9f3c8506
@ -132,6 +132,13 @@ static cl::opt<bool>
|
||||
cl::desc("Emit the GNU .debug_macro format with DWARF <5"),
|
||||
cl::init(false));
|
||||
|
||||
static cl::opt<DefaultOnOff> DwarfOpConvert(
|
||||
"dwarf-op-convert", cl::Hidden,
|
||||
cl::desc("Enable use of the DWARFv5 DW_OP_convert operator"),
|
||||
cl::values(clEnumVal(Default, "Default for platform"),
|
||||
clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
enum LinkageNameOption {
|
||||
DefaultLinkageNames,
|
||||
AllLinkageNames,
|
||||
@ -417,6 +424,10 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
||||
// for split DWARF. For now, do not allow LLVM to emit it.
|
||||
UseDebugMacroSection =
|
||||
DwarfVersion >= 5 || (UseGNUDebugMacro && !useSplitDwarf());
|
||||
if (DwarfOpConvert == Default)
|
||||
EnableOpConvert = !((tuneForGDB() && useSplitDwarf()) || (tuneForLLDB() && !TT.isOSBinFormatMachO()));
|
||||
else
|
||||
EnableOpConvert = (DwarfOpConvert == Enable);
|
||||
|
||||
Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
|
||||
Asm->OutStreamer->getContext().setDwarfFormat(Dwarf64 ? dwarf::DWARF64
|
||||
|
@ -375,6 +375,9 @@ class DwarfDebug : public DebugHandlerBase {
|
||||
/// Emit a .debug_macro section instead of .debug_macinfo.
|
||||
bool UseDebugMacroSection;
|
||||
|
||||
/// Avoid using DW_OP_convert due to consumer incompatibilities.
|
||||
bool EnableOpConvert;
|
||||
|
||||
/// DWARF5 Experimental Options
|
||||
/// @{
|
||||
AccelTableKind TheAccelTableKind;
|
||||
@ -724,6 +727,10 @@ public:
|
||||
return EmitDebugEntryValues;
|
||||
}
|
||||
|
||||
bool useOpConvert() const {
|
||||
return EnableOpConvert;
|
||||
}
|
||||
|
||||
bool shareAcrossDWOCUs() const;
|
||||
|
||||
/// Returns the Dwarf Version.
|
||||
|
@ -544,7 +544,7 @@ void DwarfExpression::addExpression(DIExpressionCursor &&ExprCursor,
|
||||
case dwarf::DW_OP_LLVM_convert: {
|
||||
unsigned BitSize = Op->getArg(0);
|
||||
dwarf::TypeKind Encoding = static_cast<dwarf::TypeKind>(Op->getArg(1));
|
||||
if (DwarfVersion >= 5) {
|
||||
if (DwarfVersion >= 5 && CU.getDwarfDebug().useOpConvert()) {
|
||||
emitOp(dwarf::DW_OP_convert);
|
||||
// If targeting a location-list; simply emit the index into the raw
|
||||
// byte stream as ULEB128, DwarfDebug::emitDebugLocEntry has been
|
||||
|
@ -82,6 +82,7 @@ public:
|
||||
MCSymbol *getEndLabel() const { return EndLabel; }
|
||||
uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
|
||||
const DICompileUnit *getCUNode() const { return CUNode; }
|
||||
DwarfDebug &getDwarfDebug() const { return *DD; }
|
||||
|
||||
/// Return true if this compile unit has something to write out.
|
||||
bool hasContent() const { return getUnitDie().hasChildren(); }
|
||||
|
@ -1,47 +1,63 @@
|
||||
; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=DW5 "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
; RUN: %llc_dwarf -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=DW4 "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
|
||||
; DW5: .debug_info contents:
|
||||
; DW5: DW_TAG_compile_unit
|
||||
; DW5:[[SIG8:.*]]: DW_TAG_base_type
|
||||
; DW5-NEXT:DW_AT_name ("DW_ATE_signed_8")
|
||||
; DW5-NEXT:DW_AT_encoding (DW_ATE_signed)
|
||||
; DW5-NEXT:DW_AT_byte_size (0x01)
|
||||
; DW5-NOT: DW_AT
|
||||
; DW5:[[SIG32:.*]]: DW_TAG_base_type
|
||||
; DW5-NEXT:DW_AT_name ("DW_ATE_signed_32")
|
||||
; DW5-NEXT:DW_AT_encoding (DW_ATE_signed)
|
||||
; DW5-NEXT:DW_AT_byte_size (0x04)
|
||||
; DW5-NOT: DW_AT
|
||||
; DW5: DW_TAG_subprogram
|
||||
; DW5: DW_TAG_formal_parameter
|
||||
; DW5: DW_TAG_variable
|
||||
; DW5: DW_AT_location (
|
||||
; DW5: {{.*}}, DW_OP_convert ([[SIG8]]) "DW_ATE_signed_8", DW_OP_convert ([[SIG32]]) "DW_ATE_signed_32", DW_OP_stack_value)
|
||||
; DW5: DW_AT_name ("y")
|
||||
; DW5: NULL
|
||||
; DW5: DW_TAG_base_type
|
||||
; DW5: DW_AT_name ("signed char")
|
||||
; DW5: DW_TAG_base_type
|
||||
; DW5: DW_AT_name ("int")
|
||||
; DW5: NULL
|
||||
; Test lldb default: OP_convert is unsupported in general
|
||||
; RUN: %llc_dwarf -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
; RUN: %llc_dwarf -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
|
||||
; DW4: .debug_info contents:
|
||||
; DW4: DW_TAG_compile_unit
|
||||
; DW4: DW_TAG_subprogram
|
||||
; DW4: DW_TAG_formal_parameter
|
||||
; DW4: DW_TAG_variable
|
||||
; DW4: DW_AT_location (
|
||||
; DW4: {{.*}}, DW_OP_dup, DW_OP_constu 0x7, DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_constu 0x8, DW_OP_shl, DW_OP_or, DW_OP_stack_value)
|
||||
; DW4: DW_AT_name ("y")
|
||||
; DW4: NULL
|
||||
; DW4: DW_TAG_base_type
|
||||
; DW4: DW_AT_name ("signed char")
|
||||
; DW4: DW_TAG_base_type
|
||||
; DW4: DW_AT_name ("int")
|
||||
; DW4: NULL
|
||||
; Test gdb default: OP_convert is only disabled in split DWARF
|
||||
; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=NOCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
|
||||
; Test the ability to override the platform default in either direction
|
||||
; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -dwarf-op-convert=Disable | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable | llvm-dwarfdump - \
|
||||
; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
|
||||
|
||||
; SPLIT: DW_TAG_skeleton_unit
|
||||
|
||||
; CONV: DW_TAG_compile_unit
|
||||
; CONV:[[SIG8:.*]]: DW_TAG_base_type
|
||||
; CONV-NEXT:DW_AT_name ("DW_ATE_signed_8")
|
||||
; CONV-NEXT:DW_AT_encoding (DW_ATE_signed)
|
||||
; CONV-NEXT:DW_AT_byte_size (0x01)
|
||||
; CONV-NOT: DW_AT
|
||||
; CONV:[[SIG32:.*]]: DW_TAG_base_type
|
||||
; CONV-NEXT:DW_AT_name ("DW_ATE_signed_32")
|
||||
; CONV-NEXT:DW_AT_encoding (DW_ATE_signed)
|
||||
; CONV-NEXT:DW_AT_byte_size (0x04)
|
||||
; CONV-NOT: DW_AT
|
||||
; CONV: DW_TAG_subprogram
|
||||
; CONV: DW_TAG_formal_parameter
|
||||
; CONV: DW_TAG_variable
|
||||
; CONV: DW_AT_location (
|
||||
; CONV: {{.*}}, DW_OP_convert ([[SIG8]]) "DW_ATE_signed_8", DW_OP_convert ([[SIG32]]) "DW_ATE_signed_32", DW_OP_stack_value)
|
||||
; CONV: DW_AT_name ("y")
|
||||
; CONV: NULL
|
||||
; CONV: DW_TAG_base_type
|
||||
; CONV: DW_AT_name ("signed char")
|
||||
; CONV: DW_TAG_base_type
|
||||
; CONV: DW_AT_name ("int")
|
||||
; CONV: NULL
|
||||
|
||||
; NOCONV: DW_TAG_compile_unit
|
||||
; NOCONV: DW_TAG_subprogram
|
||||
; NOCONV: DW_TAG_formal_parameter
|
||||
; NOCONV: DW_TAG_variable
|
||||
; NOCONV: DW_AT_location (
|
||||
; NOCONV: {{.*}}, DW_OP_dup, DW_OP_constu 0x7, DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_constu 0x8, DW_OP_shl, DW_OP_or, DW_OP_stack_value)
|
||||
; NOCONV: DW_AT_name ("y")
|
||||
; NOCONV: NULL
|
||||
; NOCONV: DW_TAG_base_type
|
||||
; NOCONV: DW_AT_name ("signed char")
|
||||
; NOCONV: DW_TAG_base_type
|
||||
; NOCONV: DW_AT_name ("int")
|
||||
; NOCONV: NULL
|
||||
|
||||
|
||||
; Function Attrs: noinline nounwind uwtable
|
||||
|
@ -1,8 +1,8 @@
|
||||
; RUN: %llc_dwarf -filetype=obj < %s \
|
||||
; RUN: | llvm-dwarfdump -debug-info -debug-loclists - | FileCheck %s
|
||||
; RUN: llc -mtriple x86_64-pc-linux -split-dwarf-file=foo.dwo -filetype=obj < %s \
|
||||
; RUN: llc -mtriple x86_64-pc-linux -split-dwarf-file=foo.dwo -filetype=obj -dwarf-op-convert=Enable < %s \
|
||||
; RUN: | llvm-dwarfdump -debug-info -debug-loclists - | FileCheck --check-prefix=SPLIT --check-prefix=CHECK %s
|
||||
; RUN: llc -mtriple x86_64-pc-linux -split-dwarf-file=foo.dwo -filetype=asm < %s \
|
||||
; RUN: llc -mtriple x86_64-pc-linux -split-dwarf-file=foo.dwo -filetype=asm -dwarf-op-convert=Enable < %s \
|
||||
; RUN: | FileCheck --check-prefix=ASM %s
|
||||
|
||||
; A bit of a brittle test - this is testing the specific DWO_id. The
|
||||
|
Loading…
Reference in New Issue
Block a user