forked from OSchip/llvm-project
IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.
This allows the flag to be persisted through to LTO. Differential Revision: https://reviews.llvm.org/D37655 llvm-svn: 313078
This commit is contained in:
parent
e4dacb750d
commit
b52e23669c
|
@ -1596,7 +1596,7 @@ def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group<g_flags_Group>;
|
||||||
def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
|
def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
|
||||||
def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
|
def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
|
||||||
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
|
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
|
||||||
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
|
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>, Flags<[CC1Option]>;
|
||||||
def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
|
def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
|
||||||
def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
|
def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
|
||||||
HelpText<"Generate debug info with external references to clang modules"
|
HelpText<"Generate debug info with external references to clang modules"
|
||||||
|
|
|
@ -287,6 +287,9 @@ CODEGENOPT(DebugInfoForProfiling, 1, 0)
|
||||||
/// Whether 3-component vector type is preserved.
|
/// Whether 3-component vector type is preserved.
|
||||||
CODEGENOPT(PreserveVec3Type, 1, 0)
|
CODEGENOPT(PreserveVec3Type, 1, 0)
|
||||||
|
|
||||||
|
/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
|
||||||
|
CODEGENOPT(GnuPubnames, 1, 0)
|
||||||
|
|
||||||
#undef CODEGENOPT
|
#undef CODEGENOPT
|
||||||
#undef ENUM_CODEGENOPT
|
#undef ENUM_CODEGENOPT
|
||||||
#undef VALUE_CODEGENOPT
|
#undef VALUE_CODEGENOPT
|
||||||
|
|
|
@ -562,7 +562,8 @@ void CGDebugInfo::CreateCompileUnit() {
|
||||||
Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
|
Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
|
||||||
CGOpts.DwarfDebugFlags, RuntimeVers,
|
CGOpts.DwarfDebugFlags, RuntimeVers,
|
||||||
CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
|
CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
|
||||||
0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling);
|
0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling,
|
||||||
|
CGOpts.GnuPubnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
|
llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
|
||||||
|
|
|
@ -2952,10 +2952,8 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
|
||||||
CmdArgs.push_back("-debug-info-macro");
|
CmdArgs.push_back("-debug-info-macro");
|
||||||
|
|
||||||
// -ggnu-pubnames turns on gnu style pubnames in the backend.
|
// -ggnu-pubnames turns on gnu style pubnames in the backend.
|
||||||
if (Args.hasArg(options::OPT_ggnu_pubnames)) {
|
if (Args.hasArg(options::OPT_ggnu_pubnames))
|
||||||
CmdArgs.push_back("-backend-option");
|
CmdArgs.push_back("-ggnu-pubnames");
|
||||||
CmdArgs.push_back("-generate-gnu-dwarf-pub-sections");
|
|
||||||
}
|
|
||||||
|
|
||||||
// -gdwarf-aranges turns on the emission of the aranges section in the
|
// -gdwarf-aranges turns on the emission of the aranges section in the
|
||||||
// backend.
|
// backend.
|
||||||
|
|
|
@ -564,6 +564,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
||||||
Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
|
Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
|
||||||
Opts.DebugInfoForProfiling = Args.hasFlag(
|
Opts.DebugInfoForProfiling = Args.hasFlag(
|
||||||
OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
|
OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
|
||||||
|
Opts.GnuPubnames = Args.hasArg(OPT_ggnu_pubnames);
|
||||||
|
|
||||||
setPGOInstrumentor(Opts, Args, Diags);
|
setPGOInstrumentor(Opts, Args, Diags);
|
||||||
Opts.InstrProfileOutput =
|
Opts.InstrProfileOutput =
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
//
|
//
|
||||||
// GIGNORE-NOT: "argument unused during compilation"
|
// GIGNORE-NOT: "argument unused during compilation"
|
||||||
//
|
//
|
||||||
// GOPT: -generate-gnu-dwarf-pub-sections
|
// GOPT: -ggnu-pubnames
|
||||||
//
|
//
|
||||||
// GARANGE: -generate-arange-section
|
// GARANGE: -generate-arange-section
|
||||||
//
|
//
|
||||||
|
|
|
@ -112,6 +112,8 @@ namespace llvm {
|
||||||
/// \param SplitDebugInlining Whether to emit inline debug info.
|
/// \param SplitDebugInlining Whether to emit inline debug info.
|
||||||
/// \param DebugInfoForProfiling Whether to emit extra debug info for
|
/// \param DebugInfoForProfiling Whether to emit extra debug info for
|
||||||
/// profile collection.
|
/// profile collection.
|
||||||
|
/// \param GnuPubnames Whether to emit .debug_gnu_pubnames section instead
|
||||||
|
/// of .debug_pubnames.
|
||||||
DICompileUnit *
|
DICompileUnit *
|
||||||
createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
|
createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
|
||||||
bool isOptimized, StringRef Flags, unsigned RV,
|
bool isOptimized, StringRef Flags, unsigned RV,
|
||||||
|
@ -119,7 +121,8 @@ namespace llvm {
|
||||||
DICompileUnit::DebugEmissionKind Kind =
|
DICompileUnit::DebugEmissionKind Kind =
|
||||||
DICompileUnit::DebugEmissionKind::FullDebug,
|
DICompileUnit::DebugEmissionKind::FullDebug,
|
||||||
uint64_t DWOId = 0, bool SplitDebugInlining = true,
|
uint64_t DWOId = 0, bool SplitDebugInlining = true,
|
||||||
bool DebugInfoForProfiling = false);
|
bool DebugInfoForProfiling = false,
|
||||||
|
bool GnuPubnames = false);
|
||||||
|
|
||||||
/// Create a file descriptor to hold debugging information for a file.
|
/// Create a file descriptor to hold debugging information for a file.
|
||||||
/// \param Filename File name.
|
/// \param Filename File name.
|
||||||
|
|
|
@ -1068,16 +1068,17 @@ private:
|
||||||
uint64_t DWOId;
|
uint64_t DWOId;
|
||||||
bool SplitDebugInlining;
|
bool SplitDebugInlining;
|
||||||
bool DebugInfoForProfiling;
|
bool DebugInfoForProfiling;
|
||||||
|
bool GnuPubnames;
|
||||||
|
|
||||||
DICompileUnit(LLVMContext &C, StorageType Storage, unsigned SourceLanguage,
|
DICompileUnit(LLVMContext &C, StorageType Storage, unsigned SourceLanguage,
|
||||||
bool IsOptimized, unsigned RuntimeVersion,
|
bool IsOptimized, unsigned RuntimeVersion,
|
||||||
unsigned EmissionKind, uint64_t DWOId, bool SplitDebugInlining,
|
unsigned EmissionKind, uint64_t DWOId, bool SplitDebugInlining,
|
||||||
bool DebugInfoForProfiling, ArrayRef<Metadata *> Ops)
|
bool DebugInfoForProfiling, bool GnuPubnames, ArrayRef<Metadata *> Ops)
|
||||||
: DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
|
: DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
|
||||||
SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
|
SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
|
||||||
RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind),
|
RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind),
|
||||||
DWOId(DWOId), SplitDebugInlining(SplitDebugInlining),
|
DWOId(DWOId), SplitDebugInlining(SplitDebugInlining),
|
||||||
DebugInfoForProfiling(DebugInfoForProfiling) {
|
DebugInfoForProfiling(DebugInfoForProfiling), GnuPubnames(GnuPubnames) {
|
||||||
assert(Storage != Uniqued);
|
assert(Storage != Uniqued);
|
||||||
}
|
}
|
||||||
~DICompileUnit() = default;
|
~DICompileUnit() = default;
|
||||||
|
@ -1091,15 +1092,14 @@ private:
|
||||||
DIGlobalVariableExpressionArray GlobalVariables,
|
DIGlobalVariableExpressionArray GlobalVariables,
|
||||||
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
|
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
|
||||||
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
|
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
|
||||||
StorageType Storage, bool ShouldCreate = true) {
|
bool GnuPubnames, StorageType Storage, bool ShouldCreate = true) {
|
||||||
return getImpl(Context, SourceLanguage, File,
|
return getImpl(
|
||||||
getCanonicalMDString(Context, Producer), IsOptimized,
|
Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
|
||||||
getCanonicalMDString(Context, Flags), RuntimeVersion,
|
IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion,
|
||||||
getCanonicalMDString(Context, SplitDebugFilename),
|
getCanonicalMDString(Context, SplitDebugFilename), EmissionKind,
|
||||||
EmissionKind, EnumTypes.get(), RetainedTypes.get(),
|
EnumTypes.get(), RetainedTypes.get(), GlobalVariables.get(),
|
||||||
GlobalVariables.get(), ImportedEntities.get(), Macros.get(),
|
ImportedEntities.get(), Macros.get(), DWOId, SplitDebugInlining,
|
||||||
DWOId, SplitDebugInlining, DebugInfoForProfiling, Storage,
|
DebugInfoForProfiling, GnuPubnames, Storage, ShouldCreate);
|
||||||
ShouldCreate);
|
|
||||||
}
|
}
|
||||||
static DICompileUnit *
|
static DICompileUnit *
|
||||||
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
|
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
|
||||||
|
@ -1108,7 +1108,7 @@ private:
|
||||||
unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
|
unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
|
||||||
Metadata *GlobalVariables, Metadata *ImportedEntities,
|
Metadata *GlobalVariables, Metadata *ImportedEntities,
|
||||||
Metadata *Macros, uint64_t DWOId, bool SplitDebugInlining,
|
Metadata *Macros, uint64_t DWOId, bool SplitDebugInlining,
|
||||||
bool DebugInfoForProfiling, StorageType Storage,
|
bool DebugInfoForProfiling, bool GnuPubnames, StorageType Storage,
|
||||||
bool ShouldCreate = true);
|
bool ShouldCreate = true);
|
||||||
|
|
||||||
TempDICompileUnit cloneImpl() const {
|
TempDICompileUnit cloneImpl() const {
|
||||||
|
@ -1118,7 +1118,7 @@ private:
|
||||||
getEmissionKind(), getEnumTypes(), getRetainedTypes(),
|
getEmissionKind(), getEnumTypes(), getRetainedTypes(),
|
||||||
getGlobalVariables(), getImportedEntities(),
|
getGlobalVariables(), getImportedEntities(),
|
||||||
getMacros(), DWOId, getSplitDebugInlining(),
|
getMacros(), DWOId, getSplitDebugInlining(),
|
||||||
getDebugInfoForProfiling());
|
getDebugInfoForProfiling(), getGnuPubnames());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1133,11 +1133,12 @@ public:
|
||||||
DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
|
DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
|
||||||
DIGlobalVariableExpressionArray GlobalVariables,
|
DIGlobalVariableExpressionArray GlobalVariables,
|
||||||
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
|
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
|
||||||
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling),
|
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
|
||||||
|
bool GnuPubnames),
|
||||||
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
|
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
|
||||||
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
|
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
|
||||||
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
|
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
|
||||||
DebugInfoForProfiling))
|
DebugInfoForProfiling, GnuPubnames))
|
||||||
DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
|
DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
|
||||||
DICompileUnit,
|
DICompileUnit,
|
||||||
(unsigned SourceLanguage, Metadata *File, MDString *Producer,
|
(unsigned SourceLanguage, Metadata *File, MDString *Producer,
|
||||||
|
@ -1145,11 +1146,11 @@ public:
|
||||||
MDString *SplitDebugFilename, unsigned EmissionKind, Metadata *EnumTypes,
|
MDString *SplitDebugFilename, unsigned EmissionKind, Metadata *EnumTypes,
|
||||||
Metadata *RetainedTypes, Metadata *GlobalVariables,
|
Metadata *RetainedTypes, Metadata *GlobalVariables,
|
||||||
Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId,
|
Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId,
|
||||||
bool SplitDebugInlining, bool DebugInfoForProfiling),
|
bool SplitDebugInlining, bool DebugInfoForProfiling, bool GnuPubnames),
|
||||||
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
|
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
|
||||||
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
|
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
|
||||||
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
|
GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
|
||||||
DebugInfoForProfiling))
|
DebugInfoForProfiling, GnuPubnames))
|
||||||
|
|
||||||
TempDICompileUnit clone() const { return cloneImpl(); }
|
TempDICompileUnit clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
|
@ -1160,6 +1161,7 @@ public:
|
||||||
return (DebugEmissionKind)EmissionKind;
|
return (DebugEmissionKind)EmissionKind;
|
||||||
}
|
}
|
||||||
bool getDebugInfoForProfiling() const { return DebugInfoForProfiling; }
|
bool getDebugInfoForProfiling() const { return DebugInfoForProfiling; }
|
||||||
|
bool getGnuPubnames() const { return GnuPubnames; }
|
||||||
StringRef getProducer() const { return getStringOperand(1); }
|
StringRef getProducer() const { return getStringOperand(1); }
|
||||||
StringRef getFlags() const { return getStringOperand(2); }
|
StringRef getFlags() const { return getStringOperand(2); }
|
||||||
StringRef getSplitDebugFilename() const { return getStringOperand(3); }
|
StringRef getSplitDebugFilename() const { return getStringOperand(3); }
|
||||||
|
|
|
@ -4099,7 +4099,8 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||||
OPTIONAL(macros, MDField, ); \
|
OPTIONAL(macros, MDField, ); \
|
||||||
OPTIONAL(dwoId, MDUnsignedField, ); \
|
OPTIONAL(dwoId, MDUnsignedField, ); \
|
||||||
OPTIONAL(splitDebugInlining, MDBoolField, = true); \
|
OPTIONAL(splitDebugInlining, MDBoolField, = true); \
|
||||||
OPTIONAL(debugInfoForProfiling, MDBoolField, = false);
|
OPTIONAL(debugInfoForProfiling, MDBoolField, = false); \
|
||||||
|
OPTIONAL(gnuPubnames, MDBoolField, = false);
|
||||||
PARSE_MD_FIELDS();
|
PARSE_MD_FIELDS();
|
||||||
#undef VISIT_MD_FIELDS
|
#undef VISIT_MD_FIELDS
|
||||||
|
|
||||||
|
@ -4107,7 +4108,7 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||||
Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val,
|
Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val,
|
||||||
runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val,
|
runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val,
|
||||||
retainedTypes.Val, globals.Val, imports.Val, macros.Val, dwoId.Val,
|
retainedTypes.Val, globals.Val, imports.Val, macros.Val, dwoId.Val,
|
||||||
splitDebugInlining.Val, debugInfoForProfiling.Val);
|
splitDebugInlining.Val, debugInfoForProfiling.Val, gnuPubnames.Val);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case bitc::METADATA_COMPILE_UNIT: {
|
case bitc::METADATA_COMPILE_UNIT: {
|
||||||
if (Record.size() < 14 || Record.size() > 18)
|
if (Record.size() < 14 || Record.size() > 19)
|
||||||
return error("Invalid record");
|
return error("Invalid record");
|
||||||
|
|
||||||
// Ignore Record[0], which indicates whether this compile unit is
|
// Ignore Record[0], which indicates whether this compile unit is
|
||||||
|
@ -1369,7 +1369,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
|
||||||
Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
|
Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
|
||||||
Record.size() <= 14 ? 0 : Record[14],
|
Record.size() <= 14 ? 0 : Record[14],
|
||||||
Record.size() <= 16 ? true : Record[16],
|
Record.size() <= 16 ? true : Record[16],
|
||||||
Record.size() <= 17 ? false : Record[17]);
|
Record.size() <= 17 ? false : Record[17],
|
||||||
|
Record.size() <= 18 ? false : Record[18]);
|
||||||
|
|
||||||
MetadataList.assignValue(CU, NextMetadataNo);
|
MetadataList.assignValue(CU, NextMetadataNo);
|
||||||
NextMetadataNo++;
|
NextMetadataNo++;
|
||||||
|
|
|
@ -1555,6 +1555,7 @@ void ModuleBitcodeWriter::writeDICompileUnit(const DICompileUnit *N,
|
||||||
Record.push_back(VE.getMetadataOrNullID(N->getMacros().get()));
|
Record.push_back(VE.getMetadataOrNullID(N->getMacros().get()));
|
||||||
Record.push_back(N->getSplitDebugInlining());
|
Record.push_back(N->getSplitDebugInlining());
|
||||||
Record.push_back(N->getDebugInfoForProfiling());
|
Record.push_back(N->getDebugInfoForProfiling());
|
||||||
|
Record.push_back(N->getGnuPubnames());
|
||||||
|
|
||||||
Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);
|
Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);
|
||||||
Record.clear();
|
Record.clear();
|
||||||
|
|
|
@ -52,6 +52,16 @@
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
enum DefaultOnOff { Default, Enable, Disable };
|
||||||
|
|
||||||
|
static cl::opt<DefaultOnOff>
|
||||||
|
DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
|
||||||
|
cl::desc("Generate DWARF pubnames and pubtypes sections"),
|
||||||
|
cl::values(clEnumVal(Default, "Default for platform"),
|
||||||
|
clEnumVal(Enable, "Enabled"),
|
||||||
|
clEnumVal(Disable, "Disabled")),
|
||||||
|
cl::init(Default));
|
||||||
|
|
||||||
DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const DICompileUnit *Node,
|
DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const DICompileUnit *Node,
|
||||||
AsmPrinter *A, DwarfDebug *DW,
|
AsmPrinter *A, DwarfDebug *DW,
|
||||||
DwarfFile *DWU)
|
DwarfFile *DWU)
|
||||||
|
@ -755,10 +765,22 @@ void DwarfCompileUnit::emitHeader(bool UseOffsets) {
|
||||||
DwarfUnit::emitCommonHeader(UseOffsets, UT);
|
DwarfUnit::emitCommonHeader(UseOffsets, UT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DwarfCompileUnit::hasDwarfPubSections() const {
|
||||||
|
// Opting in to GNU Pubnames/types overrides the default to ensure these are
|
||||||
|
// generated for things like Gold's gdb_index generation.
|
||||||
|
if (CUNode->getGnuPubnames())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (DwarfPubSections == Default)
|
||||||
|
return DD->tuneForGDB() && !includeMinimalInlineScopes();
|
||||||
|
|
||||||
|
return DwarfPubSections == Enable;
|
||||||
|
}
|
||||||
|
|
||||||
/// addGlobalName - Add a new global name to the compile unit.
|
/// addGlobalName - Add a new global name to the compile unit.
|
||||||
void DwarfCompileUnit::addGlobalName(StringRef Name, const DIE &Die,
|
void DwarfCompileUnit::addGlobalName(StringRef Name, const DIE &Die,
|
||||||
const DIScope *Context) {
|
const DIScope *Context) {
|
||||||
if (!DD->hasDwarfPubSections(includeMinimalInlineScopes()))
|
if (!hasDwarfPubSections())
|
||||||
return;
|
return;
|
||||||
std::string FullName = getParentContextString(Context) + Name.str();
|
std::string FullName = getParentContextString(Context) + Name.str();
|
||||||
GlobalNames[FullName] = &Die;
|
GlobalNames[FullName] = &Die;
|
||||||
|
@ -766,7 +788,7 @@ void DwarfCompileUnit::addGlobalName(StringRef Name, const DIE &Die,
|
||||||
|
|
||||||
void DwarfCompileUnit::addGlobalNameForTypeUnit(StringRef Name,
|
void DwarfCompileUnit::addGlobalNameForTypeUnit(StringRef Name,
|
||||||
const DIScope *Context) {
|
const DIScope *Context) {
|
||||||
if (!DD->hasDwarfPubSections(includeMinimalInlineScopes()))
|
if (!hasDwarfPubSections())
|
||||||
return;
|
return;
|
||||||
std::string FullName = getParentContextString(Context) + Name.str();
|
std::string FullName = getParentContextString(Context) + Name.str();
|
||||||
// Insert, allowing the entry to remain as-is if it's already present
|
// Insert, allowing the entry to remain as-is if it's already present
|
||||||
|
@ -779,7 +801,7 @@ void DwarfCompileUnit::addGlobalNameForTypeUnit(StringRef Name,
|
||||||
/// Add a new global type to the unit.
|
/// Add a new global type to the unit.
|
||||||
void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die,
|
void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die,
|
||||||
const DIScope *Context) {
|
const DIScope *Context) {
|
||||||
if (!DD->hasDwarfPubSections(includeMinimalInlineScopes()))
|
if (!hasDwarfPubSections())
|
||||||
return;
|
return;
|
||||||
std::string FullName = getParentContextString(Context) + Ty->getName().str();
|
std::string FullName = getParentContextString(Context) + Ty->getName().str();
|
||||||
GlobalTypes[FullName] = &Die;
|
GlobalTypes[FullName] = &Die;
|
||||||
|
@ -787,7 +809,7 @@ void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die,
|
||||||
|
|
||||||
void DwarfCompileUnit::addGlobalTypeUnitType(const DIType *Ty,
|
void DwarfCompileUnit::addGlobalTypeUnitType(const DIType *Ty,
|
||||||
const DIScope *Context) {
|
const DIScope *Context) {
|
||||||
if (!DD->hasDwarfPubSections(includeMinimalInlineScopes()))
|
if (!hasDwarfPubSections())
|
||||||
return;
|
return;
|
||||||
std::string FullName = getParentContextString(Context) + Ty->getName().str();
|
std::string FullName = getParentContextString(Context) + Ty->getName().str();
|
||||||
// Insert, allowing the entry to remain as-is if it's already present
|
// Insert, allowing the entry to remain as-is if it's already present
|
||||||
|
|
|
@ -289,6 +289,8 @@ public:
|
||||||
|
|
||||||
void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
|
void setBaseAddress(const MCSymbol *Base) { BaseAddress = Base; }
|
||||||
const MCSymbol *getBaseAddress() const { return BaseAddress; }
|
const MCSymbol *getBaseAddress() const { return BaseAddress; }
|
||||||
|
|
||||||
|
bool hasDwarfPubSections() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
|
@ -89,11 +89,6 @@ static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
|
||||||
"use-dwarf-ranges-base-address-specifier", cl::Hidden,
|
"use-dwarf-ranges-base-address-specifier", cl::Hidden,
|
||||||
cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
|
cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
|
||||||
|
|
||||||
static cl::opt<bool>
|
|
||||||
GenerateGnuPubSections("generate-gnu-dwarf-pub-sections", cl::Hidden,
|
|
||||||
cl::desc("Generate GNU-style pubnames and pubtypes"),
|
|
||||||
cl::init(false));
|
|
||||||
|
|
||||||
static cl::opt<bool> GenerateARangeSection("generate-arange-section",
|
static cl::opt<bool> GenerateARangeSection("generate-arange-section",
|
||||||
cl::Hidden,
|
cl::Hidden,
|
||||||
cl::desc("Generate dwarf aranges"),
|
cl::desc("Generate dwarf aranges"),
|
||||||
|
@ -120,14 +115,6 @@ DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
|
||||||
clEnumVal(Disable, "Disabled")),
|
clEnumVal(Disable, "Disabled")),
|
||||||
cl::init(Default));
|
cl::init(Default));
|
||||||
|
|
||||||
static cl::opt<DefaultOnOff>
|
|
||||||
DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
|
|
||||||
cl::desc("Generate DWARF pubnames and pubtypes sections"),
|
|
||||||
cl::values(clEnumVal(Default, "Default for platform"),
|
|
||||||
clEnumVal(Enable, "Enabled"),
|
|
||||||
clEnumVal(Disable, "Disabled")),
|
|
||||||
cl::init(Default));
|
|
||||||
|
|
||||||
enum LinkageNameOption {
|
enum LinkageNameOption {
|
||||||
DefaultLinkageNames,
|
DefaultLinkageNames,
|
||||||
AllLinkageNames,
|
AllLinkageNames,
|
||||||
|
@ -414,20 +401,8 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DwarfDebug::hasDwarfPubSections(bool includeMinimalInlineScopes) const {
|
|
||||||
// Opting in to GNU Pubnames/types overrides the default to ensure these are
|
|
||||||
// generated for things like Gold's gdb_index generation.
|
|
||||||
if (GenerateGnuPubSections)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (DwarfPubSections == Default)
|
|
||||||
return tuneForGDB() && !includeMinimalInlineScopes;
|
|
||||||
|
|
||||||
return DwarfPubSections == Enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DwarfDebug::addGnuPubAttributes(DwarfCompileUnit &U, DIE &D) const {
|
void DwarfDebug::addGnuPubAttributes(DwarfCompileUnit &U, DIE &D) const {
|
||||||
if (!hasDwarfPubSections(U.includeMinimalInlineScopes()))
|
if (!U.hasDwarfPubSections())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
U.addFlag(D, dwarf::DW_AT_GNU_pubnames);
|
U.addFlag(D, dwarf::DW_AT_GNU_pubnames);
|
||||||
|
@ -792,12 +767,7 @@ void DwarfDebug::endModule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the pubnames and pubtypes sections if requested.
|
// Emit the pubnames and pubtypes sections if requested.
|
||||||
// The condition is optimistically correct - any CU not using GMLT (&
|
emitDebugPubSections();
|
||||||
// implicit/default pubnames state) might still have pubnames.
|
|
||||||
if (hasDwarfPubSections(/* gmlt */ false)) {
|
|
||||||
emitDebugPubNames(GenerateGnuPubSections);
|
|
||||||
emitDebugPubTypes(GenerateGnuPubSections);
|
|
||||||
}
|
|
||||||
|
|
||||||
// clean up.
|
// clean up.
|
||||||
// FIXME: AbstractVariables.clear();
|
// FIXME: AbstractVariables.clear();
|
||||||
|
@ -1493,83 +1463,74 @@ static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
|
/// emitDebugPubSections - Emit visible names and types into debug pubnames and
|
||||||
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
/// pubtypes sections.
|
||||||
MCSection *PSec = GnuStyle
|
void DwarfDebug::emitDebugPubSections() {
|
||||||
? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
|
||||||
: Asm->getObjFileLowering().getDwarfPubNamesSection();
|
|
||||||
|
|
||||||
emitDebugPubSection(GnuStyle, PSec, "Names",
|
|
||||||
&DwarfCompileUnit::getGlobalNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DwarfDebug::emitDebugPubSection(
|
|
||||||
bool GnuStyle, MCSection *PSec, StringRef Name,
|
|
||||||
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
|
|
||||||
for (const auto &NU : CUMap) {
|
for (const auto &NU : CUMap) {
|
||||||
DwarfCompileUnit *TheU = NU.second;
|
DwarfCompileUnit *TheU = NU.second;
|
||||||
|
if (!TheU->hasDwarfPubSections())
|
||||||
const auto &Globals = (TheU->*Accessor)();
|
|
||||||
|
|
||||||
if (!hasDwarfPubSections(TheU->includeMinimalInlineScopes()))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (auto *Skeleton = TheU->getSkeleton())
|
bool GnuStyle = TheU->getCUNode()->getGnuPubnames();
|
||||||
TheU = Skeleton;
|
|
||||||
|
|
||||||
// Start the dwarf pubnames section.
|
Asm->OutStreamer->SwitchSection(
|
||||||
Asm->OutStreamer->SwitchSection(PSec);
|
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
||||||
|
: Asm->getObjFileLowering().getDwarfPubNamesSection());
|
||||||
|
emitDebugPubSection(GnuStyle, "Names", TheU, TheU->getGlobalNames());
|
||||||
|
|
||||||
// Emit the header.
|
Asm->OutStreamer->SwitchSection(
|
||||||
Asm->OutStreamer->AddComment("Length of Public " + Name + " Info");
|
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
||||||
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + Name + "_begin");
|
: Asm->getObjFileLowering().getDwarfPubTypesSection());
|
||||||
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + Name + "_end");
|
emitDebugPubSection(GnuStyle, "Types", TheU, TheU->getGlobalTypes());
|
||||||
Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
|
|
||||||
|
|
||||||
Asm->OutStreamer->EmitLabel(BeginLabel);
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("DWARF Version");
|
|
||||||
Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("Offset of Compilation Unit Info");
|
|
||||||
Asm->emitDwarfSymbolReference(TheU->getLabelBegin());
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("Compilation Unit Length");
|
|
||||||
Asm->EmitInt32(TheU->getLength());
|
|
||||||
|
|
||||||
// Emit the pubnames for this compilation unit.
|
|
||||||
for (const auto &GI : Globals) {
|
|
||||||
const char *Name = GI.getKeyData();
|
|
||||||
const DIE *Entity = GI.second;
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("DIE offset");
|
|
||||||
Asm->EmitInt32(Entity->getOffset());
|
|
||||||
|
|
||||||
if (GnuStyle) {
|
|
||||||
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
|
|
||||||
Asm->OutStreamer->AddComment(
|
|
||||||
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
|
||||||
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
|
||||||
Asm->EmitInt8(Desc.toBits());
|
|
||||||
}
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("External Name");
|
|
||||||
Asm->OutStreamer->EmitBytes(StringRef(Name, GI.getKeyLength() + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
Asm->OutStreamer->AddComment("End Mark");
|
|
||||||
Asm->EmitInt32(0);
|
|
||||||
Asm->OutStreamer->EmitLabel(EndLabel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
void DwarfDebug::emitDebugPubSection(bool GnuStyle, StringRef Name,
|
||||||
MCSection *PSec = GnuStyle
|
DwarfCompileUnit *TheU,
|
||||||
? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
const StringMap<const DIE *> &Globals) {
|
||||||
: Asm->getObjFileLowering().getDwarfPubTypesSection();
|
if (auto *Skeleton = TheU->getSkeleton())
|
||||||
|
TheU = Skeleton;
|
||||||
|
|
||||||
emitDebugPubSection(GnuStyle, PSec, "Types",
|
// Emit the header.
|
||||||
&DwarfCompileUnit::getGlobalTypes);
|
Asm->OutStreamer->AddComment("Length of Public " + Name + " Info");
|
||||||
|
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + Name + "_begin");
|
||||||
|
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + Name + "_end");
|
||||||
|
Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
|
||||||
|
|
||||||
|
Asm->OutStreamer->EmitLabel(BeginLabel);
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("DWARF Version");
|
||||||
|
Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("Offset of Compilation Unit Info");
|
||||||
|
Asm->emitDwarfSymbolReference(TheU->getLabelBegin());
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("Compilation Unit Length");
|
||||||
|
Asm->EmitInt32(TheU->getLength());
|
||||||
|
|
||||||
|
// Emit the pubnames for this compilation unit.
|
||||||
|
for (const auto &GI : Globals) {
|
||||||
|
const char *Name = GI.getKeyData();
|
||||||
|
const DIE *Entity = GI.second;
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("DIE offset");
|
||||||
|
Asm->EmitInt32(Entity->getOffset());
|
||||||
|
|
||||||
|
if (GnuStyle) {
|
||||||
|
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
|
||||||
|
Asm->OutStreamer->AddComment(
|
||||||
|
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
||||||
|
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
||||||
|
Asm->EmitInt8(Desc.toBits());
|
||||||
|
}
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("External Name");
|
||||||
|
Asm->OutStreamer->EmitBytes(StringRef(Name, GI.getKeyLength() + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
Asm->OutStreamer->AddComment("End Mark");
|
||||||
|
Asm->EmitInt32(0);
|
||||||
|
Asm->OutStreamer->EmitLabel(EndLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit null-terminated strings into a debug str section.
|
/// Emit null-terminated strings into a debug str section.
|
||||||
|
|
|
@ -314,16 +314,6 @@ class DwarfDebug : public DebugHandlerBase {
|
||||||
// Identify a debugger for "tuning" the debug info.
|
// Identify a debugger for "tuning" the debug info.
|
||||||
DebuggerKind DebuggerTuning = DebuggerKind::Default;
|
DebuggerKind DebuggerTuning = DebuggerKind::Default;
|
||||||
|
|
||||||
/// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger.
|
|
||||||
///
|
|
||||||
/// Returns whether we are "tuning" for a given debugger.
|
|
||||||
/// Should be used only within the constructor, to set feature flags.
|
|
||||||
/// @{
|
|
||||||
bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; }
|
|
||||||
bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
|
|
||||||
bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
|
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
|
||||||
|
|
||||||
const SmallVectorImpl<std::unique_ptr<DwarfCompileUnit>> &getUnits() {
|
const SmallVectorImpl<std::unique_ptr<DwarfCompileUnit>> &getUnits() {
|
||||||
|
@ -374,21 +364,12 @@ class DwarfDebug : public DebugHandlerBase {
|
||||||
/// Emit type dies into a hashed accelerator table.
|
/// Emit type dies into a hashed accelerator table.
|
||||||
void emitAccelTypes();
|
void emitAccelTypes();
|
||||||
|
|
||||||
/// Emit visible names into a debug pubnames section.
|
/// Emit visible names and types into debug pubnames and pubtypes sections.
|
||||||
/// \param GnuStyle determines whether or not we want to emit
|
void emitDebugPubSections();
|
||||||
/// additional information into the table ala newer gcc for gdb
|
|
||||||
/// index.
|
|
||||||
void emitDebugPubNames(bool GnuStyle = false);
|
|
||||||
|
|
||||||
/// Emit visible types into a debug pubtypes section.
|
void emitDebugPubSection(bool GnuStyle, StringRef Name,
|
||||||
/// \param GnuStyle determines whether or not we want to emit
|
DwarfCompileUnit *TheU,
|
||||||
/// additional information into the table ala newer gcc for gdb
|
const StringMap<const DIE *> &Globals);
|
||||||
/// index.
|
|
||||||
void emitDebugPubTypes(bool GnuStyle = false);
|
|
||||||
|
|
||||||
void emitDebugPubSection(
|
|
||||||
bool GnuStyle, MCSection *PSec, StringRef Name,
|
|
||||||
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
|
|
||||||
|
|
||||||
/// Emit null-terminated strings into a debug str section.
|
/// Emit null-terminated strings into a debug str section.
|
||||||
void emitDebugStr();
|
void emitDebugStr();
|
||||||
|
@ -577,7 +558,14 @@ public:
|
||||||
/// going to be null.
|
/// going to be null.
|
||||||
bool isLexicalScopeDIENull(LexicalScope *Scope);
|
bool isLexicalScopeDIENull(LexicalScope *Scope);
|
||||||
|
|
||||||
bool hasDwarfPubSections(bool includeMinimalInlineScopes) const;
|
/// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger.
|
||||||
|
///
|
||||||
|
/// Returns whether we are "tuning" for a given debugger.
|
||||||
|
/// @{
|
||||||
|
bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; }
|
||||||
|
bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
|
||||||
|
bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
|
||||||
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
|
@ -1742,6 +1742,7 @@ static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N,
|
||||||
Printer.printBool("splitDebugInlining", N->getSplitDebugInlining(), true);
|
Printer.printBool("splitDebugInlining", N->getSplitDebugInlining(), true);
|
||||||
Printer.printBool("debugInfoForProfiling", N->getDebugInfoForProfiling(),
|
Printer.printBool("debugInfoForProfiling", N->getDebugInfoForProfiling(),
|
||||||
false);
|
false);
|
||||||
|
Printer.printBool("gnuPubnames", N->getGnuPubnames(), false);
|
||||||
Out << ")";
|
Out << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ DICompileUnit *DIBuilder::createCompileUnit(
|
||||||
unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
|
unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
|
||||||
StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
|
StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
|
||||||
DICompileUnit::DebugEmissionKind Kind, uint64_t DWOId,
|
DICompileUnit::DebugEmissionKind Kind, uint64_t DWOId,
|
||||||
bool SplitDebugInlining, bool DebugInfoForProfiling) {
|
bool SplitDebugInlining, bool DebugInfoForProfiling, bool GnuPubnames) {
|
||||||
|
|
||||||
assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
|
assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
|
||||||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
|
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
|
||||||
|
@ -137,7 +137,7 @@ DICompileUnit *DIBuilder::createCompileUnit(
|
||||||
CUNode = DICompileUnit::getDistinct(
|
CUNode = DICompileUnit::getDistinct(
|
||||||
VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
|
VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
|
||||||
SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
|
SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
|
||||||
SplitDebugInlining, DebugInfoForProfiling);
|
SplitDebugInlining, DebugInfoForProfiling, GnuPubnames);
|
||||||
|
|
||||||
// Create a named metadata so that it is easier to find cu in a module.
|
// Create a named metadata so that it is easier to find cu in a module.
|
||||||
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
|
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
|
||||||
|
|
|
@ -473,7 +473,7 @@ private:
|
||||||
CU->getSplitDebugFilename(), DICompileUnit::LineTablesOnly, EnumTypes,
|
CU->getSplitDebugFilename(), DICompileUnit::LineTablesOnly, EnumTypes,
|
||||||
RetainedTypes, GlobalVariables, ImportedEntities, CU->getMacros(),
|
RetainedTypes, GlobalVariables, ImportedEntities, CU->getMacros(),
|
||||||
CU->getDWOId(), CU->getSplitDebugInlining(),
|
CU->getDWOId(), CU->getSplitDebugInlining(),
|
||||||
CU->getDebugInfoForProfiling());
|
CU->getDebugInfoForProfiling(), CU->getGnuPubnames());
|
||||||
}
|
}
|
||||||
|
|
||||||
DILocation *getReplacementMDLocation(DILocation *MLD) {
|
DILocation *getReplacementMDLocation(DILocation *MLD) {
|
||||||
|
|
|
@ -391,7 +391,7 @@ DICompileUnit *DICompileUnit::getImpl(
|
||||||
unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
|
unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
|
||||||
Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
|
Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
|
||||||
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
|
uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling,
|
||||||
StorageType Storage, bool ShouldCreate) {
|
bool GnuPubnames, StorageType Storage, bool ShouldCreate) {
|
||||||
assert(Storage != Uniqued && "Cannot unique DICompileUnit");
|
assert(Storage != Uniqued && "Cannot unique DICompileUnit");
|
||||||
assert(isCanonical(Producer) && "Expected canonical MDString");
|
assert(isCanonical(Producer) && "Expected canonical MDString");
|
||||||
assert(isCanonical(Flags) && "Expected canonical MDString");
|
assert(isCanonical(Flags) && "Expected canonical MDString");
|
||||||
|
@ -401,11 +401,10 @@ DICompileUnit *DICompileUnit::getImpl(
|
||||||
File, Producer, Flags, SplitDebugFilename,
|
File, Producer, Flags, SplitDebugFilename,
|
||||||
EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities,
|
EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities,
|
||||||
Macros};
|
Macros};
|
||||||
return storeImpl(new (array_lengthof(Ops))
|
return storeImpl(new (array_lengthof(Ops)) DICompileUnit(
|
||||||
DICompileUnit(Context, Storage, SourceLanguage,
|
Context, Storage, SourceLanguage, IsOptimized,
|
||||||
IsOptimized, RuntimeVersion, EmissionKind,
|
RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining,
|
||||||
DWOId, SplitDebugInlining,
|
DebugInfoForProfiling, GnuPubnames, Ops),
|
||||||
DebugInfoForProfiling, Ops),
|
|
||||||
Storage);
|
Storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
; RUN: llvm-as -disable-verify -o - %s | llvm-dis | FileCheck %s
|
||||||
|
|
||||||
|
!named = !{!0}
|
||||||
|
; CHECK: !DICompileUnit({{.*}}, gnuPubnames: true)
|
||||||
|
!0 = distinct !DICompileUnit(language: 12, file: !1, gnuPubnames: true)
|
||||||
|
!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
||||||
|
|
||||||
; Generated from:
|
; Generated from:
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
!llvm.dbg.cu = !{!0}
|
!llvm.dbg.cu = !{!0}
|
||||||
!llvm.module.flags = !{!3, !4}
|
!llvm.module.flags = !{!3, !4}
|
||||||
|
|
||||||
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 191846) (llvm/trunk 191866)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !5, globals: !2, imports: !2)
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 191846) (llvm/trunk 191866)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !5, globals: !2, imports: !2, gnuPubnames: true)
|
||||||
!1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo/tmp")
|
!1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo/tmp")
|
||||||
!2 = !{}
|
!2 = !{}
|
||||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s -generate-gnu-dwarf-pub-sections | llvm-dwarfdump -v - | FileCheck --check-prefix=GPUB --check-prefix=CHECK %s
|
; RUN: sed -e 's/gnuPubnames: false/gnuPubnames: true/' %s | llc -mtriple=x86_64-pc-linux-gnu -filetype=obj | llvm-dwarfdump -v - | FileCheck --check-prefix=GPUB --check-prefix=CHECK %s
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s -generate-dwarf-pub-sections=Enable | llvm-dwarfdump -v - | FileCheck --check-prefix=PUB --check-prefix=CHECK %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s -generate-dwarf-pub-sections=Enable | llvm-dwarfdump -v - | FileCheck --check-prefix=PUB --check-prefix=CHECK %s
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck --check-prefix=NONE %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck --check-prefix=NONE %s
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-
|
||||||
!llvm.module.flags = !{!3, !4, !5}
|
!llvm.module.flags = !{!3, !4, !5}
|
||||||
!llvm.ident = !{!6}
|
!llvm.ident = !{!6}
|
||||||
|
|
||||||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, gnuPubnames: false)
|
||||||
!1 = !DIFile(filename: "gnu-public-names-gmlt.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
|
!1 = !DIFile(filename: "gnu-public-names-gmlt.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
|
||||||
!2 = !{}
|
!2 = !{}
|
||||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
; RUN: llc < %s | FileCheck %s
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!4, !11}
|
||||||
|
!llvm.module.flags = !{!7}
|
||||||
|
|
||||||
|
; CHECK: .section .debug_pubnames
|
||||||
|
; CHECK: .asciz "a"
|
||||||
|
|
||||||
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
||||||
|
!1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
|
||||||
|
!2 = !DIFile(filename: "g.c", directory: "/tmp")
|
||||||
|
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||||
|
!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6)
|
||||||
|
!5 = !{}
|
||||||
|
!6 = !{!0}
|
||||||
|
!7 = !{i32 1, !"Debug Info Version", i32 3}
|
||||||
|
|
||||||
|
; CHECK: .section .debug_gnu_pubnames
|
||||||
|
; CHECK: .asciz "b"
|
||||||
|
|
||||||
|
!8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression())
|
||||||
|
!9 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
|
||||||
|
!10 = !{!8}
|
||||||
|
!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !10, gnuPubnames: true)
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-type-units -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-type-units -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
||||||
|
|
||||||
; Generated from:
|
; Generated from:
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
||||||
!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)
|
!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)
|
||||||
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
|
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, gnuPubnames: true)
|
||||||
!3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo")
|
!3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo")
|
||||||
!4 = !{}
|
!4 = !{}
|
||||||
!5 = !{!0}
|
!5 = !{!0}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections < %s | FileCheck -check-prefix=ASM %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s | FileCheck -check-prefix=ASM %s
|
||||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
|
||||||
; ModuleID = 'dwarf-public-names.cpp'
|
; ModuleID = 'dwarf-public-names.cpp'
|
||||||
;
|
;
|
||||||
; Generated from:
|
; Generated from:
|
||||||
|
@ -302,7 +302,7 @@ attributes #1 = { nounwind readnone }
|
||||||
|
|
||||||
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
||||||
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !9, isLocal: false, isDefinition: true, declaration: !8)
|
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !9, isLocal: false, isDefinition: true, declaration: !8)
|
||||||
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.7.0 (trunk 234897) (llvm/trunk 234911)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !21, imports: !44)
|
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.7.0 (trunk 234897) (llvm/trunk 234911)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !21, imports: !44, gnuPubnames: true)
|
||||||
!3 = !DIFile(filename: "gnu-public-names.cpp", directory: "/tmp/dbginfo")
|
!3 = !DIFile(filename: "gnu-public-names.cpp", directory: "/tmp/dbginfo")
|
||||||
!4 = !{}
|
!4 = !{}
|
||||||
!5 = !{!6, !17}
|
!5 = !{!6, !17}
|
||||||
|
|
|
@ -92,10 +92,10 @@ protected:
|
||||||
return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
|
return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
|
||||||
}
|
}
|
||||||
DICompileUnit *getUnit() {
|
DICompileUnit *getUnit() {
|
||||||
return DICompileUnit::getDistinct(Context, 1, getFile(), "clang", false,
|
return DICompileUnit::getDistinct(
|
||||||
"-g", 2, "", DICompileUnit::FullDebug,
|
Context, 1, getFile(), "clang", false, "-g", 2, "",
|
||||||
getTuple(), getTuple(), getTuple(),
|
DICompileUnit::FullDebug, getTuple(), getTuple(), getTuple(),
|
||||||
getTuple(), getTuple(), 0, true, false);
|
getTuple(), getTuple(), 0, true, false, false);
|
||||||
}
|
}
|
||||||
DIType *getBasicType(StringRef Name) {
|
DIType *getBasicType(StringRef Name) {
|
||||||
return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name);
|
return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name);
|
||||||
|
@ -1417,7 +1417,7 @@ TEST_F(DICompileUnitTest, get) {
|
||||||
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
||||||
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
||||||
RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, true,
|
RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, true,
|
||||||
false);
|
false, false);
|
||||||
|
|
||||||
EXPECT_EQ(dwarf::DW_TAG_compile_unit, N->getTag());
|
EXPECT_EQ(dwarf::DW_TAG_compile_unit, N->getTag());
|
||||||
EXPECT_EQ(SourceLanguage, N->getSourceLanguage());
|
EXPECT_EQ(SourceLanguage, N->getSourceLanguage());
|
||||||
|
@ -1474,7 +1474,8 @@ TEST_F(DICompileUnitTest, replaceArrays) {
|
||||||
auto *N = DICompileUnit::getDistinct(
|
auto *N = DICompileUnit::getDistinct(
|
||||||
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
|
||||||
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
|
||||||
RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false);
|
RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
|
||||||
|
false);
|
||||||
|
|
||||||
auto *GlobalVariables = MDTuple::getDistinct(Context, None);
|
auto *GlobalVariables = MDTuple::getDistinct(Context, None);
|
||||||
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
||||||
|
|
Loading…
Reference in New Issue