CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
osx_fat_reader.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Read OS X Fat Binaries
4
5Author:
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_GOTO_PROGRAMS_OSX_FAT_READER_H
13#define CPROVER_GOTO_PROGRAMS_OSX_FAT_READER_H
14
15#include <util/message.h>
16
17#include <cstdint>
18#include <fstream>
19#include <map>
20#include <string>
21
22// we follow
23// https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
24
26{
27public:
28 osx_fat_readert(std::ifstream &, message_handlert &);
29
30 bool has_gb() const { return has_gb_arch; }
31
32 bool extract_gb(
33 const std::string &source,
34 const std::string &dest) const;
35
36private:
39};
40
41bool is_osx_fat_header(char hdr[8]);
42
44{
45public:
46 osx_mach_o_readert(std::istream &, message_handlert &);
47
48 struct sectiont
49 {
50 sectiont(const std::string &_name, std::size_t _offset, std::size_t _size)
51 : name(_name), offset(_offset), size(_size)
52 {
53 }
54
55 std::string name;
56 std::size_t offset;
57 std::size_t size;
58 };
59
60 using sectionst = std::map<std::string, sectiont>;
62
63 bool has_section(const std::string &name) const
64 {
65 return sections.find(name) != sections.end();
66 }
67
68private:
70 std::istream &in;
71
72 void process_commands(uint32_t ncmds, std::size_t offset, bool need_swap);
73
76};
77
78bool is_osx_mach_object(char hdr[4]);
79
80#endif // CPROVER_GOTO_PROGRAMS_OSX_FAT_READER_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
bool extract_gb(const std::string &source, const std::string &dest) const
bool has_gb() const
std::istream & in
void process_commands(uint32_t ncmds, std::size_t offset, bool need_swap)
std::map< std::string, sectiont > sectionst
void process_sections_32(uint32_t nsects, bool need_swap)
bool has_section(const std::string &name) const
void process_sections_64(uint32_t nsects, bool need_swap)
bool is_osx_fat_header(char hdr[8])
bool is_osx_mach_object(char hdr[4])
sectiont(const std::string &_name, std::size_t _offset, std::size_t _size)