[dsymutil] Add the detected target triple to the debug map.

It will be needed to instantiate the Target object that we will
use to create all the MC objects for the dwarf emission.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Frederic Riss
2015-01-19 23:33:14 +00:00
parent 5d2d1f29e1
commit 8732027cd8
4 changed files with 21 additions and 5 deletions

View File

@@ -97,6 +97,13 @@ void MachODebugMapParser::switchToNewDebugMapObject(StringRef Filename) {
CurrentDebugMapObject = &Result->addDebugMapObject(Path);
}
static Triple getTriple(const object::MachOObjectFile &Obj) {
Triple TheTriple("unknown-unknown-unknown");
TheTriple.setArch(Triple::ArchType(Obj.getArch()));
TheTriple.setObjectFormat(Triple::MachO);
return TheTriple;
}
/// This main parsing routine tries to open the main binary and if
/// successful iterates over the STAB entries. The real parsing is
/// done in handleStabSymbolTableEntry.
@@ -107,7 +114,7 @@ ErrorOr<std::unique_ptr<DebugMap>> MachODebugMapParser::parse() {
const MachOObjectFile &MainBinary = *MainBinOrError;
loadMainBinarySymbols();
Result = make_unique<DebugMap>();
Result = make_unique<DebugMap>(getTriple(MainBinary));
MainBinaryStrings = MainBinary.getStringTableData();
for (const SymbolRef &Symbol : MainBinary.symbols()) {
const DataRefImpl &DRI = Symbol.getRawDataRefImpl();