2009-12-15 Tristan Gingold <gingold@adacore.com>
[deliverable/binutils-gdb.git] / gdb / machoread.c
1 /* Darwin support for GDB, the GNU debugger.
2 Copyright (C) 2008, 2009 Free Software Foundation, Inc.
3
4 Contributed by AdaCore.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "defs.h"
23 #include "symtab.h"
24 #include "gdbtypes.h"
25 #include "bfd.h"
26 #include "symfile.h"
27 #include "objfiles.h"
28 #include "buildsym.h"
29 #include "gdbcmd.h"
30 #include "gdbcore.h"
31 #include "mach-o.h"
32 #include "gdb_assert.h"
33 #include "aout/stab_gnu.h"
34 #include "vec.h"
35
36 #include <string.h>
37
38 /* If non-zero displays debugging message. */
39 static int mach_o_debug_level = 0;
40
41 static void
42 macho_new_init (struct objfile *objfile)
43 {
44 }
45
46 static void
47 macho_symfile_init (struct objfile *objfile)
48 {
49 objfile->flags |= OBJF_REORDERED;
50 init_entry_point_info (objfile);
51 }
52
53 /* Dwarf debugging information are never in the final executable. They stay
54 in object files and the executable contains the list of object files read
55 during the link.
56 Each time an oso (other source) is found in the executable, the reader
57 creates such a structure. They are read after the processing of the
58 executable.
59 */
60 typedef struct oso_el
61 {
62 /* Object file name. */
63 const char *name;
64
65 /* Associated time stamp. */
66 unsigned long mtime;
67
68 /* Number of sections. This is the length of SYMBOLS and OFFSETS array. */
69 int num_sections;
70
71 /* Each seaction of the object file is represented by a symbol and its
72 offset. If the offset is 0, we assume that the symbol is at offset 0
73 in the OSO object file and a symbol lookup in the main file is
74 required to get the offset. */
75 asymbol **symbols;
76 bfd_vma *offsets;
77 }
78 oso_el;
79
80 /* Vector of object files to be read after the executable. */
81 DEF_VEC_O (oso_el);
82 static VEC (oso_el) *oso_vector;
83
84 /* Add a new OSO to the vector. */
85
86 static void
87 macho_add_oso (const asymbol *oso_sym, int nbr_sections,
88 asymbol **symbols, bfd_vma *offsets)
89 {
90 oso_el el;
91
92 el.name = oso_sym->name;
93 el.mtime = oso_sym->value;
94 el.num_sections = nbr_sections;
95 el.symbols = symbols;
96 el.offsets = offsets;
97 VEC_safe_push (oso_el, oso_vector, &el);
98 }
99
100 /* Build the minimal symbol table from SYMBOL_TABLE of length
101 NUMBER_OF_SYMBOLS for OBJFILE.
102 Read OSO files at the end. */
103
104 static void
105 macho_symtab_read (struct objfile *objfile,
106 long number_of_symbols, asymbol **symbol_table)
107 {
108 struct gdbarch *gdbarch = get_objfile_arch (objfile);
109 long storage_needed;
110 long i, j;
111 CORE_ADDR offset;
112 enum minimal_symbol_type ms_type;
113 unsigned int nbr_sections = bfd_count_sections (objfile->obfd);
114 asymbol **first_symbol = NULL;
115 bfd_vma *first_offset = NULL;
116 const asymbol *oso_file = NULL;
117
118 for (i = 0; i < number_of_symbols; i++)
119 {
120 asymbol *sym = symbol_table[i];
121 bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
122
123 offset = ANOFFSET (objfile->section_offsets, sym->section->index);
124
125 if (sym->flags & BSF_DEBUGGING)
126 {
127 bfd_vma addr;
128
129 /* Debugging symbols are used to collect OSO file names as well
130 as section offsets. */
131
132 switch (mach_o_sym->n_type)
133 {
134 case N_SO:
135 /* An empty SO entry terminates a chunk for an OSO file. */
136 if ((sym->name == NULL || sym->name[0] == 0) && oso_file != NULL)
137 {
138 macho_add_oso (oso_file, nbr_sections,
139 first_symbol, first_offset);
140 first_symbol = NULL;
141 first_offset = NULL;
142 oso_file = NULL;
143 }
144 break;
145 case N_FUN:
146 case N_STSYM:
147 if (sym->name == NULL || sym->name[0] == '\0')
148 break;
149 /* Fall through. */
150 case N_BNSYM:
151 gdb_assert (oso_file != NULL);
152 addr = sym->value
153 + bfd_get_section_vma (sym->section->bfd, sym->section);
154 if (addr != 0
155 && first_symbol[sym->section->index] == NULL)
156 {
157 /* These STAB entries can directly relocate a section. */
158 first_symbol[sym->section->index] = sym;
159 first_offset[sym->section->index] = addr + offset;
160 }
161 break;
162 case N_GSYM:
163 gdb_assert (oso_file != NULL);
164 if (first_symbol[sym->section->index] == NULL)
165 {
166 /* This STAB entry needs a symbol look-up to relocate
167 the section. */
168 first_symbol[sym->section->index] = sym;
169 first_offset[sym->section->index] = 0;
170 }
171 break;
172 case N_OSO:
173 /* New OSO file. */
174 gdb_assert (oso_file == NULL);
175 first_symbol = (asymbol **)xmalloc (nbr_sections
176 * sizeof (asymbol *));
177 first_offset = (bfd_vma *)xmalloc (nbr_sections
178 * sizeof (bfd_vma));
179 for (j = 0; j < nbr_sections; j++)
180 first_symbol[j] = NULL;
181 oso_file = sym;
182 break;
183 }
184 continue;
185 }
186
187 if (sym->name == NULL || *sym->name == '\0')
188 {
189 /* Skip names that don't exist (shouldn't happen), or names
190 that are null strings (may happen). */
191 continue;
192 }
193
194 if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
195 {
196 struct minimal_symbol *msym;
197 CORE_ADDR symaddr;
198
199 /* Bfd symbols are section relative. */
200 symaddr = sym->value + sym->section->vma;
201
202 /* Select global/local/weak symbols. Note that bfd puts abs
203 symbols in their own section, so all symbols we are
204 interested in will have a section. */
205 /* Relocate all non-absolute and non-TLS symbols by the
206 section offset. */
207 if (sym->section != &bfd_abs_section
208 && !(sym->section->flags & SEC_THREAD_LOCAL))
209 symaddr += offset;
210
211 if (sym->section == &bfd_abs_section)
212 ms_type = mst_abs;
213 else if (sym->section->flags & SEC_CODE)
214 {
215 if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
216 ms_type = mst_text;
217 else
218 ms_type = mst_file_text;
219 }
220 else if (sym->section->flags & SEC_ALLOC)
221 {
222 if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
223 {
224 if (sym->section->flags & SEC_LOAD)
225 ms_type = mst_data;
226 else
227 ms_type = mst_bss;
228 }
229 else if (sym->flags & BSF_LOCAL)
230 {
231 /* Not a special stabs-in-elf symbol, do regular
232 symbol processing. */
233 if (sym->section->flags & SEC_LOAD)
234 ms_type = mst_file_data;
235 else
236 ms_type = mst_file_bss;
237 }
238 else
239 ms_type = mst_unknown;
240 }
241 else
242 continue; /* Skip this symbol. */
243
244 gdb_assert (sym->section->index < nbr_sections);
245 if (oso_file != NULL
246 && first_symbol[sym->section->index] == NULL)
247 {
248 /* Standard symbols can directly relocate sections. */
249 first_symbol[sym->section->index] = sym;
250 first_offset[sym->section->index] = symaddr;
251 }
252
253 msym = prim_record_minimal_symbol_and_info
254 (sym->name, symaddr, ms_type, sym->section->index,
255 sym->section, objfile);
256 }
257 }
258
259 /* Just in case there is no trailing SO entry. */
260 if (oso_file != NULL)
261 macho_add_oso (oso_file, nbr_sections, first_symbol, first_offset);
262 }
263
264 /* If NAME describes an archive member (ie: ARCHIVE '(' MEMBER ')'),
265 returns the length of the archive name.
266 Returns -1 otherwise. */
267
268 static int
269 get_archive_prefix_len (const char *name)
270 {
271 char *lparen;
272 int name_len = strlen (name);
273
274 if (name_len == 0 || name[name_len - 1] != ')')
275 return -1;
276
277 lparen = strrchr (name, '(');
278 if (lparen == NULL || lparen == name)
279 return -1;
280 return lparen - name;
281 }
282
283 static int
284 oso_el_compare_name (const void *vl, const void *vr)
285 {
286 const oso_el *l = (const oso_el *)vl;
287 const oso_el *r = (const oso_el *)vr;
288
289 return strcmp (l->name, r->name);
290 }
291
292 /* Add an oso file as a symbol file. */
293
294 static void
295 macho_add_oso_symfile (oso_el *oso, bfd *abfd, struct objfile *main_objfile)
296 {
297 struct section_addr_info *addrs;
298 int len;
299 int i;
300 char leading_char;
301
302 if (mach_o_debug_level > 0)
303 printf_unfiltered (_("Loading symbols from oso: %s\n"), oso->name);
304
305 if (!bfd_check_format (abfd, bfd_object))
306 {
307 warning (_("`%s': can't read symbols: %s."), oso->name,
308 bfd_errmsg (bfd_get_error ()));
309 bfd_close (abfd);
310 return;
311 }
312
313 bfd_set_cacheable (abfd, 1);
314
315 /* Compute addr length. */
316 len = 0;
317 for (i = 0; i < oso->num_sections; i++)
318 if (oso->symbols[i] != NULL)
319 len++;
320
321 addrs = alloc_section_addr_info (len);
322
323 leading_char = bfd_get_symbol_leading_char (main_objfile->obfd);
324
325 len = 0;
326 for (i = 0; i < oso->num_sections; i++)
327 if (oso->symbols[i] != NULL)
328 {
329 if (oso->offsets[i])
330 addrs->other[len].addr = oso->offsets[i];
331 else
332 {
333 struct minimal_symbol *msym;
334 const char *name = oso->symbols[i]->name;
335
336 if (name[0] == leading_char)
337 ++name;
338
339 if (mach_o_debug_level > 3)
340 printf_unfiltered (_("resolve sect %s with %s\n"),
341 oso->symbols[i]->section->name,
342 oso->symbols[i]->name);
343 msym = lookup_minimal_symbol (name, NULL, main_objfile);
344 if (msym == NULL)
345 {
346 warning (_("can't find symbol '%s' in minsymtab"),
347 oso->symbols[i]->name);
348 addrs->other[len].addr = 0;
349 }
350 else
351 addrs->other[len].addr = SYMBOL_VALUE_ADDRESS (msym);
352 }
353 addrs->other[len].name = (char *)oso->symbols[i]->section->name;
354 len++;
355 }
356
357 if (mach_o_debug_level > 1)
358 {
359 int j;
360 for (j = 0; j < addrs->num_sections; j++)
361 printf_unfiltered (_(" %s: %s\n"),
362 core_addr_to_string (addrs->other[j].addr),
363 addrs->other[j].name);
364 }
365
366 symbol_file_add_from_bfd (abfd, 0, addrs, 0);
367 }
368
369 /* Read symbols from the vector of oso files. */
370
371 static void
372 macho_oso_symfile (struct objfile *main_objfile)
373 {
374 int ix;
375 VEC (oso_el) *vec;
376 oso_el *oso;
377
378 vec = oso_vector;
379 oso_vector = NULL;
380
381 /* Sort oso by name so that files from libraries are gathered. */
382 qsort (VEC_address (oso_el, vec), VEC_length (oso_el, vec),
383 sizeof (oso_el), oso_el_compare_name);
384
385 for (ix = 0; VEC_iterate (oso_el, vec, ix, oso);)
386 {
387 int pfx_len;
388
389 /* Check if this is a library name. */
390 pfx_len = get_archive_prefix_len (oso->name);
391 if (pfx_len > 0)
392 {
393 bfd *archive_bfd;
394 bfd *member_bfd;
395 char *archive_name = XNEWVEC (char, pfx_len + 1);
396 int last_ix;
397 oso_el *oso2;
398 int ix2;
399
400 memcpy (archive_name, oso->name, pfx_len);
401 archive_name[pfx_len] = '\0';
402
403 /* Compute number of oso for this archive. */
404 for (last_ix = ix;
405 VEC_iterate (oso_el, vec, last_ix, oso2); last_ix++)
406 {
407 if (strncmp (oso2->name, archive_name, pfx_len) != 0)
408 break;
409 }
410
411 /* Open the archive and check the format. */
412 archive_bfd = bfd_openr (archive_name, gnutarget);
413 if (archive_bfd == NULL)
414 {
415 warning (_("Could not open OSO archive file \"%s\""),
416 archive_name);
417 ix = last_ix;
418 continue;
419 }
420 if (!bfd_check_format (archive_bfd, bfd_archive))
421 {
422 warning (_("OSO archive file \"%s\" not an archive."),
423 archive_name);
424 bfd_close (archive_bfd);
425 ix = last_ix;
426 continue;
427 }
428 member_bfd = bfd_openr_next_archived_file (archive_bfd, NULL);
429
430 if (member_bfd == NULL)
431 {
432 warning (_("Could not read archive members out of "
433 "OSO archive \"%s\""), archive_name);
434 bfd_close (archive_bfd);
435 ix = last_ix;
436 continue;
437 }
438
439 /* Load all oso in this library. */
440 while (member_bfd != NULL)
441 {
442 bfd *prev;
443 const char *member_name = member_bfd->filename;
444 int member_len = strlen (member_name);
445
446 /* If this member is referenced, add it as a symfile. */
447 for (ix2 = ix; ix2 < last_ix; ix2++)
448 {
449 oso2 = VEC_index (oso_el, vec, ix2);
450
451 if (oso2->name
452 && strlen (oso2->name) == pfx_len + member_len + 2
453 && !memcmp (member_name, oso2->name + pfx_len + 1,
454 member_len))
455 {
456 macho_add_oso_symfile (oso2, member_bfd, main_objfile);
457 oso2->name = NULL;
458 break;
459 }
460 }
461
462 prev = member_bfd;
463 member_bfd = bfd_openr_next_archived_file
464 (archive_bfd, member_bfd);
465
466 /* Free previous member if not referenced by an oso. */
467 if (ix2 >= last_ix)
468 bfd_close (prev);
469 }
470 for (ix2 = ix; ix2 < last_ix; ix2++)
471 {
472 oso_el *oso2 = VEC_index (oso_el, vec, ix2);
473
474 if (oso2->name != NULL)
475 warning (_("Could not find specified archive member "
476 "for OSO name \"%s\""), oso->name);
477 }
478 ix = last_ix;
479 }
480 else
481 {
482 bfd *abfd;
483
484 abfd = bfd_openr (oso->name, gnutarget);
485 if (!abfd)
486 warning (_("`%s': can't open to read symbols: %s."), oso->name,
487 bfd_errmsg (bfd_get_error ()));
488 else
489 macho_add_oso_symfile (oso, abfd, main_objfile);
490
491 ix++;
492 }
493 }
494
495 for (ix = 0; VEC_iterate (oso_el, vec, ix, oso); ix++)
496 {
497 xfree (oso->symbols);
498 xfree (oso->offsets);
499 }
500 VEC_free (oso_el, vec);
501 }
502
503 /* DSYM (debug symbols) files contain the debug info of an executable.
504 This is a separate file created by dsymutil(1) and is similar to debug
505 link feature on ELF.
506 DSYM files are located in a subdirectory. Append DSYM_SUFFIX to the
507 executable name and the executable base name to get the DSYM file name. */
508 #define DSYM_SUFFIX ".dSYM/Contents/Resources/DWARF/"
509
510 /* Check if a dsym file exists for OBJFILE. If so, returns a bfd for it.
511 Return NULL if no valid dsym file is found. */
512
513 static bfd *
514 macho_check_dsym (struct objfile *objfile)
515 {
516 size_t name_len = strlen (objfile->name);
517 size_t dsym_len = strlen (DSYM_SUFFIX);
518 const char *base_name = lbasename (objfile->name);
519 size_t base_len = strlen (base_name);
520 char *dsym_filename = alloca (name_len + dsym_len + base_len + 1);
521 bfd *dsym_bfd;
522 asection *sect;
523 bfd_byte main_uuid[16];
524 bfd_byte dsym_uuid[16];
525
526 strcpy (dsym_filename, objfile->name);
527 strcpy (dsym_filename + name_len, DSYM_SUFFIX);
528 strcpy (dsym_filename + name_len + dsym_len, base_name);
529
530 if (access (dsym_filename, R_OK) != 0)
531 return NULL;
532
533 sect = bfd_get_section_by_name (objfile->obfd, "LC_UUID");
534 if (sect == NULL)
535 {
536 warning (_("can't find UUID in %s"), objfile->name);
537 return NULL;
538 }
539 if (!bfd_get_section_contents (objfile->obfd, sect, main_uuid,
540 0, sizeof (main_uuid)))
541 {
542 warning (_("can't read UUID in %s"), objfile->name);
543 return NULL;
544 }
545
546 dsym_filename = xstrdup (dsym_filename);
547 dsym_bfd = bfd_openr (dsym_filename, gnutarget);
548 if (dsym_bfd == NULL)
549 {
550 warning (_("can't open dsym file %s"), dsym_filename);
551 xfree (dsym_filename);
552 return NULL;
553 }
554
555 if (!bfd_check_format (dsym_bfd, bfd_object))
556 {
557 bfd_close (dsym_bfd);
558 warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ()));
559 xfree (dsym_filename);
560 return NULL;
561 }
562
563 sect = bfd_get_section_by_name (dsym_bfd, "LC_UUID");
564 if (sect == NULL)
565 {
566 warning (_("can't find UUID in %s"), dsym_filename);
567 bfd_close (dsym_bfd);
568 xfree (dsym_filename);
569 return NULL;
570 }
571 if (!bfd_get_section_contents (dsym_bfd, sect, dsym_uuid,
572 0, sizeof (dsym_uuid)))
573 {
574 warning (_("can't read UUID in %s"), dsym_filename);
575 bfd_close (dsym_bfd);
576 xfree (dsym_filename);
577 return NULL;
578 }
579 if (memcmp (dsym_uuid, main_uuid, sizeof (main_uuid)))
580 {
581 warning (_("dsym file UUID doesn't match the one in %s"), objfile->name);
582 bfd_close (dsym_bfd);
583 xfree (dsym_filename);
584 return NULL;
585 }
586 return dsym_bfd;
587
588 }
589
590 static void
591 macho_symfile_read (struct objfile *objfile, int symfile_flags)
592 {
593 bfd *abfd = objfile->obfd;
594 struct cleanup *back_to;
595 CORE_ADDR offset;
596 long storage_needed;
597 bfd *dsym_bfd;
598
599 init_minimal_symbol_collection ();
600 back_to = make_cleanup_discard_minimal_symbols ();
601
602 /* Get symbols from the symbol table only if the file is an executable.
603 The symbol table of object files is not relocated and is expected to
604 be in the executable. */
605 if (bfd_get_file_flags (abfd) & (EXEC_P | DYNAMIC))
606 {
607 /* Process the normal symbol table first. */
608 storage_needed = bfd_get_symtab_upper_bound (objfile->obfd);
609 if (storage_needed < 0)
610 error (_("Can't read symbols from %s: %s"),
611 bfd_get_filename (objfile->obfd),
612 bfd_errmsg (bfd_get_error ()));
613
614 if (storage_needed > 0)
615 {
616 asymbol **symbol_table;
617 long symcount;
618
619 symbol_table = (asymbol **) xmalloc (storage_needed);
620 make_cleanup (xfree, symbol_table);
621 symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);
622
623 if (symcount < 0)
624 error (_("Can't read symbols from %s: %s"),
625 bfd_get_filename (objfile->obfd),
626 bfd_errmsg (bfd_get_error ()));
627
628 macho_symtab_read (objfile, symcount, symbol_table);
629 }
630
631 install_minimal_symbols (objfile);
632
633 /* Try to read .eh_frame / .debug_frame. */
634 /* First, locate these sections. We ignore the result status
635 as it only checks for debug info. */
636 dwarf2_has_info (objfile);
637 dwarf2_build_frame_info (objfile);
638
639 /* Check for DSYM file. */
640 dsym_bfd = macho_check_dsym (objfile);
641 if (dsym_bfd != NULL)
642 {
643 int ix;
644 oso_el *oso;
645
646 if (mach_o_debug_level > 0)
647 printf_unfiltered (_("dsym file found\n"));
648
649 /* Remove oso. They won't be used. */
650 for (ix = 0; VEC_iterate (oso_el, oso_vector, ix, oso); ix++)
651 {
652 xfree (oso->symbols);
653 xfree (oso->offsets);
654 }
655 VEC_free (oso_el, oso_vector);
656 oso_vector = NULL;
657
658 /* Add the dsym file as a separate file. */
659 symbol_file_add_separate (dsym_bfd, symfile_flags, objfile);
660
661 /* Don't try to read dwarf2 from main file or shared libraries. */
662 return;
663 }
664 }
665
666 if (dwarf2_has_info (objfile))
667 {
668 /* DWARF 2 sections */
669 dwarf2_build_psymtabs (objfile);
670 }
671
672 /* Do not try to read .eh_frame/.debug_frame as they are not relocated
673 and dwarf2_build_frame_info cannot deal with unrelocated sections. */
674
675 /* Then the oso. */
676 if (oso_vector != NULL)
677 macho_oso_symfile (objfile);
678 }
679
680 static void
681 macho_symfile_finish (struct objfile *objfile)
682 {
683 }
684
685 static void
686 macho_symfile_offsets (struct objfile *objfile,
687 struct section_addr_info *addrs)
688 {
689 unsigned int i;
690 unsigned int num_sections;
691 struct obj_section *osect;
692
693 /* Allocate section_offsets. */
694 objfile->num_sections = bfd_count_sections (objfile->obfd);
695 objfile->section_offsets = (struct section_offsets *)
696 obstack_alloc (&objfile->objfile_obstack,
697 SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
698 memset (objfile->section_offsets, 0,
699 SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
700
701 /* This code is run when we first add the objfile with
702 symfile_add_with_addrs_or_offsets, when "addrs" not "offsets" are
703 passed in. The place in symfile.c where the addrs are applied
704 depends on the addrs having section names. But in the dyld code
705 we build an anonymous array of addrs, so that code is a no-op.
706 Because of that, we have to apply the addrs to the sections here.
707 N.B. if an objfile slides after we've already created it, then it
708 goes through objfile_relocate. */
709
710 for (i = 0; i < addrs->num_sections; i++)
711 {
712 if (addrs->other[i].name == NULL)
713 continue;
714
715 ALL_OBJFILE_OSECTIONS (objfile, osect)
716 {
717 const char *bfd_sect_name = osect->the_bfd_section->name;
718
719 if (strcmp (bfd_sect_name, addrs->other[i].name) == 0)
720 {
721 obj_section_offset (osect) = addrs->other[i].addr;
722 break;
723 }
724 }
725 }
726
727 objfile->sect_index_text = 0;
728
729 ALL_OBJFILE_OSECTIONS (objfile, osect)
730 {
731 const char *bfd_sect_name = osect->the_bfd_section->name;
732 int sect_index = osect->the_bfd_section->index;
733
734 if (strncmp (bfd_sect_name, "LC_SEGMENT.", 11) == 0)
735 bfd_sect_name += 11;
736 if (strcmp (bfd_sect_name, "__TEXT") == 0
737 || strcmp (bfd_sect_name, "__TEXT.__text") == 0)
738 objfile->sect_index_text = sect_index;
739 }
740 }
741
742 static struct sym_fns macho_sym_fns = {
743 bfd_target_mach_o_flavour,
744
745 macho_new_init, /* sym_new_init: init anything gbl to entire symtab */
746 macho_symfile_init, /* sym_init: read initial info, setup for sym_read() */
747 macho_symfile_read, /* sym_read: read a symbol file into symtab */
748 macho_symfile_finish, /* sym_finish: finished with file, cleanup */
749 macho_symfile_offsets, /* sym_offsets: xlate external to internal form */
750 default_symfile_segments, /* sym_segments: Get segment information from
751 a file. */
752 NULL /* next: pointer to next struct sym_fns */
753 };
754
755 void
756 _initialize_machoread ()
757 {
758 add_symtab_fns (&macho_sym_fns);
759
760 add_setshow_zinteger_cmd ("mach-o", class_obscure,
761 &mach_o_debug_level, _("\
762 Set if printing Mach-O symbols processing."), _("\
763 Show if printing Mach-O symbols processing."), NULL,
764 NULL, NULL,
765 &setdebuglist, &showdebuglist);
766 }
This page took 0.065662 seconds and 5 git commands to generate.