mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[DWARFYAML] Add emitDebug[GNU]Pub[names/types] functions. NFC.
In this patch, emitDebugPubnames(), emitDebugPubtypes(), emitDebugGNUPubnames(), emitDebugGNUPubtypes() are added. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D85003
This commit is contained in:
parent
e4b2d85cdf
commit
65b9283070
@ -33,8 +33,10 @@ Error emitDebugStr(raw_ostream &OS, const Data &DI);
|
||||
|
||||
Error emitDebugAranges(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugRanges(raw_ostream &OS, const Data &DI);
|
||||
Error emitPubSection(raw_ostream &OS, const PubSection &Sect,
|
||||
bool IsLittleEndian, bool IsGNUPubSec = false);
|
||||
Error emitDebugPubnames(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugPubtypes(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugGNUPubnames(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugGNUPubtypes(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugInfo(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugLine(raw_ostream &OS, const Data &DI);
|
||||
Error emitDebugAddr(raw_ostream &OS, const Data &DI);
|
||||
|
@ -209,9 +209,8 @@ Error DWARFYAML::emitDebugRanges(raw_ostream &OS, const DWARFYAML::Data &DI) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error DWARFYAML::emitPubSection(raw_ostream &OS,
|
||||
const DWARFYAML::PubSection &Sect,
|
||||
bool IsLittleEndian, bool IsGNUPubSec) {
|
||||
static Error emitPubSection(raw_ostream &OS, const DWARFYAML::PubSection &Sect,
|
||||
bool IsLittleEndian, bool IsGNUPubSec = false) {
|
||||
writeInitialLength(Sect.Length, OS, IsLittleEndian);
|
||||
writeInteger((uint16_t)Sect.Version, OS, IsLittleEndian);
|
||||
writeInteger((uint32_t)Sect.UnitOffset, OS, IsLittleEndian);
|
||||
@ -227,6 +226,28 @@ Error DWARFYAML::emitPubSection(raw_ostream &OS,
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error DWARFYAML::emitDebugPubnames(raw_ostream &OS, const Data &DI) {
|
||||
assert(DI.PubNames && "unexpected emitDebugPubnames() call");
|
||||
return emitPubSection(OS, *DI.PubNames, DI.IsLittleEndian);
|
||||
}
|
||||
|
||||
Error DWARFYAML::emitDebugPubtypes(raw_ostream &OS, const Data &DI) {
|
||||
assert(DI.PubTypes && "unexpected emitDebugPubtypes() call");
|
||||
return emitPubSection(OS, *DI.PubTypes, DI.IsLittleEndian);
|
||||
}
|
||||
|
||||
Error DWARFYAML::emitDebugGNUPubnames(raw_ostream &OS, const Data &DI) {
|
||||
assert(DI.GNUPubNames && "unexpected emitDebugGNUPubnames() call");
|
||||
return emitPubSection(OS, *DI.GNUPubNames, DI.IsLittleEndian,
|
||||
/*IsGNUStyle=*/true);
|
||||
}
|
||||
|
||||
Error DWARFYAML::emitDebugGNUPubtypes(raw_ostream &OS, const Data &DI) {
|
||||
assert(DI.GNUPubTypes && "unexpected emitDebugGNUPubtypes() call");
|
||||
return emitPubSection(OS, *DI.GNUPubTypes, DI.IsLittleEndian,
|
||||
/*IsGNUStyle=*/true);
|
||||
}
|
||||
|
||||
static Expected<uint64_t> writeDIE(ArrayRef<DWARFYAML::Abbrev> AbbrevDecls,
|
||||
const DWARFYAML::Unit &Unit,
|
||||
const DWARFYAML::Entry &Entry,
|
||||
|
@ -967,15 +967,13 @@ Expected<uint64_t> emitDWARF(typename ELFT::Shdr &SHeader, StringRef Name,
|
||||
else if (Name == ".debug_info")
|
||||
Err = DWARFYAML::emitDebugInfo(*OS, DWARF);
|
||||
else if (Name == ".debug_pubnames")
|
||||
Err = DWARFYAML::emitPubSection(*OS, *DWARF.PubNames, DWARF.IsLittleEndian);
|
||||
Err = DWARFYAML::emitDebugPubnames(*OS, DWARF);
|
||||
else if (Name == ".debug_pubtypes")
|
||||
Err = DWARFYAML::emitPubSection(*OS, *DWARF.PubTypes, DWARF.IsLittleEndian);
|
||||
Err = DWARFYAML::emitDebugPubtypes(*OS, DWARF);
|
||||
else if (Name == ".debug_gnu_pubnames")
|
||||
Err = DWARFYAML::emitPubSection(*OS, *DWARF.GNUPubNames,
|
||||
DWARF.IsLittleEndian, /*IsGNUStyle=*/true);
|
||||
Err = DWARFYAML::emitDebugGNUPubnames(*OS, DWARF);
|
||||
else if (Name == ".debug_gnu_pubtypes")
|
||||
Err = DWARFYAML::emitPubSection(*OS, *DWARF.GNUPubTypes,
|
||||
DWARF.IsLittleEndian, /*IsGNUStyle=*/true);
|
||||
Err = DWARFYAML::emitDebugGNUPubtypes(*OS, DWARF);
|
||||
else if (Name == ".debug_str_offsets")
|
||||
Err = DWARFYAML::emitDebugStrOffsets(*OS, DWARF);
|
||||
else if (Name == ".debug_rnglists")
|
||||
|
@ -299,12 +299,10 @@ Error MachOWriter::writeSectionData(raw_ostream &OS) {
|
||||
Err = DWARFYAML::emitDebugRanges(OS, Obj.DWARF);
|
||||
else if (0 == strncmp(&Sec.sectname[0], "__debug_pubnames", 16)) {
|
||||
if (Obj.DWARF.PubNames)
|
||||
Err = DWARFYAML::emitPubSection(OS, *Obj.DWARF.PubNames,
|
||||
Obj.IsLittleEndian);
|
||||
Err = DWARFYAML::emitDebugPubnames(OS, Obj.DWARF);
|
||||
} else if (0 == strncmp(&Sec.sectname[0], "__debug_pubtypes", 16)) {
|
||||
if (Obj.DWARF.PubTypes)
|
||||
Err = DWARFYAML::emitPubSection(OS, *Obj.DWARF.PubTypes,
|
||||
Obj.IsLittleEndian);
|
||||
Err = DWARFYAML::emitDebugPubtypes(OS, Obj.DWARF);
|
||||
} else if (0 == strncmp(&Sec.sectname[0], "__debug_info", 16))
|
||||
Err = DWARFYAML::emitDebugInfo(OS, Obj.DWARF);
|
||||
else if (0 == strncmp(&Sec.sectname[0], "__debug_line", 16))
|
||||
|
Loading…
x
Reference in New Issue
Block a user