aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-03 03:27:29 +0000
committerChris Lattner <sabre@nondot.org>2001-11-03 03:27:29 +0000
commit2d3e8bba628843bf2dffa21f69d9b45098d3bfc4 (patch)
tree1d6f152f330b3ac8fecbc7c413f8fb87d8aa1e19 /lib
parentd4f981d00f4064592d488d507ba106187140d3cb (diff)
downloadexternal_llvm-2d3e8bba628843bf2dffa21f69d9b45098d3bfc4.zip
external_llvm-2d3e8bba628843bf2dffa21f69d9b45098d3bfc4.tar.gz
external_llvm-2d3e8bba628843bf2dffa21f69d9b45098d3bfc4.tar.bz2
Add extra code for debugging linker problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Linker/LinkModules.cpp21
-rw-r--r--lib/Transforms/Utils/Linker.cpp21
-rw-r--r--lib/VMCore/Linker.cpp21
3 files changed, 57 insertions, 6 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 3cb1ffe..a2399ed 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -27,6 +27,15 @@ static inline bool Error(string *E, string Message) {
#include "llvm/Assembly/Writer.h" // TODO: REMOVE
+static void PrintMap(const map<const Value*, Value*> &M) {
+ for (map<const Value*, Value*>::const_iterator I = M.begin(), E = M.end();
+ I != E; ++I) {
+ cerr << " Fr: " << (void*)I->first << " " << I->first
+ << " To: " << (void*)I->second << " " << I->second << endl;
+ }
+}
+
+
// RemapOperand - Use LocalMap and GlobalMap to convert references from one
// module to another. This is somewhat sophisticated in that it can
// automatically handle constant references correctly as well...
@@ -75,8 +84,16 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
LocalMap.insert(make_pair(In, CPV));
return Result;
}
-
- cerr << "Couldn't remap value: " << In << endl;
+
+ cerr << "XXX LocalMap: \n";
+ PrintMap(LocalMap);
+
+ if (GlobalMap) {
+ cerr << "XXX GlobalMap: \n";
+ PrintMap(*GlobalMap);
+ }
+
+ cerr << "Couldn't remap value: " << (void*)In << " " << In << endl;
assert(0 && "Couldn't remap value!");
return 0;
}
diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp
index 3cb1ffe..a2399ed 100644
--- a/lib/Transforms/Utils/Linker.cpp
+++ b/lib/Transforms/Utils/Linker.cpp
@@ -27,6 +27,15 @@ static inline bool Error(string *E, string Message) {
#include "llvm/Assembly/Writer.h" // TODO: REMOVE
+static void PrintMap(const map<const Value*, Value*> &M) {
+ for (map<const Value*, Value*>::const_iterator I = M.begin(), E = M.end();
+ I != E; ++I) {
+ cerr << " Fr: " << (void*)I->first << " " << I->first
+ << " To: " << (void*)I->second << " " << I->second << endl;
+ }
+}
+
+
// RemapOperand - Use LocalMap and GlobalMap to convert references from one
// module to another. This is somewhat sophisticated in that it can
// automatically handle constant references correctly as well...
@@ -75,8 +84,16 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
LocalMap.insert(make_pair(In, CPV));
return Result;
}
-
- cerr << "Couldn't remap value: " << In << endl;
+
+ cerr << "XXX LocalMap: \n";
+ PrintMap(LocalMap);
+
+ if (GlobalMap) {
+ cerr << "XXX GlobalMap: \n";
+ PrintMap(*GlobalMap);
+ }
+
+ cerr << "Couldn't remap value: " << (void*)In << " " << In << endl;
assert(0 && "Couldn't remap value!");
return 0;
}
diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp
index 3cb1ffe..a2399ed 100644
--- a/lib/VMCore/Linker.cpp
+++ b/lib/VMCore/Linker.cpp
@@ -27,6 +27,15 @@ static inline bool Error(string *E, string Message) {
#include "llvm/Assembly/Writer.h" // TODO: REMOVE
+static void PrintMap(const map<const Value*, Value*> &M) {
+ for (map<const Value*, Value*>::const_iterator I = M.begin(), E = M.end();
+ I != E; ++I) {
+ cerr << " Fr: " << (void*)I->first << " " << I->first
+ << " To: " << (void*)I->second << " " << I->second << endl;
+ }
+}
+
+
// RemapOperand - Use LocalMap and GlobalMap to convert references from one
// module to another. This is somewhat sophisticated in that it can
// automatically handle constant references correctly as well...
@@ -75,8 +84,16 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
LocalMap.insert(make_pair(In, CPV));
return Result;
}
-
- cerr << "Couldn't remap value: " << In << endl;
+
+ cerr << "XXX LocalMap: \n";
+ PrintMap(LocalMap);
+
+ if (GlobalMap) {
+ cerr << "XXX GlobalMap: \n";
+ PrintMap(*GlobalMap);
+ }
+
+ cerr << "Couldn't remap value: " << (void*)In << " " << In << endl;
assert(0 && "Couldn't remap value!");
return 0;
}