diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 08:22:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 08:22:29 +0000 |
commit | 4ba1f5e0011fa0c17ff121634bf8e88270f3b52e (patch) | |
tree | 3624e0ae4221f2ec1c6b3b03dfb809fd945b9ef0 /include/llvm/Object | |
parent | 35bf4d6d8018160557a92b86181acbcef76f86eb (diff) | |
download | llvm-4ba1f5e0011fa0c17ff121634bf8e88270f3b52e.tar.gz llvm-4ba1f5e0011fa0c17ff121634bf8e88270f3b52e.tar.bz2 llvm-4ba1f5e0011fa0c17ff121634bf8e88270f3b52e.tar.xz |
macho-dump: Add support for dumping segment load commands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object')
-rw-r--r-- | include/llvm/Object/MachOFormat.h | 33 | ||||
-rw-r--r-- | include/llvm/Object/MachOObject.h | 9 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/llvm/Object/MachOFormat.h b/include/llvm/Object/MachOFormat.h index 87e4f4241c..c0c61e1a83 100644 --- a/include/llvm/Object/MachOFormat.h +++ b/include/llvm/Object/MachOFormat.h @@ -146,6 +146,39 @@ namespace macho { uint32_t Size; }; + /// @name Load Command Structures + /// @{ + + struct SegmentLoadCommand { + uint32_t Type; + uint32_t Size; + char Name[16]; + uint32_t VMAddress; + uint32_t VMSize; + uint32_t FileOffset; + uint32_t FileSize; + uint32_t MaxVMProtection; + uint32_t InitialVMProtection; + uint32_t NumSections; + uint32_t Flags; + }; + + struct Segment64LoadCommand { + uint32_t Type; + uint32_t Size; + char Name[16]; + uint64_t VMAddress; + uint64_t VMSize; + uint64_t FileOffset; + uint64_t FileSize; + uint32_t MaxVMProtection; + uint32_t InitialVMProtection; + uint32_t NumSections; + uint32_t Flags; + }; + + /// @} + // See <mach-o/nlist.h>. enum SymbolTypeType { STT_Undefined = 0x00, diff --git a/include/llvm/Object/MachOObject.h b/include/llvm/Object/MachOObject.h index 4900768681..af235e2b0f 100644 --- a/include/llvm/Object/MachOObject.h +++ b/include/llvm/Object/MachOObject.h @@ -11,6 +11,7 @@ #define LLVM_OBJECT_MACHOOBJECT_H #include <string> +#include "llvm/ADT/InMemoryStruct.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Object/MachOFormat.h" @@ -88,6 +89,7 @@ public: /// @{ bool isLittleEndian() const { return IsLittleEndian; } + bool isSwappedEndian() const { return IsSwappedEndian; } bool is64Bit() const { return Is64Bit; } unsigned getHeaderSize() const { @@ -111,6 +113,13 @@ public: /// \brief Retrieve the information for the given load command. const LoadCommandInfo &getLoadCommandInfo(unsigned Index) const; + void ReadSegmentLoadCommand( + const LoadCommandInfo &LCI, + InMemoryStruct<macho::SegmentLoadCommand> &Res) const; + void ReadSegment64LoadCommand( + const LoadCommandInfo &LCI, + InMemoryStruct<macho::Segment64LoadCommand> &Res) const; + /// @} }; |