blob: 63108d56ecdc1199c9b103c057a43d3533f18b96 [file] [log] [blame]
Benjamin Kramer0b8b7712011-09-19 17:56:04 +00001//===-- llvm-objdump.h ----------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_OBJDUMP_H
11#define LLVM_OBJDUMP_H
12
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/CommandLine.h"
15#include "llvm/Support/DataTypes.h"
16#include "llvm/Support/MemoryObject.h"
17
18namespace llvm {
19
20extern cl::opt<std::string> TripleName;
21extern cl::opt<std::string> ArchName;
22
23// Various helper functions.
24void DumpBytes(StringRef bytes);
25void DisassembleInputLibObject(StringRef Filename);
26void DisassembleInputMachO(StringRef Filename);
27
28class StringRefMemoryObject : public MemoryObject {
29private:
30 StringRef Bytes;
31public:
32 StringRefMemoryObject(StringRef bytes) : Bytes(bytes) {}
33
34 uint64_t getBase() const { return 0; }
35 uint64_t getExtent() const { return Bytes.size(); }
36
37 int readByte(uint64_t Addr, uint8_t *Byte) const {
38 if (Addr >= getExtent())
39 return -1;
40 *Byte = Bytes[Addr];
41 return 0;
42 }
43};
44
45}
46
47#endif