mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 11:17:31 +00:00
teach this to read from bitcode files
llvm-svn: 36843
This commit is contained in:
parent
5c5d5f3f88
commit
8394ded8eb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user