mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
[dsymutil] Store an optional BinaryPath in the debug map.
llvm-dsymutil needs to emit dSYM companion bundles. These are binary files that replicate some of the orignal binary file properties (sections and symbols). To get acces to these properties, pass the binary path in the debug map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
93639d33f7
commit
65ce0b1a58
@ -10,6 +10,7 @@ Check that We can parse the debug map of the basic executable.
|
||||
CHECK-NOT: error
|
||||
CHECK: ---
|
||||
CHECK: triple: 'x86_64-apple-darwin'
|
||||
CHECK: binary-path:{{.*}}/Inputs/basic.macho.x86_64
|
||||
CHECK: filename:{{.*}}/Inputs/basic1.macho.x86_64.o
|
||||
CHECK-DAG: sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000EA0, size: 0x00000024
|
||||
CHECK: filename{{.*}}/Inputs/basic2.macho.x86_64.o
|
||||
@ -29,6 +30,7 @@ Check that we can parse the debug-map of the basic-lto executable
|
||||
CHECK-LTO-NOT: error
|
||||
CHECK-LTO: ---
|
||||
CHECK-LTO: triple: 'x86_64-apple-darwin'
|
||||
CHECK-LTO: binary-path:{{.*}}/Inputs/basic-lto.macho.x86_64
|
||||
CHECK-LTO: /Inputs/basic-lto.macho.x86_64.o
|
||||
CHECK-LTO-DAG: sym: _bar, objAddr: 0x0000000000000050, binAddr: 0x0000000100000F90, size: 0x00000024
|
||||
CHECK-LTO-DAG: sym: _baz, objAddr: 0x0000000000000658, binAddr: 0x0000000100001000, size: 0x00000000
|
||||
@ -52,6 +54,7 @@ CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
|
||||
CHECK-ARCHIVE-NEXT: found member in current archive.
|
||||
CHECK-ARCHIVE: ---
|
||||
CHECK-ARCHIVE: triple: 'x86_64-apple-darwin'
|
||||
CHECK-ARCHIVE: binary-path:{{.*}}/Inputs/basic-archive.macho.x86_64
|
||||
CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o
|
||||
CHECK-ARCHIVE-DAG: sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000EA0, size: 0x00000024
|
||||
CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o)
|
||||
@ -73,6 +76,7 @@ NOT-FOUND: cannot open{{.*}}"/Inputs/basic2.macho.x86_64.o": {{[Nn]o}} such file
|
||||
NOT-FOUND: cannot open{{.*}}"/Inputs/basic3.macho.x86_64.o": {{[Nn]o}} such file
|
||||
NOT-FOUND: ---
|
||||
NOT-FOUND-NEXT: triple: 'x86_64-apple-darwin'
|
||||
NOT-FOUND-NEXT: binary-path:{{.*}}/Inputs/basic.macho.x86_64
|
||||
NOT-FOUND-NEXT: ...
|
||||
|
||||
Check that we correctly error out on invalid executatble.
|
||||
|
@ -6,6 +6,7 @@
|
||||
#
|
||||
# CHECK: ---
|
||||
# CHECK-NEXT: triple:{{.*}}'x86_64-apple-darwin'
|
||||
# CHECK-NEXT: binary-path:{{.*}}''
|
||||
# CHECK-NEXT: objects:
|
||||
# CHECK-NEXT: filename:{{.*}}/Inputs/basic1.macho.x86_64.o
|
||||
# CHECK-NEXT: timestamp: 0
|
||||
|
@ -179,6 +179,7 @@ SequenceTraits<std::vector<std::unique_ptr<dsymutil::DebugMapObject>>>::element(
|
||||
void MappingTraits<dsymutil::DebugMap>::mapping(IO &io,
|
||||
dsymutil::DebugMap &DM) {
|
||||
io.mapRequired("triple", DM.BinaryTriple);
|
||||
io.mapOptional("binary-path", DM.BinaryPath);
|
||||
if (void *Ctxt = io.getContext())
|
||||
reinterpret_cast<YAMLContext *>(Ctxt)->BinaryTriple = DM.BinaryTriple;
|
||||
io.mapOptional("objects", DM.Objects);
|
||||
@ -189,6 +190,7 @@ void MappingTraits<std::unique_ptr<dsymutil::DebugMap>>::mapping(
|
||||
if (!DM)
|
||||
DM.reset(new DebugMap());
|
||||
io.mapRequired("triple", DM->BinaryTriple);
|
||||
io.mapOptional("binary-path", DM->BinaryPath);
|
||||
if (void *Ctxt = io.getContext())
|
||||
reinterpret_cast<YAMLContext *>(Ctxt)->BinaryTriple = DM->BinaryTriple;
|
||||
io.mapOptional("objects", DM->Objects);
|
||||
|
@ -66,6 +66,7 @@ class DebugMapObject;
|
||||
/// }
|
||||
class DebugMap {
|
||||
Triple BinaryTriple;
|
||||
std::string BinaryPath;
|
||||
typedef std::vector<std::unique_ptr<DebugMapObject>> ObjectContainer;
|
||||
ObjectContainer Objects;
|
||||
|
||||
@ -76,7 +77,8 @@ class DebugMap {
|
||||
DebugMap() = default;
|
||||
///@}
|
||||
public:
|
||||
DebugMap(const Triple &BinaryTriple) : BinaryTriple(BinaryTriple) {}
|
||||
DebugMap(const Triple &BinaryTriple, StringRef BinaryPath)
|
||||
: BinaryTriple(BinaryTriple), BinaryPath(BinaryPath) {}
|
||||
|
||||
typedef ObjectContainer::const_iterator const_iterator;
|
||||
|
||||
@ -95,6 +97,8 @@ public:
|
||||
|
||||
const Triple &getTriple() const { return BinaryTriple; }
|
||||
|
||||
StringRef getBinaryPath() const { return BinaryPath; }
|
||||
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -120,7 +120,8 @@ std::unique_ptr<DebugMap>
|
||||
MachODebugMapParser::parseOneBinary(const MachOObjectFile &MainBinary,
|
||||
StringRef BinaryPath) {
|
||||
loadMainBinarySymbols(MainBinary);
|
||||
Result = make_unique<DebugMap>(BinaryHolder::getTriple(MainBinary));
|
||||
Result =
|
||||
make_unique<DebugMap>(BinaryHolder::getTriple(MainBinary), BinaryPath);
|
||||
MainBinaryStrings = MainBinary.getStringTableData();
|
||||
for (const SymbolRef &Symbol : MainBinary.symbols()) {
|
||||
const DataRefImpl &DRI = Symbol.getRawDataRefImpl();
|
||||
|
Loading…
Reference in New Issue
Block a user