cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
osx_fat_reader.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Read OS X Fat Binaries
4
5
Author:
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
25
class
osx_fat_readert
26
{
27
public
:
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
36
private
:
37
messaget
log
;
38
bool
has_gb_arch
;
39
};
40
41
bool
is_osx_fat_header
(
char
hdr[8]);
42
43
class
osx_mach_o_readert
44
{
45
public
:
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>;
61
sectionst
sections
;
62
63
bool
has_section
(
const
std::string &name)
const
64
{
65
return
sections
.find(name) !=
sections
.end();
66
}
67
68
private
:
69
messaget
log
;
70
std::istream &
in
;
71
72
void
process_commands
(uint32_t ncmds, std::size_t offset,
bool
need_swap);
73
74
void
process_sections_32
(uint32_t nsects,
bool
need_swap);
75
void
process_sections_64
(uint32_t nsects,
bool
need_swap);
76
};
77
78
bool
is_osx_mach_object
(
char
hdr[4]);
79
80
#endif
// CPROVER_GOTO_PROGRAMS_OSX_FAT_READER_H
message_handlert
Definition
message.h:27
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition
message.h:154
osx_fat_readert::log
messaget log
Definition
osx_fat_reader.h:37
osx_fat_readert::osx_fat_readert
osx_fat_readert(std::ifstream &, message_handlert &)
Definition
osx_fat_reader.cpp:74
osx_fat_readert::has_gb_arch
bool has_gb_arch
Definition
osx_fat_reader.h:38
osx_fat_readert::extract_gb
bool extract_gb(const std::string &source, const std::string &dest) const
Definition
osx_fat_reader.cpp:123
osx_fat_readert::has_gb
bool has_gb() const
Definition
osx_fat_reader.h:30
osx_mach_o_readert::in
std::istream & in
Definition
osx_fat_reader.h:70
osx_mach_o_readert::process_commands
void process_commands(uint32_t ncmds, std::size_t offset, bool need_swap)
Definition
osx_fat_reader.cpp:199
osx_mach_o_readert::log
messaget log
Definition
osx_fat_reader.h:69
osx_mach_o_readert::sectionst
std::map< std::string, sectiont > sectionst
Definition
osx_fat_reader.h:60
osx_mach_o_readert::osx_mach_o_readert
osx_mach_o_readert(std::istream &, message_handlert &)
Definition
osx_fat_reader.cpp:270
osx_mach_o_readert::process_sections_32
void process_sections_32(uint32_t nsects, bool need_swap)
Definition
osx_fat_reader.cpp:151
osx_mach_o_readert::has_section
bool has_section(const std::string &name) const
Definition
osx_fat_reader.h:63
osx_mach_o_readert::sections
sectionst sections
Definition
osx_fat_reader.h:61
osx_mach_o_readert::process_sections_64
void process_sections_64(uint32_t nsects, bool need_swap)
Definition
osx_fat_reader.cpp:175
is_osx_fat_header
bool is_osx_fat_header(char hdr[8])
Definition
osx_fat_reader.cpp:57
is_osx_mach_object
bool is_osx_mach_object(char hdr[4])
Definition
osx_fat_reader.cpp:135
message.h
osx_mach_o_readert::sectiont::sectiont
sectiont(const std::string &_name, std::size_t _offset, std::size_t _size)
Definition
osx_fat_reader.h:50
osx_mach_o_readert::sectiont::name
std::string name
Definition
osx_fat_reader.h:55
osx_mach_o_readert::sectiont::offset
std::size_t offset
Definition
osx_fat_reader.h:56
osx_mach_o_readert::sectiont::size
std::size_t size
Definition
osx_fat_reader.h:57
goto-programs
osx_fat_reader.h
Generated by
1.17.0