clEnumValN(EABI::EABI5, "5", "EABI version 5"),
clEnumValN(EABI::GNU, "gnu", "EABI GNU"), clEnumValEnd));
+cl::opt<DebuggerKind>
+DebuggerTuningOpt("debugger-tune",
+ cl::desc("Tune debug info for a particular debugger"),
+ cl::init(DebuggerKind::Default),
+ cl::values(
+ clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
+ clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
+ clEnumValN(DebuggerKind::SCE, "sce",
+ "SCE targets (e.g. PS4)"),
+ clEnumValEnd));
+
// Common utility function tightly tied to the options listed here. Initializes
// a TargetOptions object with CodeGen flags and returns it.
static inline TargetOptions InitTargetOptionsFromCodeGenFlags() {
Options.ThreadModel = TMModel;
Options.EABIVersion = EABIVersion;
+ Options.DebuggerTuning = DebuggerTuningOpt;
return Options;
}
GNU
};
+ /// Identify a debugger for "tuning" the debug info.
+ ///
+ /// The "debugger tuning" concept allows us to present a more intuitive
+ /// interface that unpacks into different sets of defaults for the various
+ /// individual feature-flag settings, that suit the preferences of the
+ /// various debuggers. However, it's worth remembering that debuggers are
+ /// not the only consumers of debug info, and some variations in DWARF might
+ /// better be treated as target/platform issues. Fundamentally,
+ /// o if the feature is useful (or not) to a particular debugger, regardless
+ /// of the target, that's a tuning decision;
+ /// o if the feature is useful (or not) on a particular platform, regardless
+ /// of the debugger, that's a target decision.
+ /// It's not impossible to see both factors in some specific case.
+ ///
+ /// The "tuning" should be used to set defaults for individual feature flags
+ /// in DwarfDebug; if a given feature has a more specific command-line option,
+ /// that option should take precedence over the tuning.
+ enum class DebuggerKind {
+ Default, // No specific tuning requested.
+ GDB, // Tune debug info for gdb.
+ LLDB, // Tune debug info for lldb.
+ SCE // Tune debug info for SCE targets (e.g. PS4).
+ };
+
class TargetOptions {
public:
TargetOptions()
EmulatedTLS(false), FloatABIType(FloatABI::Default),
AllowFPOpFusion(FPOpFusion::Standard), Reciprocals(TargetRecip()),
JTType(JumpTable::Single), ThreadModel(ThreadModel::POSIX),
- EABIVersion(EABI::Default) {}
+ EABIVersion(EABI::Default), DebuggerTuning(DebuggerKind::Default) {}
/// PrintMachineCode - This flag is enabled when the -print-machineinstrs
/// option is specified on the command line, and should enable debugging
/// EABIVersion - This flag specifies the EABI version
EABI EABIVersion;
+ /// Which debugger to tune for.
+ DebuggerKind DebuggerTuning;
+
/// Machine level options.
MCTargetOptions MCOptions;
};
ARE_EQUAL(JTType) &&
ARE_EQUAL(ThreadModel) &&
ARE_EQUAL(EABIVersion) &&
+ ARE_EQUAL(DebuggerTuning) &&
ARE_EQUAL(MCOptions);
#undef ARE_EQUAL
}
cl::desc("Generate dwarf aranges"),
cl::init(false));
-static cl::opt<DebuggerKind>
-DebuggerTuningOpt("debugger-tune",
- cl::desc("Tune debug info for a particular debugger"),
- cl::init(DebuggerKind::Default),
- cl::values(
- clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
- clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
- clEnumValN(DebuggerKind::SCE, "sce",
- "SCE targets (e.g. PS4)"),
- clEnumValEnd));
-
namespace {
enum DefaultOnOff { Default, Enable, Disable };
}
CurMI = nullptr;
Triple TT(Asm->getTargetTriple());
- // Make sure we know our "debugger tuning." The command-line option takes
+ // Make sure we know our "debugger tuning." The target option takes
// precedence; fall back to triple-based defaults.
- if (DebuggerTuningOpt != DebuggerKind::Default)
- DebuggerTuning = DebuggerTuningOpt;
+ if (Asm->TM.Options.DebuggerTuning != DebuggerKind::Default)
+ DebuggerTuning = Asm->TM.Options.DebuggerTuning;
else if (IsDarwin || TT.isOSFreeBSD())
DebuggerTuning = DebuggerKind::LLDB;
else if (TT.isPS4CPU())
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Target/TargetOptions.h"
#include <memory>
namespace llvm {
DwarfCompileUnit *CU;
};
-/// Identify a debugger for "tuning" the debug info.
-///
-/// The "debugger tuning" concept allows us to present a more intuitive
-/// interface that unpacks into different sets of defaults for the various
-/// individual feature-flag settings, that suit the preferences of the
-/// various debuggers. However, it's worth remembering that debuggers are
-/// not the only consumers of debug info, and some variations in DWARF might
-/// better be treated as target/platform issues. Fundamentally,
-/// o if the feature is useful (or not) to a particular debugger, regardless
-/// of the target, that's a tuning decision;
-/// o if the feature is useful (or not) on a particular platform, regardless
-/// of the debugger, that's a target decision.
-/// It's not impossible to see both factors in some specific case.
-///
-/// The "tuning" should be used to set defaults for individual feature flags
-/// in DwarfDebug; if a given feature has a more specific command-line option,
-/// that option should take precedence over the tuning.
-enum class DebuggerKind {
- Default, // No specific tuning requested.
- GDB, // Tune debug info for gdb.
- LLDB, // Tune debug info for lldb.
- SCE // Tune debug info for SCE targets (e.g. PS4).
-};
-
/// Collects and handles dwarf debug information.
class DwarfDebug : public AsmPrinterHandler {
/// Target of Dwarf emission.