aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Debugger
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-06 05:18:53 +0000
committerChris Lattner <sabre@nondot.org>2007-05-06 05:18:53 +0000
commit2cb1ad92d1b2d6e77200995685ccabf39673f1b6 (patch)
tree0bf8f2dd25c33158311261b9390383ea364c8f00 /lib/Debugger
parent9356b1aa54f40f72726dc500f592f1017759e7c4 (diff)
downloadexternal_llvm-2cb1ad92d1b2d6e77200995685ccabf39673f1b6.zip
external_llvm-2cb1ad92d1b2d6e77200995685ccabf39673f1b6.tar.gz
external_llvm-2cb1ad92d1b2d6e77200995685ccabf39673f1b6.tar.bz2
teach this to read from bitcode files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Debugger')
-rw-r--r--lib/Debugger/Debugger.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Debugger/Debugger.cpp b/lib/Debugger/Debugger.cpp
index 613a19d..90741af 100644
--- a/lib/Debugger/Debugger.cpp
+++ b/lib/Debugger/Debugger.cpp
@@ -15,11 +15,15 @@
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Bytecode/Reader.h"
+#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Debugger/InferiorProcess.h"
+#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/StringExtras.h"
#include <memory>
using namespace llvm;
+static bool Bitcode = false;
+
/// Debugger constructor - Initialize the debugger to its initial, empty, state.
///
Debugger::Debugger() : Environment(0), Program(0), Process(0) {
@@ -45,7 +49,15 @@ std::string Debugger::getProgramPath() const {
static Module *
getMaterializedModuleProvider(const std::string &Filename) {
- return ParseBytecodeFile(Filename);
+ if (Bitcode) {
+ return ParseBytecodeFile(Filename);
+ } else {
+ std::auto_ptr<MemoryBuffer> Buffer;
+ Buffer.reset(MemoryBuffer::getFileOrSTDIN(&Filename[0], Filename.size()));
+ if (Buffer.get())
+ return ParseBitcodeFile(Buffer.get());
+ return 0;
+ }
}
/// loadProgram - If a program is currently loaded, unload it. Then search