OLD | NEW |
1 /* Darwin support for GDB, the GNU debugger. | 1 /* Darwin support for GDB, the GNU debugger. |
2 Copyright (C) 2008-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2008-2012 Free Software Foundation, Inc. |
3 | 3 |
4 Contributed by AdaCore. | 4 Contributed by AdaCore. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 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 | 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 | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 offset = ANOFFSET (objfile->section_offsets, sym->section->index); | 119 offset = ANOFFSET (objfile->section_offsets, sym->section->index); |
120 | 120 |
121 /* Bfd symbols are section relative. */ | 121 /* Bfd symbols are section relative. */ |
122 symaddr = sym->value + sym->section->vma; | 122 symaddr = sym->value + sym->section->vma; |
123 | 123 |
124 /* Select global/local/weak symbols. Note that bfd puts abs | 124 /* Select global/local/weak symbols. Note that bfd puts abs |
125 symbols in their own section, so all symbols we are | 125 symbols in their own section, so all symbols we are |
126 interested in will have a section. */ | 126 interested in will have a section. */ |
127 /* Relocate all non-absolute and non-TLS symbols by the | 127 /* Relocate all non-absolute and non-TLS symbols by the |
128 section offset. */ | 128 section offset. */ |
129 if (sym->section != &bfd_abs_section | 129 if (sym->section != bfd_abs_section_ptr |
130 && !(sym->section->flags & SEC_THREAD_LOCAL)) | 130 && !(sym->section->flags & SEC_THREAD_LOCAL)) |
131 symaddr += offset; | 131 symaddr += offset; |
132 | 132 |
133 if (sym->section == &bfd_abs_section) | 133 if (sym->section == bfd_abs_section_ptr) |
134 ms_type = mst_abs; | 134 ms_type = mst_abs; |
135 else if (sym->section->flags & SEC_CODE) | 135 else if (sym->section->flags & SEC_CODE) |
136 { | 136 { |
137 if (sym->flags & (BSF_GLOBAL | BSF_WEAK)) | 137 if (sym->flags & (BSF_GLOBAL | BSF_WEAK)) |
138 ms_type = mst_text; | 138 ms_type = mst_text; |
139 else | 139 else |
140 ms_type = mst_file_text; | 140 ms_type = mst_file_text; |
141 } | 141 } |
142 else if (sym->section->flags & SEC_ALLOC) | 142 else if (sym->section->flags & SEC_ALLOC) |
143 { | 143 { |
(...skipping 29 matching lines...) Expand all Loading... |
173 NUMBER_OF_SYMBOLS for OBJFILE. Registers OSO filenames found. */ | 173 NUMBER_OF_SYMBOLS for OBJFILE. Registers OSO filenames found. */ |
174 | 174 |
175 static void | 175 static void |
176 macho_symtab_read (struct objfile *objfile, | 176 macho_symtab_read (struct objfile *objfile, |
177 long number_of_symbols, asymbol **symbol_table) | 177 long number_of_symbols, asymbol **symbol_table) |
178 { | 178 { |
179 long i; | 179 long i; |
180 const asymbol *dir_so = NULL; | 180 const asymbol *dir_so = NULL; |
181 const asymbol *file_so = NULL; | 181 const asymbol *file_so = NULL; |
182 asymbol **oso_file = NULL; | 182 asymbol **oso_file = NULL; |
183 unsigned int nbr_syms; | 183 unsigned int nbr_syms = 0; |
184 | 184 |
185 /* Current state while reading stabs. */ | 185 /* Current state while reading stabs. */ |
186 enum | 186 enum |
187 { | 187 { |
188 /* Not within an SO part. Only non-debugging symbols should be present, | 188 /* Not within an SO part. Only non-debugging symbols should be present, |
189 and will be added to the minimal symbols table. */ | 189 and will be added to the minimal symbols table. */ |
190 S_NO_SO, | 190 S_NO_SO, |
191 | 191 |
192 /* First SO read. Introduce an SO section, and may be followed by a second | 192 /* First SO read. Introduce an SO section, and may be followed by a second |
193 SO. The SO section should contain onl debugging symbols. */ | 193 SO. The SO section should contain onl debugging symbols. */ |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_UNDF | 556 if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_UNDF |
557 && sym->value != 0) | 557 && sym->value != 0) |
558 { | 558 { |
559 /* For common symbol use the min symtab and modify the OSO | 559 /* For common symbol use the min symtab and modify the OSO |
560 symbol table. */ | 560 symbol table. */ |
561 CORE_ADDR res; | 561 CORE_ADDR res; |
562 | 562 |
563 res = macho_resolve_oso_sym_with_minsym (main_objfile, sym); | 563 res = macho_resolve_oso_sym_with_minsym (main_objfile, sym); |
564 if (res != 0) | 564 if (res != 0) |
565 { | 565 { |
566 sym->section = &bfd_com_section; | 566 sym->section = bfd_com_section_ptr; |
567 sym->value = res; | 567 sym->value = res; |
568 } | 568 } |
569 } | 569 } |
570 else if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT) | 570 else if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT) |
571 { | 571 { |
572 /* Normal symbol. */ | 572 /* Normal symbol. */ |
573 asection *sec = sym->section; | 573 asection *sec = sym->section; |
574 bfd_mach_o_section *msec; | 574 bfd_mach_o_section *msec; |
575 unsigned int sec_type; | 575 unsigned int sec_type; |
576 | 576 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1025 |
1026 macho_new_init, /* init anything gbl to entire symtab */ | 1026 macho_new_init, /* init anything gbl to entire symtab */ |
1027 macho_symfile_init, /* read initial info, setup for sym_read() */ | 1027 macho_symfile_init, /* read initial info, setup for sym_read() */ |
1028 macho_symfile_read, /* read a symbol file into symtab */ | 1028 macho_symfile_read, /* read a symbol file into symtab */ |
1029 NULL, /* sym_read_psymbols */ | 1029 NULL, /* sym_read_psymbols */ |
1030 macho_symfile_finish, /* finished with file, cleanup */ | 1030 macho_symfile_finish, /* finished with file, cleanup */ |
1031 macho_symfile_offsets, /* xlate external to internal form */ | 1031 macho_symfile_offsets, /* xlate external to internal form */ |
1032 default_symfile_segments, /* Get segment information from a file. */ | 1032 default_symfile_segments, /* Get segment information from a file. */ |
1033 NULL, | 1033 NULL, |
1034 macho_symfile_relocate, /* Relocate a debug section. */ | 1034 macho_symfile_relocate, /* Relocate a debug section. */ |
| 1035 NULL, /* sym_get_probes */ |
1035 &psym_functions | 1036 &psym_functions |
1036 }; | 1037 }; |
1037 | 1038 |
| 1039 /* -Wmissing-prototypes */ |
| 1040 extern initialize_file_ftype _initialize_machoread; |
| 1041 |
1038 void | 1042 void |
1039 _initialize_machoread () | 1043 _initialize_machoread () |
1040 { | 1044 { |
1041 add_symtab_fns (&macho_sym_fns); | 1045 add_symtab_fns (&macho_sym_fns); |
1042 | 1046 |
1043 add_setshow_zinteger_cmd ("mach-o", class_obscure, | 1047 add_setshow_zinteger_cmd ("mach-o", class_obscure, |
1044 &mach_o_debug_level, | 1048 &mach_o_debug_level, |
1045 _("Set if printing Mach-O symbols processing."), | 1049 _("Set if printing Mach-O symbols processing."), |
1046 _("Show if printing Mach-O symbols processing."), | 1050 _("Show if printing Mach-O symbols processing."), |
1047 NULL, NULL, NULL, | 1051 NULL, NULL, NULL, |
1048 &setdebuglist, &showdebuglist); | 1052 &setdebuglist, &showdebuglist); |
1049 } | 1053 } |
OLD | NEW |