[llvm] r246011 - [dsymutil] Store an optional BinaryPath in the debug map.
Frederic Riss via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 22:09:59 PDT 2015
Author: friss
Date: Wed Aug 26 00:09:59 2015
New Revision: 246011
URL: http://llvm.org/viewvc/llvm-project?rev=246011&view=rev
Log:
[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.
Modified:
llvm/trunk/test/tools/dsymutil/debug-map-parsing.test
llvm/trunk/test/tools/dsymutil/yaml-object-address-rewrite.test
llvm/trunk/tools/dsymutil/DebugMap.cpp
llvm/trunk/tools/dsymutil/DebugMap.h
llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp
Modified: llvm/trunk/test/tools/dsymutil/debug-map-parsing.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/debug-map-parsing.test?rev=246011&r1=246010&r2=246011&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/debug-map-parsing.test (original)
+++ llvm/trunk/test/tools/dsymutil/debug-map-parsing.test Wed Aug 26 00:09:59 2015
@@ -10,6 +10,7 @@ Check that We can parse the debug map of
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
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 {{.*}
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/bas
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.
Modified: llvm/trunk/test/tools/dsymutil/yaml-object-address-rewrite.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/yaml-object-address-rewrite.test?rev=246011&r1=246010&r2=246011&view=diff
==============================================================================
--- llvm/trunk/test/tools/dsymutil/yaml-object-address-rewrite.test (original)
+++ llvm/trunk/test/tools/dsymutil/yaml-object-address-rewrite.test Wed Aug 26 00:09:59 2015
@@ -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
Modified: llvm/trunk/tools/dsymutil/DebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.cpp?rev=246011&r1=246010&r2=246011&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DebugMap.cpp (original)
+++ llvm/trunk/tools/dsymutil/DebugMap.cpp Wed Aug 26 00:09:59 2015
@@ -179,6 +179,7 @@ SequenceTraits<std::vector<std::unique_p
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<dsymu
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);
Modified: llvm/trunk/tools/dsymutil/DebugMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.h?rev=246011&r1=246010&r2=246011&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DebugMap.h (original)
+++ llvm/trunk/tools/dsymutil/DebugMap.h Wed Aug 26 00:09:59 2015
@@ -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
Modified: llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp?rev=246011&r1=246010&r2=246011&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp (original)
+++ llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp Wed Aug 26 00:09:59 2015
@@ -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();
More information about the llvm-commits
mailing list