mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
macho-dump: More sketching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75373ac0c3
commit
ad1252498d
@ -11,20 +11,46 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Object/MachOObject.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
|
||||
static cl::opt<std::string>
|
||||
InputFile(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpSectionData("dump-section-data", cl::desc("Dump the contents of sections"),
|
||||
cl::init(false));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *ProgramName = argv[0];
|
||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "llvm Mach-O dumping tool\n");
|
||||
|
||||
errs() << ProgramName << ": " << "not yet implemented!" << "\n";
|
||||
return 1;
|
||||
// Load the input file.
|
||||
std::string ErrorStr;
|
||||
OwningPtr<MemoryBuffer> InputBuffer(
|
||||
MemoryBuffer::getFileOrSTDIN(InputFile, &ErrorStr));
|
||||
if (!InputBuffer) {
|
||||
errs() << ProgramName << ": " << "unable to read input: '"
|
||||
<< ErrorStr << "'\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Construct the Mach-O wrapper object.
|
||||
OwningPtr<MachOObject> InputObject(
|
||||
MachOObject::LoadFromBuffer(InputBuffer.take(), &ErrorStr));
|
||||
if (!InputObject) {
|
||||
errs() << ProgramName << ": " << "unable to load object: '"
|
||||
<< ErrorStr << "'\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
errs() << "ok\n";
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user