mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
Revert "[dsymutil] Accept a YAML debug map as input instead of a binary."
This reverts commit r238941 while I figure out the bot issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238943 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -6,8 +6,6 @@ RUN: llvm-dsymutil -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_6
|
|||||||
RUN: llvm-dwarfdump %t2 | FileCheck %s
|
RUN: llvm-dwarfdump %t2 | FileCheck %s
|
||||||
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
|
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
|
||||||
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
|
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
|
||||||
RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
|
|
||||||
RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -o - -oso-prepend-path=%p/.. -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
|
|
||||||
|
|
||||||
CHECK: file format Mach-O 64-bit x86-64
|
CHECK: file format Mach-O 64-bit x86-64
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
|
RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
|
||||||
RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -o - -oso-prepend-path=%p/.. -y - | llvm-dwarfdump - | FileCheck %s
|
|
||||||
|
|
||||||
CHECK: file format Mach-O 64-bit x86-64
|
CHECK: file format Mach-O 64-bit x86-64
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ class DebugMap {
|
|||||||
|
|
||||||
/// For YAML IO support.
|
/// For YAML IO support.
|
||||||
///@{
|
///@{
|
||||||
friend yaml::MappingTraits<std::unique_ptr<DebugMap>>;
|
|
||||||
friend yaml::MappingTraits<DebugMap>;
|
friend yaml::MappingTraits<DebugMap>;
|
||||||
DebugMap() = default;
|
DebugMap() = default;
|
||||||
///@}
|
///@}
|
||||||
@@ -185,35 +184,33 @@ struct MappingTraits<std::pair<std::string, DebugMapObject::SymbolMapping>> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <> struct MappingTraits<dsymutil::DebugMapObject> {
|
template <> struct MappingTraits<dsymutil::DebugMapObject> {
|
||||||
// Normalize/Denormalize between YAML and a DebugMapObject.
|
typedef StringMap<dsymutil::DebugMapObject::SymbolMapping> SymbolMap;
|
||||||
struct YamlDMO {
|
|
||||||
YamlDMO(IO &io) {}
|
|
||||||
|
|
||||||
YamlDMO(IO &io, dsymutil::DebugMapObject &Obj) {
|
struct SequencedStringMap {
|
||||||
Filename = Obj.Filename;
|
SequencedStringMap(IO &io) {}
|
||||||
Entries.reserve(Obj.Symbols.size());
|
|
||||||
for (auto &Entry : Obj.Symbols)
|
SequencedStringMap(IO &io, SymbolMap &Map) {
|
||||||
|
Entries.reserve(Map.size());
|
||||||
|
for (auto &Entry : Map)
|
||||||
Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue()));
|
Entries.push_back(std::make_pair(Entry.getKey(), Entry.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
dsymutil::DebugMapObject denormalize(IO &) {
|
SymbolMap denormalize(IO &) {
|
||||||
dsymutil::DebugMapObject Res(Filename);
|
SymbolMap Res;
|
||||||
for (auto &Entry : Entries) {
|
|
||||||
auto &Mapping = Entry.second;
|
for (auto &Entry : Entries)
|
||||||
Res.addSymbol(Entry.first, Mapping.ObjectAddress, Mapping.BinaryAddress,
|
Res[Entry.first] = Entry.second;
|
||||||
Mapping.Size);
|
|
||||||
}
|
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Filename;
|
|
||||||
std::vector<dsymutil::DebugMapObject::YAMLSymbolMapping> Entries;
|
std::vector<dsymutil::DebugMapObject::YAMLSymbolMapping> Entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void mapping(IO &io, dsymutil::DebugMapObject &DMO) {
|
static void mapping(IO &io, dsymutil::DebugMapObject &s) {
|
||||||
MappingNormalization<YamlDMO, dsymutil::DebugMapObject> Norm(io, DMO);
|
MappingNormalization<SequencedStringMap, SymbolMap> seq(io, s.Symbols);
|
||||||
io.mapRequired("filename", Norm->Filename);
|
io.mapRequired("filename", s.Filename);
|
||||||
io.mapRequired("symbols", Norm->Entries);
|
io.mapRequired("symbols", seq->Entries);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -225,7 +222,7 @@ template <> struct ScalarTraits<Triple> {
|
|||||||
|
|
||||||
static StringRef input(StringRef scalar, void *, Triple &value) {
|
static StringRef input(StringRef scalar, void *, Triple &value) {
|
||||||
value = Triple(scalar);
|
value = Triple(scalar);
|
||||||
return StringRef();
|
return value.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mustQuote(StringRef) { return true; }
|
static bool mustQuote(StringRef) { return true; }
|
||||||
@@ -256,15 +253,6 @@ template <> struct MappingTraits<dsymutil::DebugMap> {
|
|||||||
io.mapOptional("objects", DM.Objects);
|
io.mapOptional("objects", DM.Objects);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct MappingTraits<std::unique_ptr<dsymutil::DebugMap>> {
|
|
||||||
static void mapping(IO &io, std::unique_ptr<dsymutil::DebugMap> &DM) {
|
|
||||||
if (!DM)
|
|
||||||
DM.reset(new DebugMap());
|
|
||||||
io.mapRequired("triple", DM->BinaryTriple);
|
|
||||||
io.mapOptional("objects", DM->Objects);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -242,32 +242,12 @@ void MachODebugMapParser::loadMainBinarySymbols() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<std::unique_ptr<DebugMap>>
|
|
||||||
parseYAMLDebugMap(StringRef InputFile, bool Verbose) {
|
|
||||||
auto ErrOrFile = MemoryBuffer::getFileOrSTDIN(InputFile);
|
|
||||||
if (auto Err =ErrOrFile.getError())
|
|
||||||
return Err;
|
|
||||||
|
|
||||||
std::unique_ptr<DebugMap> Res;
|
|
||||||
yaml::Input yin((*ErrOrFile)->getBuffer());
|
|
||||||
yin >> Res;
|
|
||||||
|
|
||||||
if (auto EC = yin.error())
|
|
||||||
return EC;
|
|
||||||
|
|
||||||
return std::move(Res);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace dsymutil {
|
namespace dsymutil {
|
||||||
llvm::ErrorOr<std::unique_ptr<DebugMap>>
|
llvm::ErrorOr<std::unique_ptr<DebugMap>>
|
||||||
parseDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose, bool InputIsYAML) {
|
parseDebugMap(StringRef InputFile, StringRef PrependPath, bool Verbose) {
|
||||||
if (!InputIsYAML) {
|
|
||||||
MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
|
MachODebugMapParser Parser(InputFile, PrependPath, Verbose);
|
||||||
return Parser.parse();
|
return Parser.parse();
|
||||||
} else {
|
|
||||||
return parseYAMLDebugMap(InputFile, Verbose);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ static opt<bool> DumpDebugMap(
|
|||||||
desc("Parse and dump the debug map to standard output. Not DWARF link "
|
desc("Parse and dump the debug map to standard output. Not DWARF link "
|
||||||
"will take place."),
|
"will take place."),
|
||||||
init(false));
|
init(false));
|
||||||
|
|
||||||
static opt<bool> InputIsYAMLDebugMap(
|
|
||||||
"y", desc("Treat the input file is a YAML debug map rather than a binary."),
|
|
||||||
init(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@@ -65,9 +61,7 @@ int main(int argc, char **argv) {
|
|||||||
LinkOptions Options;
|
LinkOptions Options;
|
||||||
|
|
||||||
llvm::cl::ParseCommandLineOptions(argc, argv, "llvm dsymutil\n");
|
llvm::cl::ParseCommandLineOptions(argc, argv, "llvm dsymutil\n");
|
||||||
|
auto DebugMapPtrOrErr = parseDebugMap(InputFile, OsoPrependPath, Verbose);
|
||||||
auto DebugMapPtrOrErr =
|
|
||||||
parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap);
|
|
||||||
|
|
||||||
Options.Verbose = Verbose;
|
Options.Verbose = Verbose;
|
||||||
Options.NoOutput = NoOutput;
|
Options.NoOutput = NoOutput;
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ struct LinkOptions {
|
|||||||
/// \brief Extract the DebugMap from the given file.
|
/// \brief Extract the DebugMap from the given file.
|
||||||
/// The file has to be a MachO object file.
|
/// The file has to be a MachO object file.
|
||||||
llvm::ErrorOr<std::unique_ptr<DebugMap>>
|
llvm::ErrorOr<std::unique_ptr<DebugMap>>
|
||||||
parseDebugMap(StringRef InputFile, StringRef PrependPath,
|
parseDebugMap(StringRef InputFile, StringRef PrependPath = "",
|
||||||
bool Verbose, bool InputIsYAML);
|
bool Verbose = false);
|
||||||
|
|
||||||
/// \brief Link the Dwarf debuginfo as directed by the passed DebugMap
|
/// \brief Link the Dwarf debuginfo as directed by the passed DebugMap
|
||||||
/// \p DM into a DwarfFile named \p OutputFilename.
|
/// \p DM into a DwarfFile named \p OutputFilename.
|
||||||
|
|||||||
Reference in New Issue
Block a user