UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
syms_mach_parser.c
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#ifndef SYMS_MACH_PARSER_C
4#define SYMS_MACH_PARSER_C
5
7//~ NOTE(allen): MACH Parser Functions
8
12
13 //- read properties from magic
14 SYMS_U32 magic = 0;
15 syms_based_range_read_struct(base, range, 0, &magic);
16
18 SYMS_B32 is_swapped = syms_false;
20 switch (magic){
22 {
25 }break;
27 {
29 }break;
30
32 {
34 is_swapped = syms_true;
36 }break;
38 {
40 is_swapped = syms_true;
41 }break;
42 }
43
44 if (is_mach){
45 //- read header
47 SYMS_MachHeader64 header = {0};
48 if (is_32){
51 if (is_swapped){
53 }
55 }
56 else{
57 after_header_off = syms_based_range_read_struct(base, range, 0, &header);
58 if (is_swapped){
60 }
61 }
62
63 //- gather segment and section lists
65
68 SYMS_U32 segment_count = 0;
69
72 SYMS_U32 section_count = 0;
73
74 SYMS_U64Range bind_ranges[SYMS_MachBindTable_COUNT]; syms_memzero_struct(&bind_ranges[0]);
75 SYMS_U64Range export_range = syms_make_u64_range(0,0);
76
78
80
81 { // push null dylib
84 }
85
87 for (SYMS_U32 i = 0; i < header.ncmds; i += 1){
88 //- align read offset
89 SYMS_U64 cmd_off = 0;
90 if (is_32){
92 }
93 else{
95 }
96
97 //- read command
100 switch (lc.type){
102 {
103 syms_based_range_read_struct(base, range, cmd_off, &symtab);
104 }break;
105
107 {
110 if (is_swapped){
112 }
114
115 // push segment node
119 segment_count += 1;
120
121 // loop over sections
123 SYMS_U64 sec_count = segment_command32.nsects;
124 for (SYMS_U32 k = 0; k < sec_count; k += 1){
125 // read section 64
126 SYMS_U64 sec_off = next_sec_off;
128 syms_based_range_read_struct(base, range, sec_off, &section32);
129 if (is_swapped){
131 }
132 next_sec_off = sec_off + sizeof(SYMS_MachSection32);
133
134 // push section node
138 section_count += 1;
139 }
140 }break;
141
143 {
144 // read segment 64
147 if (is_swapped){
149 }
151
152 // push segment node
156 segment_count += 1;
157
158 // loop over sections
160 SYMS_U64 sec_count = segment_command64.nsects;
161 for (SYMS_U32 k = 0; k < sec_count; k += 1){
162 // read section 64
163 SYMS_U64 sec_off = next_sec_off;
165 syms_based_range_read_struct(base, range, sec_off, &section64);
166 if (is_swapped){
168 }
169 next_sec_off = sec_off + sizeof(SYMS_MachSection64);
170
171 // push section node
173 section_node->data = section64;
175 section_count += 1;
176 }
177 }break;
178
180 {
183 if (is_swapped){
185 }
186
187 bind_ranges[SYMS_MachBindTable_REGULAR] = syms_make_u64_inrange(range, dyld.bind_off, dyld.bind_size);
188 bind_ranges[SYMS_MachBindTable_LAZY] = syms_make_u64_inrange(range, dyld.lazy_bind_off, dyld.lazy_bind_size);
189 bind_ranges[SYMS_MachBindTable_WEAK] = syms_make_u64_inrange(range, dyld.weak_bind_off, dyld.weak_bind_size);
190 export_range = syms_make_u64_inrange(range, dyld.export_off, dyld.export_size);
191 }break;
192
197 {
199 syms_based_range_read_struct(base, range, cmd_off, &cmd);
200 SYMS_MachDylib *dylib = &cmd.dylib;
201 if (is_swapped){
203 }
207 }break;
208 }
209
210 next_cmd_off = cmd_off + lc.size;
211 }
212
213 //- segment array from list
215 {
218 SYMS_MachSegmentCommand64 *segment_opl = segments + segment_count;
220 *segment_ptr = segment_node->data;
221 }
222 }
223
224 //- section array from list
225 SYMS_MachSection64 *sections = syms_push_array(arena, SYMS_MachSection64, section_count);
226 {
229 SYMS_MachSection64 *section_opl = sections + section_count;
231 *section_ptr = section_node->data;
232 }
233 }
234
235 //- fill result
236 result = syms_push_array(arena, SYMS_MachBinAccel, 1);
237 result->load_command_count = header.ncmds;
240 result->arch = syms_mach_arch_from_cputype(header.cputype);
241 result->is_swapped = is_swapped;
242 result->symtab = symtab;
243 result->segment_count = segment_count;
244 result->segments = segments;
245 result->section_count = section_count;
246 result->sections = sections;
247 syms_memmove(&result->bind_ranges[0], &bind_ranges[0], sizeof(bind_ranges));
248 result->export_range = export_range;
249 { // convert dylib list to array
250 result->dylib_count = 0;
251 result->dylibs = syms_push_array(arena, SYMS_MachParsedDylib, dylib_list.count);
252 for (SYMS_MachDylibNode *n = dylib_list.first; n != 0; n = n->next){
253 result->dylibs[result->dylib_count++] = n->data;
254 }
255 }
256
258 }
259
260 return(result);
261}
262
265 void *base = data.str;
266 SYMS_U64Range range = syms_make_u64_range(0, data.size);
267
268 SYMS_U32 magic = 0;
269 syms_based_range_read_struct(base, range, 0, &magic);
270
272 SYMS_B32 is_fat = syms_false;
273 switch (magic){
278 {
280 }break;
281
284 {
286 is_fat = syms_true;
287 }break;
288 }
289
290 SYMS_B32 is_swapped = syms_false;
291 if (is_mach){
292 switch (magic){
296 {
297 is_swapped = syms_true;
298 }break;
299 }
300 }
301
303 if (is_mach){
304 result = syms_push_array(arena, SYMS_MachFileAccel, 1);
306 result->is_swapped = is_swapped;
307 result->is_fat = is_fat;
308 }
309 return(result);
310}
311
314 SYMS_B32 result = (!file->is_fat);
315 return(result);
316}
317
321 if (!file->is_fat){
322 SYMS_U64Range range = syms_make_u64_range(0, data.size);
323 result = syms_mach_bin_from_base_range(arena, data.str, range);
324 }
325 return(result);
326}
327
330 SYMS_B32 result = file_accel->is_fat;
331 return(result);
332}
333
337
338 if (file->is_fat){
339 void *base = data.str;
340 SYMS_U64Range range = syms_make_u64_range(0, data.size);
341
342 SYMS_B32 is_swapped = file->is_swapped;
343
347 if (is_swapped){
349 }
350
351 SYMS_U64 fat_count = fat_header.nfat_arch;
353
355 for (SYMS_U32 i = 0; i < fat_count; i += 1, fat_ptr += 1){
357 if (is_swapped){
359 }
360 }
361
362 result = syms_push_array(arena, SYMS_MachBinListAccel, 1);
364 result->count = fat_count;
365 result->fats = fats;
366 }
367
368 return(result);
369}
370
371
373// NOTE(allen): Arch
374
377 SYMS_Arch result = bin->arch;
378 return(result);
379}
380
381
383// NOTE(allen): Bin List
384
387 // allocate bin info array
389 SYMS_BinInfo *bin_info = syms_push_array(arena, SYMS_BinInfo, count);
390
391 // fill bin info array
393 SYMS_BinInfo *bin_info_ptr = bin_info;
394 for (SYMS_U64 i = 0; i < count; i += 1, bin_info_ptr += 1, fat_ptr += 1){
396 bin_info_ptr->range = syms_make_u64_range(fat_ptr->offset, fat_ptr->offset + fat_ptr->size);
397 }
398
399 // package up and return
400 SYMS_BinInfoArray result = {0};
401 result.count = count;
402 result.bin_info = bin_info;
403 return(result);
404}
405
410 if (1 <= n && n <= bin_list->count){
411 SYMS_MachFatArch *fat = &bin_list->fats[n - 1];
412 SYMS_U64Range range = syms_make_u64_range(fat->offset, fat->offset + fat->size);
413 result = syms_mach_bin_from_base_range(arena, data.str, range);
414 }
415 return(result);
416}
417
418
420// NOTE(allen): Binary Secs
421
426 array.sec_info = syms_push_array_zero(arena, SYMS_SecInfo, array.count);
427
430 SYMS_SecInfo *sec_info = array.sec_info;
431 for (; mach_sec < mach_sec_opl; sec_info += 1, mach_sec += 1){
432 SYMS_U8 *name_ptr = mach_sec->sectname;
433 SYMS_U8 *ptr = name_ptr;
434 SYMS_U8 *opl = name_ptr + SYMS_ARRAY_SIZE(mach_sec->sectname);
435 for (;ptr < opl && *ptr != 0; ptr += 1);
436
437 SYMS_String8 name = syms_str8_range(name_ptr, ptr);
438
439 sec_info->name = syms_push_string_copy(arena, name);
440 // TODO(allen): figure out when these ranges actually apply and when the section isn't
441 // there one side or the other.
442 sec_info->vrange = syms_make_u64_range(mach_sec->addr, mach_sec->addr + mach_sec->size);
443 sec_info->frange = syms_make_u64_range(mach_sec->offset, mach_sec->offset + mach_sec->size);
444 }
445 return array;
446}
449 // TODO(rjf): @nick verify
452 {
454 if(min_vbase == 0 || segment->vmaddr < min_vbase)
455 {
456 min_vbase = segment->vmaddr;
457 }
458 }
459 return min_vbase;
460}
461
463
464SYMS_API void
467 node->data.header = *dylib;
468 node->data.name = name;
469 node->next = 0;
470 SYMS_QueuePush(list->first, list->last, node);
471 list->count += 1;
472}
473
475
480 SYMS_MachBind state; syms_memzero_struct(&state);
481 for (;;){
484
487
488 switch (opcode){
490
492 {
493 state.dylib = imm;
494 } break;
496 {
498 } break;
500 {
501 SYMS_ASSERT_PARANOID("TODO: SET_DYLIB_SPECIAL_IMM");
502 } break;
504 {
505 state.flags = imm;
507 read_offset += (state.symbol_name.size + 1);
508 } break;
510 {
511 state.type = imm;
512 } break;
514 {
516 } break;
518 {
519 state.segment = imm;
521 } break;
523 {
524 SYMS_U64 addend = 0;
525 read_offset += syms_based_range_read_uleb128(base, range, read_offset, &addend);
526 state.segment_offset += addend;
527 } break;
529 {
530 SYMS_U64 addend = 0;
531 read_offset += syms_based_range_read_uleb128(base, range, read_offset, &addend);
532 state.segment_offset += addend;
533 } goto do_bind;
535 {
536 state.segment_offset += imm;
537 } goto do_bind;
539 {
540 SYMS_U64 count = 0, skip = 0;
543
544 state.segment_offset += skip * address_size;
545 } goto do_bind;
547 {
548 } goto do_bind;
549 do_bind:
550 {
552 for (;read_offset < syms_u64_range_size(range);){
553 SYMS_U8 value = 0;
555 if (value != 0){
556 break;
557 }
559 }
560 }
562 node->data = state;
563 node->next = 0;
564 SYMS_QueuePush(list.first, list.last, node);
565 list.count += 1;
566 } break;
567 }
568 }
569 exit:;
570
571 return list;
572}
573
577
578 // read and copy library names
580 for (SYMS_U32 i = 0; i < bin->dylib_count; ++i){
581 SYMS_String8 name = syms_based_range_read_string((void*)data.str, bin->dylibs[i].name, 0);
582 dylib_names[i] = syms_push_string_copy(arena, name);
583 }
584
585 // build binds
586 SYMS_U64 address_size = syms_address_size_from_arch(bin->arch);
589 for (SYMS_U32 i = 0; i < SYMS_ARRAY_SIZE(binds); ++i){
590 binds[i] = syms_mach_binds_from_base_range(scratch.arena, (void*)data.str, bin->bind_ranges[i], address_size, (SYMS_MachBindTable)i);
591 total_bind_count += binds[i].count;
592 }
593
594 // convert mach binds to syms imports
598 for (SYMS_U32 i = 0; i < SYMS_ARRAY_SIZE(binds); ++i){
599 for (SYMS_MachBindNode *node = binds[i].first; node != 0; node = node->next){
600 SYMS_MachBind *bind = &node->data;
601 SYMS_Import *import = &import_array.imports[import_array.count++];
602 import->name = syms_push_string_copy(arena, bind->symbol_name);
603 if (bind->dylib < bin->dylib_count){
604 import->library_name = dylib_names[bind->dylib];
605 } else{
606 import->library_name = syms_str8(0,0);
607 }
608 import->ordinal = 0;
609 }
610 }
611
613 return import_array;
614}
615
616static SYMS_MachExport *
617syms_mach_parse_export_node(SYMS_Arena *arena, void *base, SYMS_U64Range range, SYMS_String8 name, SYMS_U64 read_offset){
618 SYMS_MachExport *node = 0;
619 SYMS_U64 export_size = 0;
620 SYMS_U64 read_size = syms_based_range_read_uleb128(base, range, read_offset, &export_size);
621 if (read_size > 0){
623
624 // push new node
625 node = syms_push_array_zero(arena, SYMS_MachExport, 1);
626 node->name = name;
627 node->is_export_info = export_size != 0;
628
629 // read export discriminator
630 SYMS_U64Range export_range = syms_make_u64_inrange(range, read_offset, export_size);
631 read_offset += export_size;
632
633 // parse export info
634 if (node->is_export_info){
640 export_read_offset += (node->import_name.size + 1);
641 } else{
645 }
646 }
647 }
648
649 // read child info
651 if (node->child_count > 0){
652 node->children = syms_push_array(arena, SYMS_MachExport *, node->child_count);
653 for (SYMS_U8 child_idx = 0; child_idx < node->child_count; child_idx += 1){
655 read_offset += (name.size + 1);
658 node->children[child_idx] = syms_mach_parse_export_node(arena, base, range, name, child_offset);
659 }
660 }
661 }
662
663 return node;
664}
665
668 // TODO(nick): rewrite function to use arena for recursion.
669 return syms_mach_parse_export_node(arena, base, range, syms_str8_lit(""), 0);
670}
671
675
676 // read and copy library names
678 for (SYMS_U32 i = 0; i < bin->dylib_count; ++i){
679 SYMS_String8 name = syms_based_range_read_string((void*)data.str, bin->dylibs[i].name, 0);
680 dylib_names[i] = syms_push_string_copy(arena, name);
681 }
682
683 // build export trie
685
686 // traverse trie
690 if (root_export){
691 SYMS_MachExportFrame *stack = 0;
693
695 frame->node = root_export;
696 SYMS_StackPush(stack, frame);
697
698 for (; stack != 0; ){
699 SYMS_B32 pop_frame = frame->child_idx >= frame->node->child_count;
700 if (pop_frame){
701 if (frame->node->is_export_info){
702 // append strings from nodes on the stack
705 for (SYMS_MachExportFrame *f = frame; f != 0; f = f->next){
706 syms_string_list_push_front(temp.arena, &name_parts, f->node->name);
707 }
711
713
714 // add export to the list
716 export_count += 1;
717
718 // initialize export
719 SYMS_Export *exp = &export_node->data;
721 // TODO(nick): need dylib with reexports to test this code path
722 if (frame->node->dylib_ordinal > 0 && frame->node->dylib_ordinal < bin->dylib_count){
723 exp->name = name;
724 exp->address = 0;
725 exp->ordinal = 0;
726 exp->forwarder_library_name = dylib_names[frame->node->dylib_ordinal-1];
727 exp->forwarder_import_name = syms_push_string_copy(arena, frame->node->import_name);
728 } else{
729 SYMS_ASSERT_PARANOID(!"invalid dylib ordinal");
730 }
731 } else{
732 exp->name = name;
733 exp->address = frame->node->address;
734 exp->ordinal = 0;
735 exp->forwarder_library_name = syms_str8(0,0);
736 exp->forwarder_import_name = syms_str8(0,0);
737 }
738 }
739
740 // pop current frame
742 frame = SYMS_StackPop(stack);
743
744 // push frame to free list for later reuse
745 to_free->next = 0;
747 } else{
748 // push frame
750 if (new_frame){
752 } else{
754 }
755 new_frame->next = 0;
756 new_frame->child_idx = 0;
757 new_frame->node = frame->node->children[frame->child_idx++];
758 frame = SYMS_StackPush(stack, new_frame);
759 }
760 }
761 }
762
766 for (SYMS_ExportNode *n = first_export; n != 0; n = n->next){
767 export_array.exports[export_array.count++] = n->data;
768 }
769
771 return export_array;
772}
773
774#endif // SYMS_MACH_PARSER_C
OODEFFUNC typedef const char * file
Definition oodle2.h:678
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition syms_base.h:402
Definition syms_debug_info.h:31
SYMS_BinInfo * bin_info
Definition syms_debug_info.h:32
SYMS_U64 count
Definition syms_debug_info.h:33
Definition syms_debug_info.h:26
SYMS_Arch arch
Definition syms_debug_info.h:27
Definition syms_debug_info.h:69
SYMS_U64 count
Definition syms_debug_info.h:71
Definition syms_debug_info.h:59
struct SYMS_ExportNode * next
Definition syms_debug_info.h:60
Definition syms_debug_info.h:45
SYMS_String8 name
Definition syms_debug_info.h:46
Definition syms_debug_info.h:64
SYMS_U64 count
Definition syms_debug_info.h:66
Definition syms_debug_info.h:39
SYMS_String8 name
Definition syms_debug_info.h:40
Definition syms_mach_parser.h:40
SYMS_U32 dylib_count
Definition syms_mach_parser.h:61
SYMS_B32 is_swapped
Definition syms_mach_parser.h:45
SYMS_U32 load_command_count
Definition syms_mach_parser.h:47
SYMS_Arch arch
Definition syms_mach_parser.h:43
SYMS_MachSection64 * sections
Definition syms_mach_parser.h:55
SYMS_U64Range export_range
Definition syms_mach_parser.h:59
struct SYMS_MachParsedDylib * dylibs
Definition syms_mach_parser.h:62
SYMS_MachSegmentCommand64 * segments
Definition syms_mach_parser.h:52
SYMS_MachSymtabCommand symtab
Definition syms_mach_parser.h:50
SYMS_FileFormat format
Definition syms_mach_parser.h:41
SYMS_U64Range bind_ranges[SYMS_MachBindTable_COUNT]
Definition syms_mach_parser.h:58
SYMS_U64Range load_commands
Definition syms_mach_parser.h:48
SYMS_U32 section_count
Definition syms_mach_parser.h:56
SYMS_U32 segment_count
Definition syms_mach_parser.h:53
Definition syms_mach_parser.h:15
SYMS_FileFormat format
Definition syms_mach_parser.h:16
SYMS_MachFatArch * fats
Definition syms_mach_parser.h:17
SYMS_U32 count
Definition syms_mach_parser.h:18
Definition syms_mach_parser.h:109
Definition syms_mach_parser.h:103
SYMS_MachBind data
Definition syms_mach_parser.h:104
struct SYMS_MachBindNode * next
Definition syms_mach_parser.h:105
Definition syms_mach_parser.h:92
SYMS_U64 segment_offset
Definition syms_mach_parser.h:94
SYMS_U64 dylib
Definition syms_mach_parser.h:95
SYMS_String8 symbol_name
Definition syms_mach_parser.h:96
SYMS_U8 flags
Definition syms_mach_parser.h:97
SYMS_MachBindType type
Definition syms_mach_parser.h:98
SYMS_S64 addend
Definition syms_mach_parser.h:99
SYMS_U32 segment
Definition syms_mach_parser.h:93
Definition syms_meta_mach.h:434
Definition syms_meta_mach.h:429
SYMS_MachDylib dylib
Definition syms_meta_mach.h:432
Definition syms_mach_parser.h:82
Definition syms_mach_parser.h:76
SYMS_MachParsedDylib data
Definition syms_mach_parser.h:78
struct SYMS_MachDylibNode * next
Definition syms_mach_parser.h:77
Definition syms_meta_mach.h:423
SYMS_MachLCStr name
Definition syms_meta_mach.h:424
Definition syms_mach_parser.h:144
SYMS_MachExport * node
Definition syms_mach_parser.h:147
SYMS_U8 child_idx
Definition syms_mach_parser.h:146
struct SYMS_MachExportFrame * next
Definition syms_mach_parser.h:145
Definition syms_mach_parser.h:119
SYMS_U64 dylib_ordinal
Definition syms_mach_parser.h:130
SYMS_B32 is_export_info
Definition syms_mach_parser.h:123
SYMS_U8 child_count
Definition syms_mach_parser.h:121
SYMS_U64 address
Definition syms_mach_parser.h:127
SYMS_String8 name
Definition syms_mach_parser.h:125
SYMS_U64 flags
Definition syms_mach_parser.h:126
SYMS_String8 import_name
Definition syms_mach_parser.h:131
SYMS_U64 resolver
Definition syms_mach_parser.h:134
struct SYMS_MachExport ** children
Definition syms_mach_parser.h:120
Definition syms_meta_mach.h:456
Definition syms_meta_mach.h:452
Definition syms_mach_parser.h:9
SYMS_FileFormat format
Definition syms_mach_parser.h:10
SYMS_B32 is_swapped
Definition syms_mach_parser.h:11
SYMS_B32 is_fat
Definition syms_mach_parser.h:12
Definition syms_meta_mach.h:463
Definition syms_meta_mach.h:472
SYMS_MachCpuType cputype
Definition syms_meta_mach.h:474
SYMS_U32 sizeofcmds
Definition syms_meta_mach.h:478
SYMS_U32 ncmds
Definition syms_meta_mach.h:477
SYMS_U32 offset
Definition syms_meta_mach.h:416
Definition syms_meta_mach.h:448
Definition syms_mach_parser.h:69
SYMS_U64Range name
Definition syms_mach_parser.h:71
SYMS_MachDylib header
Definition syms_mach_parser.h:70
Definition syms_meta_mach.h:506
Definition syms_meta_mach.h:519
Definition syms_mach_parser.h:26
Definition syms_meta_mach.h:482
Definition syms_meta_mach.h:494
SYMS_U64 vmaddr
Definition syms_meta_mach.h:497
Definition syms_mach_parser.h:21
Definition syms_meta_mach.h:533
Definition syms_debug_info.h:21
SYMS_U64 count
Definition syms_debug_info.h:23
Definition syms_debug_info.h:15
SYMS_U64Range vrange
Definition syms_debug_info.h:17
SYMS_String8 name
Definition syms_debug_info.h:16
SYMS_U64Range frange
Definition syms_debug_info.h:18
Definition syms_base.h:306
Definition syms_base.h:296
SYMS_U8 * str
Definition syms_base.h:297
SYMS_U64 size
Definition syms_base.h:298
Definition syms_base.h:325
Definition syms_base.h:264
SYMS_API SYMS_U64 syms_u64_range_size(SYMS_U64Range range)
Definition syms_base.c:31
SYMS_API SYMS_String8 syms_string_list_join(SYMS_Arena *arena, SYMS_String8List *list, SYMS_StringJoin *join_ptr)
Definition syms_base.c:315
SYMS_API SYMS_String8 syms_str8_range(SYMS_U8 *first, SYMS_U8 *opl)
Definition syms_base.c:184
SYMS_API SYMS_ArenaTemp syms_get_scratch(SYMS_Arena **conflicts, SYMS_U64 conflict_count)
Definition syms_base.c:694
SYMS_API SYMS_U64Range syms_make_u64_range(SYMS_U64 min, SYMS_U64 max)
Definition syms_base.c:18
SYMS_API SYMS_U64 syms_based_range_read_sleb128(void *base, SYMS_U64Range range, SYMS_U64 offset, SYMS_S64 *out_value)
Definition syms_base.c:792
SYMS_API SYMS_String8 syms_based_range_read_string(void *base, SYMS_U64Range range, SYMS_U64 offset)
Definition syms_base.c:823
SYMS_API void syms_arena_temp_end(SYMS_ArenaTemp temp)
Definition syms_base.c:689
SYMS_API SYMS_U64Range syms_make_u64_inrange(SYMS_U64Range range, SYMS_U64 offset, SYMS_U64 size)
Definition syms_base.c:24
SYMS_API SYMS_String8 syms_str8(SYMS_U8 *str, SYMS_U64 size)
Definition syms_base.c:169
SYMS_API void syms_string_list_push_front(SYMS_Arena *arena, SYMS_String8List *list, SYMS_String8 string)
Definition syms_base.c:288
SYMS_API SYMS_U64 syms_based_range_read_uleb128(void *base, SYMS_U64Range range, SYMS_U64 offset, SYMS_U64 *out_value)
Definition syms_base.c:765
SYMS_API SYMS_String8 syms_push_string_copy(SYMS_Arena *arena, SYMS_String8 string)
Definition syms_base.c:353
SYMS_API SYMS_ArenaTemp syms_arena_temp_begin(SYMS_Arena *arena)
Definition syms_base.c:682
#define syms_true
Definition syms_base.h:105
#define SYMS_StackPush(f, n)
Definition syms_base.h:227
#define syms_based_range_read_struct(b, r, o, p)
Definition syms_base.h:593
#define syms_push_array(a, T, c)
Definition syms_base.h:561
#define syms_memzero_struct(s)
Definition syms_base.h:161
#define SYMS_AlignPow2(a, b)
Definition syms_base.h:187
#define syms_false
Definition syms_base.h:104
#define SYMS_API
Definition syms_base.h:29
#define SYMS_ARRAY_SIZE(x)
Definition syms_base.h:144
SYMS_S32 SYMS_B32
Definition syms_base.h:99
#define SYMS_StackPop(f)
Definition syms_base.h:228
#define syms_push_array_zero(a, T, c)
Definition syms_base.h:564
#define SYMS_ASSERT_PARANOID(x)
Definition syms_base.h:132
#define syms_str8_lit(s)
Definition syms_base.h:483
#define SYMS_QueuePush(f, l, n)
Definition syms_base.h:220
#define syms_release_scratch
Definition syms_base.h:567
#define syms_bswap_in_place(type, ptr)
Definition syms_base.h:463
uint32_t SYMS_U32
Definition syms_crt_overrides.h:38
uint64_t SYMS_U64
Definition syms_crt_overrides.h:39
#define syms_memmove
Definition syms_crt_overrides.h:65
uint8_t SYMS_U8
Definition syms_crt_overrides.h:36
SYMS_READ_ONLY SYMS_GLOBAL SYMS_FileFormat syms_format_nil
Definition syms_debug_info.h:398
#define SYMS_Arena
Definition syms_default_arena.h:61
SYMS_API void syms_mach_header64_from_header32(SYMS_MachHeader64 *dst, SYMS_MachHeader32 *header32)
Definition syms_mach.c:15
SYMS_API void syms_mach_segment64_from_segment32(SYMS_MachSegmentCommand64 *dst, SYMS_MachSegmentCommand32 *seg32)
Definition syms_mach.c:36
SYMS_API void syms_mach_section64_from_section32(SYMS_MachSection64 *dst, SYMS_MachSection32 *sect32)
Definition syms_mach.c:51
#define SYMS_MACH_FAT_MAGIC
Definition syms_mach.h:35
#define SYMS_MACH_FAT_CIGAM
Definition syms_mach.h:36
#define SYMS_MACH_MAGIC_64
Definition syms_mach.h:32
#define SYMS_MACH_CIGAM_32
Definition syms_mach.h:30
#define SYMS_MACH_MAGIC_32
Definition syms_mach.h:29
#define SYMS_MACH_CIGAM_64
Definition syms_mach.h:33
SYMS_API SYMS_U64 syms_mach_default_vbase_from_bin(SYMS_MachBinAccel *bin)
Definition syms_mach_parser.c:448
SYMS_API void syms_mach_dylib_list_push(SYMS_Arena *arena, SYMS_MachDylibList *list, SYMS_MachDylib *dylib, SYMS_U64Range name)
Definition syms_mach_parser.c:465
SYMS_API SYMS_MachBindList syms_mach_binds_from_base_range(SYMS_Arena *arena, void *base, SYMS_U64Range range, SYMS_U32 address_size, SYMS_MachBindTable bind_type)
Definition syms_mach_parser.c:477
SYMS_API SYMS_Arch syms_mach_arch_from_bin(SYMS_MachBinAccel *bin)
Definition syms_mach_parser.c:376
SYMS_API SYMS_MachFileAccel * syms_mach_file_accel_from_data(SYMS_Arena *arena, SYMS_String8 data)
Definition syms_mach_parser.c:264
SYMS_API SYMS_SecInfoArray syms_mach_sec_info_array_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachBinAccel *bin)
Definition syms_mach_parser.c:423
SYMS_API SYMS_BinInfoArray syms_mach_bin_info_array_from_bin_list(SYMS_Arena *arena, SYMS_MachBinListAccel *bin_list)
Definition syms_mach_parser.c:386
SYMS_API SYMS_MachBinAccel * syms_mach_bin_accel_from_bin_list_number(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachBinListAccel *bin_list, SYMS_U64 n)
Definition syms_mach_parser.c:407
SYMS_API SYMS_MachExport * syms_build_mach_export_trie(SYMS_Arena *arena, void *base, SYMS_U64Range range)
Definition syms_mach_parser.c:667
SYMS_API SYMS_B32 syms_mach_file_is_bin_list(SYMS_MachFileAccel *file_accel)
Definition syms_mach_parser.c:329
SYMS_API SYMS_ExportArray syms_mach_exports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachBinAccel *bin)
Definition syms_mach_parser.c:673
SYMS_API SYMS_MachBinAccel * syms_mach_bin_accel_from_file(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachFileAccel *file)
Definition syms_mach_parser.c:319
SYMS_API SYMS_B32 syms_mach_file_is_bin(SYMS_MachFileAccel *file)
Definition syms_mach_parser.c:313
SYMS_API SYMS_MachBinAccel * syms_mach_bin_from_base_range(SYMS_Arena *arena, void *base, SYMS_U64Range range)
Definition syms_mach_parser.c:10
SYMS_API SYMS_MachBinListAccel * syms_mach_bin_list_accel_from_file(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachFileAccel *file)
Definition syms_mach_parser.c:335
SYMS_API SYMS_ImportArray syms_mach_imports_from_bin(SYMS_Arena *arena, SYMS_String8 data, SYMS_MachBinAccel *bin)
Definition syms_mach_parser.c:575
@ SYMS_MachBindTable_REGULAR
Definition syms_mach_parser.h:33
@ SYMS_MachBindTable_LAZY
Definition syms_mach_parser.h:34
@ SYMS_MachBindTable_COUNT
Definition syms_mach_parser.h:36
@ SYMS_MachBindTable_WEAK
Definition syms_mach_parser.h:35
SYMS_U32 SYMS_MachBindTable
Definition syms_mach_parser.h:38
SYMS_API SYMS_U32 syms_address_size_from_arch(SYMS_Arch v)
Definition syms_meta_base.c:7
@ SYMS_FileFormat_MACH
Definition syms_meta_base.h:98
SYMS_Arch
Definition syms_meta_base.h:6
SYMS_API SYMS_Arch syms_mach_arch_from_cputype(SYMS_MachCpuType v)
Definition syms_meta_mach.c:7
@ SYMS_MachLoadCommandType_LOAD_DYLIB
Definition syms_meta_mach.h:216
@ SYMS_MachLoadCommandType_LAZY_LOAD_DYLIB
Definition syms_meta_mach.h:237
@ SYMS_MachLoadCommandType_DYLD_INFO_ONLY
Definition syms_meta_mach.h:240
@ SYMS_MachLoadCommandType_SEGMENT_64
Definition syms_meta_mach.h:230
@ SYMS_MachLoadCommandType_LOAD_UPWARD_DYLIB
Definition syms_meta_mach.h:241
@ SYMS_MachLoadCommandType_SEGMENT
Definition syms_meta_mach.h:203
@ SYMS_MachLoadCommandType_SYMTAB
Definition syms_meta_mach.h:204
@ SYMS_MachLoadCommandType_LOAD_WEAK_DYLIB
Definition syms_meta_mach.h:228
@ SYMS_MachBindOpcode_DO_BIND_ADD_ADDR_ULEB
Definition syms_meta_mach.h:338
@ SYMS_MachBindOpcode_DO_BIND
Definition syms_meta_mach.h:337
@ SYMS_MachBindOpcode_MASK
Definition syms_meta_mach.h:341
@ SYMS_MachBindOpcode_DONE
Definition syms_meta_mach.h:328
@ SYMS_MachBindOpcode_IMM_MASK
Definition syms_meta_mach.h:342
@ SYMS_MachBindOpcode_SET_ADDEND_SLEB
Definition syms_meta_mach.h:334
@ SYMS_MachBindOpcode_ADD_ADDR_ULEB
Definition syms_meta_mach.h:336
@ SYMS_MachBindOpcode_SET_DYLIB_ORDINAL_ULEB
Definition syms_meta_mach.h:330
@ SYMS_MachBindOpcode_SET_SYMBOL_TRAILING_FLAGS_IMM
Definition syms_meta_mach.h:332
@ SYMS_MachBindOpcode_SET_TYPE_IMM
Definition syms_meta_mach.h:333
@ SYMS_MachBindOpcode_DO_BIND_ULEB_TIMES_SKIPPING_ULEB
Definition syms_meta_mach.h:340
@ SYMS_MachBindOpcode_SET_SEGMENT_AND_OFFSET_ULEB
Definition syms_meta_mach.h:335
@ SYMS_MachBindOpcode_SET_DYLIB_ORDINAL_IMM
Definition syms_meta_mach.h:329
@ SYMS_MachBindOpcode_DO_BIND_ADD_ADDR_IMM_SCALED
Definition syms_meta_mach.h:339
@ SYMS_MachBindOpcode_SET_DYLIB_SPECIAL_IMM
Definition syms_meta_mach.h:331
@ SYMS_MachExportSymbolFlags_REEXPORT
Definition syms_meta_mach.h:411
@ SYMS_MachExportSymbolFlags_STUB_AND_RESOLVED
Definition syms_meta_mach.h:412