atosl 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +14 -0
- data/atosl.gemspec +25 -0
- data/bin/atosl +48 -0
- data/ext/atosl/atosl.c +153 -0
- data/ext/atosl/atosl.h +4 -0
- data/ext/atosl/converter.c +411 -0
- data/ext/atosl/converter.h +9 -0
- data/ext/atosl/cputype.h +347 -0
- data/ext/atosl/debug.h +11 -0
- data/ext/atosl/dwarf2.h +844 -0
- data/ext/atosl/extconf.rb +9 -0
- data/ext/atosl/fat.h +25 -0
- data/ext/atosl/loader.h +1440 -0
- data/ext/atosl/macho.c +3333 -0
- data/ext/atosl/macho.h +602 -0
- data/ext/atosl/main.h +4 -0
- data/ext/atosl/nlist.h +312 -0
- data/lib/atosl.rb +8 -0
- data/lib/atosl/version.rb +3 -0
- data/test/test_atosl.rb +8 -0
- metadata +114 -0
data/ext/atosl/macho.h
ADDED
@@ -0,0 +1,602 @@
|
|
1
|
+
#ifndef MACHO_H
|
2
|
+
#define MACHO_H
|
3
|
+
|
4
|
+
#ifdef Py_PYTHON_H
|
5
|
+
#include "python_wrapper.h"
|
6
|
+
#else
|
7
|
+
#define ATOSError 0
|
8
|
+
#define PyErr_NoMemory()
|
9
|
+
#define PyErr_Format(stream, format,...)
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#include <stdio.h>
|
13
|
+
#include <string.h>
|
14
|
+
#include <stdlib.h>
|
15
|
+
#include <assert.h>
|
16
|
+
#include <string.h>
|
17
|
+
#include "loader.h"
|
18
|
+
#include "fat.h"
|
19
|
+
#include "dwarf2.h"
|
20
|
+
#include "cputype.h"
|
21
|
+
#include "converter.h"
|
22
|
+
#include "nlist.h"
|
23
|
+
#include "debug.h"
|
24
|
+
|
25
|
+
/* We hold several abbreviation tables in memory at the same time. */
|
26
|
+
#ifndef ABBREV_HASH_SIZE
|
27
|
+
#define ABBREV_HASH_SIZE 121
|
28
|
+
#endif
|
29
|
+
#define INITIAL_LINE_VECTOR_LENGTH 1000
|
30
|
+
|
31
|
+
|
32
|
+
/* Languages represented in the symbol table and elsewhere.
|
33
|
+
*/
|
34
|
+
|
35
|
+
enum language
|
36
|
+
{
|
37
|
+
language_unknown, /* Language not known */
|
38
|
+
language_auto, /* Placeholder for automatic setting */
|
39
|
+
language_c, /* C */
|
40
|
+
language_cplus, /* C++ */
|
41
|
+
language_objc, /* Objective-C */
|
42
|
+
/* APPLE LOCAL objcplus */
|
43
|
+
language_objcplus, /* Objective-C++ */
|
44
|
+
language_java, /* Java */
|
45
|
+
language_fortran, /* Fortran */
|
46
|
+
language_m2, /* Modula-2 */
|
47
|
+
language_asm, /* Assembly language */
|
48
|
+
language_scm, /* Scheme / Guile */
|
49
|
+
language_pascal, /* Pascal */
|
50
|
+
language_ada, /* Ada */
|
51
|
+
language_minimal, /* All other languages, minimal support only */
|
52
|
+
nr_languages
|
53
|
+
};
|
54
|
+
|
55
|
+
|
56
|
+
typedef uint64_t CORE_ADDR;
|
57
|
+
// typedef unsigned int CORE_ADDR;
|
58
|
+
//struct address_range_descriptor AND CORE_ADDR should be changed for 64bits
|
59
|
+
|
60
|
+
struct lc_function_starts
|
61
|
+
{
|
62
|
+
uint32_t cmd;
|
63
|
+
uint32_t cmdsize;
|
64
|
+
uint32_t offset;
|
65
|
+
uint32_t size;
|
66
|
+
};
|
67
|
+
|
68
|
+
struct lc_data_in_code
|
69
|
+
{
|
70
|
+
uint32_t cmd;
|
71
|
+
uint32_t cmdsize;
|
72
|
+
uint32_t offset;
|
73
|
+
uint32_t size;
|
74
|
+
};
|
75
|
+
|
76
|
+
struct data_of_interest{
|
77
|
+
uint32_t text_vmaddr;
|
78
|
+
uint64_t text_vmaddr_64;
|
79
|
+
};
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
/* The data in a compilation unit header, after target2host
|
84
|
+
translation, looks like this. */
|
85
|
+
struct comp_unit_head
|
86
|
+
{
|
87
|
+
unsigned long length;
|
88
|
+
short version;
|
89
|
+
unsigned int abbrev_offset;
|
90
|
+
unsigned char addr_size;
|
91
|
+
unsigned char signed_addr_p;
|
92
|
+
|
93
|
+
/* Size of file offsets; either 4 or 8. */
|
94
|
+
unsigned int offset_size;
|
95
|
+
|
96
|
+
/* Size of the length field; either 4 or 12. */
|
97
|
+
unsigned int initial_length_size;
|
98
|
+
|
99
|
+
/* Offset to the first byte of this compilation unit header in the
|
100
|
+
.debug_info section, for resolving relative reference dies. */
|
101
|
+
unsigned int offset;
|
102
|
+
|
103
|
+
/* Pointer to this compilation unit header in the .debug_info
|
104
|
+
section. */
|
105
|
+
char *cu_head_ptr;
|
106
|
+
|
107
|
+
/* Pointer to the first die of this compilation unit. This will be
|
108
|
+
the first byte following the compilation unit header. */
|
109
|
+
char *first_die_ptr;
|
110
|
+
|
111
|
+
/* Pointer to the next compilation unit header in the program. */
|
112
|
+
struct comp_unit_head *next;
|
113
|
+
|
114
|
+
/* Base address of this compilation unit. */
|
115
|
+
CORE_ADDR base_address;
|
116
|
+
|
117
|
+
/* Non-zero if base_address has been set. */
|
118
|
+
int base_known;
|
119
|
+
};
|
120
|
+
|
121
|
+
/* Persistent data held for a compilation unit, even when not
|
122
|
+
processing it. We put a pointer to this structure in the
|
123
|
+
read_symtab_private field of the psymtab. If we encounter
|
124
|
+
inter-compilation-unit references, we also maintain a sorted
|
125
|
+
list of all compilation units. */
|
126
|
+
|
127
|
+
struct dwarf2_per_cu_data
|
128
|
+
{
|
129
|
+
unsigned long offset;
|
130
|
+
unsigned long length;
|
131
|
+
struct dwarf2_cu *cu;
|
132
|
+
};
|
133
|
+
|
134
|
+
|
135
|
+
/* .debug_pubnames header
|
136
|
+
Because of alignment constraints, this structure has padding and cannot
|
137
|
+
be mapped directly onto the beginning of the .debug_info section. */
|
138
|
+
struct aranges_header
|
139
|
+
{
|
140
|
+
unsigned int length; /* byte len of the .debug_aranges
|
141
|
+
contribution */
|
142
|
+
unsigned short version; /* version number -- 2 for dwarf
|
143
|
+
version 2 */
|
144
|
+
unsigned int info_offset; /* offset into .debug_info section */
|
145
|
+
unsigned char addr_size; /* byte size of an address */
|
146
|
+
unsigned char seg_size; /* byte size of segment descriptor */
|
147
|
+
} ;
|
148
|
+
|
149
|
+
struct address_range_descriptor{
|
150
|
+
CORE_ADDR beginning_addr;
|
151
|
+
uint64_t length;
|
152
|
+
//unsigned int length;
|
153
|
+
};
|
154
|
+
|
155
|
+
struct arange{
|
156
|
+
struct aranges_header aranges_header;
|
157
|
+
struct address_range_descriptor *address_range_descriptors;
|
158
|
+
unsigned int num_of_ards;
|
159
|
+
};
|
160
|
+
|
161
|
+
struct function_range
|
162
|
+
{
|
163
|
+
const char *name;
|
164
|
+
CORE_ADDR lowpc, highpc;
|
165
|
+
int seen_line;
|
166
|
+
struct function_range *next;
|
167
|
+
};
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
/* This data structure holds the information of an abbrev. */
|
172
|
+
struct abbrev_info
|
173
|
+
{
|
174
|
+
unsigned int number; /* number identifying abbrev */
|
175
|
+
enum dwarf_tag tag; /* dwarf tag */
|
176
|
+
unsigned short has_children; /* boolean */
|
177
|
+
unsigned short num_attrs; /* number of attributes */
|
178
|
+
struct attr_abbrev *attrs; /* an array of attribute descriptions */
|
179
|
+
struct abbrev_info *next; /* next in chain */
|
180
|
+
};
|
181
|
+
|
182
|
+
|
183
|
+
struct dwarf2_per_objfile
|
184
|
+
{
|
185
|
+
/* Sizes of debugging sections. */
|
186
|
+
unsigned int info_size;
|
187
|
+
unsigned int abbrev_size;
|
188
|
+
unsigned int line_size;
|
189
|
+
unsigned int pubnames_size;
|
190
|
+
unsigned int aranges_size;
|
191
|
+
unsigned int loc_size;
|
192
|
+
unsigned int macinfo_size;
|
193
|
+
unsigned int str_size;
|
194
|
+
unsigned int ranges_size;
|
195
|
+
unsigned int inlined_size;
|
196
|
+
unsigned int pubtypes_size;
|
197
|
+
unsigned int frame_size;
|
198
|
+
unsigned int eh_frame_size;
|
199
|
+
|
200
|
+
/* Loaded data from the sections. */
|
201
|
+
char *info_buffer;
|
202
|
+
char *abbrev_buffer;
|
203
|
+
char *line_buffer;
|
204
|
+
char *pubnames_buffer;
|
205
|
+
char *aranges_buffer;
|
206
|
+
char *loc_buffer;
|
207
|
+
char *macinfo_buffer;
|
208
|
+
char *str_buffer;
|
209
|
+
char *ranges_buffer;
|
210
|
+
char *inlined_buffer;
|
211
|
+
char *pubtypes_buffer;
|
212
|
+
char *frame_buffer;
|
213
|
+
char *eh_frame_buffer;
|
214
|
+
//char *
|
215
|
+
|
216
|
+
/* A list of all the compilation units. This is used to locate
|
217
|
+
the target compilation unit of a particular reference. */
|
218
|
+
struct dwarf2_per_cu_data **all_comp_units;
|
219
|
+
struct arange **all_aranges;
|
220
|
+
|
221
|
+
/* The number of compilation units in ALL_COMP_UNITS. */
|
222
|
+
int n_comp_units;
|
223
|
+
int n_aranges;
|
224
|
+
|
225
|
+
/* A chain of compilation units that are currently read in, so that
|
226
|
+
they can be freed later. */
|
227
|
+
struct abbrev_info **dwarf2_abbrevs;
|
228
|
+
};
|
229
|
+
|
230
|
+
struct attr_abbrev
|
231
|
+
{
|
232
|
+
enum dwarf_attribute name;
|
233
|
+
enum dwarf_form form;
|
234
|
+
};
|
235
|
+
|
236
|
+
|
237
|
+
/* Blocks are a bunch of untyped bytes. */
|
238
|
+
struct dwarf_block
|
239
|
+
{
|
240
|
+
unsigned int size;
|
241
|
+
char *data;
|
242
|
+
};
|
243
|
+
|
244
|
+
/* Attributes have a name and a value */
|
245
|
+
struct attribute
|
246
|
+
{
|
247
|
+
enum dwarf_attribute name;
|
248
|
+
enum dwarf_form form;
|
249
|
+
union
|
250
|
+
{
|
251
|
+
char *str;
|
252
|
+
struct dwarf_block *blk;
|
253
|
+
unsigned long unsnd;
|
254
|
+
long int snd;
|
255
|
+
CORE_ADDR addr;
|
256
|
+
}
|
257
|
+
u;
|
258
|
+
};
|
259
|
+
|
260
|
+
/* This data structure holds a complete die structure. */
|
261
|
+
struct die_info
|
262
|
+
{
|
263
|
+
enum dwarf_tag tag; /* Tag indicating type of die */
|
264
|
+
unsigned int abbrev; /* Abbrev number */
|
265
|
+
unsigned int offset; /* Offset in .debug_info section */
|
266
|
+
/* APPLE LOCAL - dwarf repository */
|
267
|
+
//unsigned int repository_id; /* Id number in debug repository */
|
268
|
+
unsigned int num_attrs; /* Number of attributes */
|
269
|
+
struct attribute *attrs; /* An array of attributes */
|
270
|
+
//struct die_info *next_ref; /* Next die in ref hash table */
|
271
|
+
|
272
|
+
/* The dies in a compilation unit form an n-ary tree. PARENT
|
273
|
+
points to this die's parent; CHILD points to the first child of
|
274
|
+
this node; and all the children of a given node are chained
|
275
|
+
together via their SIBLING fields, terminated by a die whose
|
276
|
+
tag is zero. */
|
277
|
+
struct die_info *child; /* Its first child, if any. */
|
278
|
+
struct die_info *sibling; /* Its next sibling, if any. */
|
279
|
+
struct die_info *parent; /* Its parent, if any. */
|
280
|
+
|
281
|
+
//struct type *type; /* Cached type information */
|
282
|
+
};
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
/* Internal state when decoding a particular compilation unit. */
|
287
|
+
struct dwarf2_cu
|
288
|
+
{
|
289
|
+
/* The objfile containing this compilation unit. */
|
290
|
+
//struct objfile *objfile;
|
291
|
+
|
292
|
+
/* The header of the compilation unit.
|
293
|
+
|
294
|
+
FIXME drow/2003-11-10: Some of the things from the comp_unit_head
|
295
|
+
should logically be moved to the dwarf2_cu structure. */
|
296
|
+
struct comp_unit_head header;
|
297
|
+
|
298
|
+
/* The language we are debugging. */
|
299
|
+
enum language language;
|
300
|
+
//const struct language_defn *language_defn;
|
301
|
+
|
302
|
+
const char *producer;
|
303
|
+
|
304
|
+
/* APPLE LOCAL: Retain the compilation directory pathname for header
|
305
|
+
file relative pathnames (via gcc parameters like "-I../../../include"). */
|
306
|
+
char *comp_dir;
|
307
|
+
|
308
|
+
struct dwarf2_per_objfile *dwarf2_per_objfile;
|
309
|
+
|
310
|
+
/* The generic symbol table building routines have separate lists for
|
311
|
+
file scope symbols and all all other scopes (local scopes). So
|
312
|
+
we need to select the right one to pass to add_symbol_to_list().
|
313
|
+
We do it by keeping a pointer to the correct list in list_in_scope.
|
314
|
+
|
315
|
+
FIXME: The original dwarf code just treated the file scope as the
|
316
|
+
first local scope, and all other local scopes as nested local
|
317
|
+
scopes, and worked fine. Check to see if we really need to
|
318
|
+
distinguish these in buildsym.c. */
|
319
|
+
//struct pending **list_in_scope;
|
320
|
+
|
321
|
+
/* Maintain an array of referenced fundamental types for the current
|
322
|
+
compilation unit being read. For DWARF version 1, we have to construct
|
323
|
+
the fundamental types on the fly, since no information about the
|
324
|
+
fundamental types is supplied. Each such fundamental type is created by
|
325
|
+
calling a language dependent routine to create the type, and then a
|
326
|
+
pointer to that type is then placed in the array at the index specified
|
327
|
+
by it's FT_<TYPENAME> value. The array has a fixed size set by the
|
328
|
+
FT_NUM_MEMBERS compile time constant, which is the number of predefined
|
329
|
+
fundamental types gdb knows how to construct. */
|
330
|
+
//struct type *ftypes[FT_NUM_MEMBERS]; /* Fundamental types */
|
331
|
+
|
332
|
+
/* DWARF abbreviation table associated with this compilation unit. */
|
333
|
+
struct abbrev_info **dwarf2_abbrevs;
|
334
|
+
|
335
|
+
/* Storage for the abbrev table. */
|
336
|
+
|
337
|
+
/* Hash table holding all the loaded partial DIEs. */
|
338
|
+
//htab_t partial_dies;
|
339
|
+
|
340
|
+
/* Storage for things with the same lifetime as this read-in compilation
|
341
|
+
unit, including partial DIEs. */
|
342
|
+
//struct obstack comp_unit_obstack;
|
343
|
+
|
344
|
+
/* When multiple dwarf2_cu structures are living in memory, this field
|
345
|
+
chains them all together, so that they can be released efficiently.
|
346
|
+
We will probably also want a generation counter so that most-recently-used
|
347
|
+
compilation units are cached... */
|
348
|
+
|
349
|
+
/* Backchain to our per_cu entry if the tree has been built. */
|
350
|
+
struct dwarf2_per_cu_data *per_cu;
|
351
|
+
|
352
|
+
/* How many compilation units ago was this CU last referenced? */
|
353
|
+
//int last_used;
|
354
|
+
|
355
|
+
/* A hash table of die offsets for following references. */
|
356
|
+
//struct die_info *die_ref_table[REF_HASH_SIZE];
|
357
|
+
|
358
|
+
/* Full DIEs if read in. */
|
359
|
+
struct die_info *dies;
|
360
|
+
|
361
|
+
/* A set of pointers to dwarf2_per_cu_data objects for compilation
|
362
|
+
units referenced by this one. Only set during full symbol processing;
|
363
|
+
partial symbol tables do not have dependencies. */
|
364
|
+
//htab_t dependencies;
|
365
|
+
|
366
|
+
/* Mark used when releasing cached dies. */
|
367
|
+
//unsigned int mark : 1;
|
368
|
+
|
369
|
+
/* This flag will be set if this compilation unit might include
|
370
|
+
inter-compilation-unit references. */
|
371
|
+
//unsigned int has_form_ref_addr : 1;
|
372
|
+
|
373
|
+
/* This flag will be set if this compilation unit includes any
|
374
|
+
DW_TAG_namespace DIEs. If we know that there are explicit
|
375
|
+
DIEs for namespaces, we don't need to try to infer them
|
376
|
+
from mangled names. */
|
377
|
+
//unsigned int has_namespace_info : 1;
|
378
|
+
|
379
|
+
/* APPLE LOCAL begin dwarf repository */
|
380
|
+
//sqlite3 *repository;
|
381
|
+
|
382
|
+
//char *repository_name;
|
383
|
+
/* APPLE LOCAL end dwarf repository */
|
384
|
+
|
385
|
+
/* APPLE LOCAL debug map */
|
386
|
+
//struct oso_to_final_addr_map *addr_map;
|
387
|
+
};
|
388
|
+
|
389
|
+
/* .debug_line statement program prologue
|
390
|
+
Because of alignment constraints, this structure has padding and cannot
|
391
|
+
be mapped directly onto the beginning of the .debug_info section. */
|
392
|
+
struct statement_prologue
|
393
|
+
{
|
394
|
+
unsigned int total_length; /* byte length of the statement
|
395
|
+
information */
|
396
|
+
unsigned short version; /* version number -- 2 for DWARF
|
397
|
+
version 2 */
|
398
|
+
unsigned int prologue_length; /* # bytes between prologue &
|
399
|
+
stmt program */
|
400
|
+
unsigned char minimum_instruction_length; /* byte size of
|
401
|
+
smallest instr */
|
402
|
+
unsigned char default_is_stmt; /* initial value of is_stmt
|
403
|
+
register */
|
404
|
+
char line_base;
|
405
|
+
unsigned char line_range;
|
406
|
+
unsigned char opcode_base; /* number assigned to first special
|
407
|
+
opcode */
|
408
|
+
unsigned char *standard_opcode_lengths;
|
409
|
+
};
|
410
|
+
|
411
|
+
/* The line number information for a compilation unit (found in the
|
412
|
+
.debug_line section) begins with a "statement program header",
|
413
|
+
which contains the following information. */
|
414
|
+
struct line_header
|
415
|
+
{
|
416
|
+
unsigned int total_length;
|
417
|
+
unsigned short version;
|
418
|
+
unsigned int header_length;
|
419
|
+
unsigned char minimum_instruction_length;
|
420
|
+
unsigned char default_is_stmt;
|
421
|
+
int line_base;
|
422
|
+
unsigned char line_range;
|
423
|
+
unsigned char opcode_base;
|
424
|
+
|
425
|
+
/* standard_opcode_lengths[i] is the number of operands for the
|
426
|
+
standard opcode whose value is i. This means that
|
427
|
+
standard_opcode_lengths[0] is unused, and the last meaningful
|
428
|
+
element is standard_opcode_lengths[opcode_base - 1]. */
|
429
|
+
unsigned char *standard_opcode_lengths;
|
430
|
+
|
431
|
+
/* The include_directories table. NOTE! These strings are not
|
432
|
+
allocated with xmalloc; instead, they are pointers into
|
433
|
+
debug_line_buffer. If you try to free them, `free' will get
|
434
|
+
indigestion. */
|
435
|
+
unsigned int num_include_dirs, include_dirs_size;
|
436
|
+
char **include_dirs;
|
437
|
+
|
438
|
+
/* The file_names table. NOTE! These strings are not allocated
|
439
|
+
with xmalloc; instead, they are pointers into debug_line_buffer.
|
440
|
+
Don't try to free them directly. */
|
441
|
+
unsigned int num_file_names, file_names_size;
|
442
|
+
struct file_entry
|
443
|
+
{
|
444
|
+
char *name;
|
445
|
+
unsigned int dir_index;
|
446
|
+
unsigned int mod_time;
|
447
|
+
unsigned int length;
|
448
|
+
int included_p; /* Non-zero if referenced by the Line Number Program. */
|
449
|
+
} *file_names;
|
450
|
+
|
451
|
+
/* The start and end of the statement program following this
|
452
|
+
header. These point into dwarf2_per_objfile->line_buffer. */
|
453
|
+
char *statement_program_start, *statement_program_end;
|
454
|
+
};
|
455
|
+
|
456
|
+
/* Each item represents a line-->pc (or the reverse) mapping. This is
|
457
|
+
somewhat more wasteful of space than one might wish, but since only
|
458
|
+
the files which are actually debugged are read in to core, we don't
|
459
|
+
waste much space. */
|
460
|
+
|
461
|
+
struct linetable_entry
|
462
|
+
{
|
463
|
+
int line;
|
464
|
+
CORE_ADDR pc;
|
465
|
+
};
|
466
|
+
|
467
|
+
/* The order of entries in the linetable is significant. They should
|
468
|
+
be sorted by increasing values of the pc field. If there is more than
|
469
|
+
one entry for a given pc, then I'm not sure what should happen (and
|
470
|
+
I not sure whether we currently handle it the best way).
|
471
|
+
|
472
|
+
Example: a C for statement generally looks like this
|
473
|
+
|
474
|
+
10 0x100 - for the init/test part of a for stmt.
|
475
|
+
20 0x200
|
476
|
+
30 0x300
|
477
|
+
10 0x400 - for the increment part of a for stmt.
|
478
|
+
|
479
|
+
If an entry has a line number of zero, it marks the start of a PC
|
480
|
+
range for which no line number information is available. It is
|
481
|
+
acceptable, though wasteful of table space, for such a range to be
|
482
|
+
zero length. */
|
483
|
+
|
484
|
+
struct linetable
|
485
|
+
{
|
486
|
+
int nitems;
|
487
|
+
int lines_are_chars;
|
488
|
+
|
489
|
+
/* Actually NITEMS elements. If you don't like this use of the
|
490
|
+
`struct hack', you can shove it up your ANSI (seriously, if the
|
491
|
+
committee tells us how to do it, we can probably go along). */
|
492
|
+
struct linetable_entry item[1];
|
493
|
+
};
|
494
|
+
|
495
|
+
/* The list of sub-source-files within the current individual
|
496
|
+
compilation. Each file gets its own symtab with its own linetable
|
497
|
+
and associated info, but they all share one blockvector. */
|
498
|
+
|
499
|
+
struct subfile
|
500
|
+
{
|
501
|
+
//struct subfile *next;
|
502
|
+
//char *name;
|
503
|
+
//char *dirname;
|
504
|
+
struct linetable *line_vector;
|
505
|
+
int line_vector_length;
|
506
|
+
enum language language;
|
507
|
+
//char *debugformat;
|
508
|
+
};
|
509
|
+
|
510
|
+
struct thin_macho{
|
511
|
+
uint8_t uuid[16];
|
512
|
+
char *data;
|
513
|
+
char *strings;
|
514
|
+
long int size;
|
515
|
+
cpu_type_t cputype; /* cpu specifier */
|
516
|
+
cpu_subtype_t cpusubtype; /* machine specifier */
|
517
|
+
struct dwarf2_per_objfile* dwarf2_per_objfile;
|
518
|
+
struct nlist *all_symbols;
|
519
|
+
struct nlist_64 *all_symbols64;
|
520
|
+
uint32_t nsyms;
|
521
|
+
uint32_t strsize;
|
522
|
+
/* * The binary image's dynamic symbol information, if any. */
|
523
|
+
struct {
|
524
|
+
/* * Symbol table index for global symbols. */
|
525
|
+
uint32_t firstGlobalSymbol;
|
526
|
+
|
527
|
+
/* * Number of global symbols. */
|
528
|
+
uint32_t numGlobalSymbols;
|
529
|
+
|
530
|
+
/* * Symbol table index for local symbols. */
|
531
|
+
uint32_t firstLocalSymbol;
|
532
|
+
|
533
|
+
/* * Number of local symbols. */
|
534
|
+
uint32_t numLocalSymbols;
|
535
|
+
} symbolInformation;
|
536
|
+
};
|
537
|
+
|
538
|
+
struct target_file{
|
539
|
+
struct thin_macho** thin_machos;
|
540
|
+
uint32_t numofarchs;
|
541
|
+
};
|
542
|
+
int select_thin_macho_by_arch(struct target_file *tf, const char *arch);
|
543
|
+
void print_thin_macho_aranges(struct thin_macho *thin_macho);
|
544
|
+
int parse_load_command(char *macho_str, long *offset, struct load_command *lc, struct thin_macho*tm);
|
545
|
+
void print_all_dwarf2_per_objfile(struct dwarf2_per_objfile *dwarf2_per_objfile);
|
546
|
+
void get_uuid_of_thin(struct thin_macho*thin_macho, char *uuid);
|
547
|
+
void free_target_file(struct target_file *tf);
|
548
|
+
int lookup_by_address_in_dwarf(struct thin_macho *thin_macho, CORE_ADDR integer_address);
|
549
|
+
int lookup_by_address_in_symtable(struct thin_macho *thin_macho, CORE_ADDR integer_address);
|
550
|
+
int parse_fat_arch(FILE *fp, struct fat_arch *fa, struct thin_macho**thin_macho, uint32_t magic_number);
|
551
|
+
int parse_universal(FILE *fp, uint32_t magic_number, struct target_file *tf);
|
552
|
+
int parse_normal(FILE *fp, uint32_t magic_number, struct target_file *tf);
|
553
|
+
struct target_file *parse_file(const char *filename);
|
554
|
+
int parse_macho(struct thin_macho*thin_macho);
|
555
|
+
int parse_dwarf2_per_objfile(struct dwarf2_per_objfile *dwarf2_per_objfile);
|
556
|
+
int process_lc_command(char *macho_str, long *offset);
|
557
|
+
int process_lc_dyld_info(char *macho_str, long *offset);
|
558
|
+
int process_lc_dyld_info_only(char *macho_str, long *offset);
|
559
|
+
int process_lc_version_min_iphoneos(char *macho_str, long *offset);
|
560
|
+
int process_lc_version_min_macosx(char *macho_str, long *offset);
|
561
|
+
int process_lc_source_version(char *macho_str, long *offset);
|
562
|
+
int process_lc_reexport_dylib(char *macho_str, long *offset);
|
563
|
+
int process_lc_uuid(char *macho_str, long *offset, struct thin_macho*tm);
|
564
|
+
int process_lc_segment(char *macho_str, long *offset, struct thin_macho*tm);
|
565
|
+
int process_lc_segment_64(char *macho_str, long *offset, struct thin_macho*tm);
|
566
|
+
int process_lc_sub_client(char *macho_str, long *offset);
|
567
|
+
int process_lc_sub_library(char *macho_str, long *offset);
|
568
|
+
int process_lc_sub_umbrella(char *macho_str, long *offset);
|
569
|
+
int process_lc_sub_framework(char *macho_str, long *offset);
|
570
|
+
int process_lc_twolevel_hints(char *macho_str, long *offset);
|
571
|
+
int process_lc_routines_64(char *macho_str, long *offset);
|
572
|
+
int process_lc_routines(char *macho_str, long *offset);
|
573
|
+
int process_lc_id_dylinker(char *macho_str, long *offset);
|
574
|
+
int process_lc_load_dylinker(char *macho_str, long *offset);
|
575
|
+
int process_lc_prebound_dylib(char *macho_str, long *offset);
|
576
|
+
int process_lc_id_dylib(char *macho_str, long *offset);
|
577
|
+
int process_lc_load_dylib(char *macho_str, long *offset);
|
578
|
+
int process_lc_thread(char *macho_str, long *offset);
|
579
|
+
int process_lc_unixthread(char *macho_str, long *offset);
|
580
|
+
int process_lc_dysymtab(char *macho_str, long *offset, struct thin_macho*tm);
|
581
|
+
int process_lc_symtab(char *macho_str, long *offset, struct thin_macho*tm);
|
582
|
+
int process_lc_data_in_code(char *macho_str, long *offset);
|
583
|
+
int process_lc_function_starts(char *macho_str, long *offset);
|
584
|
+
int process_lc_symseg(char *macho_str, long *offset);
|
585
|
+
int process_lc_loadfvmlib(char *macho_str, long *offset);
|
586
|
+
int process_lc_idfvmlib(char *macho_str, long *offset);
|
587
|
+
int process_lc_ident(char *macho_str, long *offset);
|
588
|
+
int process_lc_fvmfile(char *macho_str, long *offset);
|
589
|
+
int process_lc_prepage(char *macho_str, long *offset);
|
590
|
+
int process_lc_sub_client(char *macho_str, long *offset);
|
591
|
+
int process_lc_prebind_cksum(char *macho_str, long *offset);
|
592
|
+
int process_lc_load_weak_dylib(char *macho_str, long *offset);
|
593
|
+
int process_lc_rpath(char *macho_str, long *offset);
|
594
|
+
int process_lc_code_signature(char *macho_str, long *offset);
|
595
|
+
int process_lc_segment_split_info(char *macho_str, long *offset);
|
596
|
+
int process_lc_lazy_load_dylib(char *macho_str, long *offset);
|
597
|
+
int process_lc_encryption_info(char *macho_str, long *offset);
|
598
|
+
int process_lc_load_upward_dylib(char *macho_str, long *offset);
|
599
|
+
int process_lc_dyld_environment(char *macho_str, long *offset);
|
600
|
+
int process_lc_main(char *macho_str, long *offset);
|
601
|
+
int process_lc_dylib_code_sign_drs(char *macho_str, long *offset);
|
602
|
+
#endif /* MACHO_H */
|