OLD | NEW |
1 /* DWARF 2 support. | 1 /* DWARF 2 support. |
2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, | 2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
3 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 3 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
4 | 4 |
5 Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions | 5 Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions |
6 (gavin@cygnus.com). | 6 (gavin@cygnus.com). |
7 | 7 |
8 From the dwarf2read.c header: | 8 From the dwarf2read.c header: |
9 Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology, | 9 Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology, |
10 Inc. with support from Florida State University (under contract | 10 Inc. with support from Florida State University (under contract |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 /* The DW_AT_comp_dir attribute. */ | 209 /* The DW_AT_comp_dir attribute. */ |
210 char *comp_dir; | 210 char *comp_dir; |
211 | 211 |
212 /* TRUE if there is a line number table associated with this comp. unit. */ | 212 /* TRUE if there is a line number table associated with this comp. unit. */ |
213 int stmtlist; | 213 int stmtlist; |
214 | 214 |
215 /* Pointer to the current comp_unit so that we can find a given entry | 215 /* Pointer to the current comp_unit so that we can find a given entry |
216 by its reference. */ | 216 by its reference. */ |
217 bfd_byte *info_ptr_unit; | 217 bfd_byte *info_ptr_unit; |
218 | 218 |
| 219 /* Pointer to the start of the debug section, for DW_FORM_ref_addr. */ |
| 220 bfd_byte *sec_info_ptr; |
| 221 |
219 /* The offset into .debug_line of the line number table. */ | 222 /* The offset into .debug_line of the line number table. */ |
220 unsigned long line_offset; | 223 unsigned long line_offset; |
221 | 224 |
222 /* Pointer to the first child die for the comp unit. */ | 225 /* Pointer to the first child die for the comp unit. */ |
223 bfd_byte *first_child_die_ptr; | 226 bfd_byte *first_child_die_ptr; |
224 | 227 |
225 /* The end of the comp unit. */ | 228 /* The end of the comp unit. */ |
226 bfd_byte *end_ptr; | 229 bfd_byte *end_ptr; |
227 | 230 |
228 /* The decoded line number, NULL if not yet decoded. */ | 231 /* The decoded line number, NULL if not yet decoded. */ |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 | 1676 |
1674 /* DW_FORM_ref_addr can reference an entry in a different CU. It | 1677 /* DW_FORM_ref_addr can reference an entry in a different CU. It |
1675 is an offset from the .debug_info section, not the current CU. */ | 1678 is an offset from the .debug_info section, not the current CU. */ |
1676 if (attr_ptr->form == DW_FORM_ref_addr) | 1679 if (attr_ptr->form == DW_FORM_ref_addr) |
1677 { | 1680 { |
1678 /* We only support DW_FORM_ref_addr within the same file, so | 1681 /* We only support DW_FORM_ref_addr within the same file, so |
1679 any relocations should be resolved already. */ | 1682 any relocations should be resolved already. */ |
1680 if (!die_ref) | 1683 if (!die_ref) |
1681 abort (); | 1684 abort (); |
1682 | 1685 |
1683 info_ptr = unit->stash->sec_info_ptr + die_ref; | 1686 info_ptr = unit->sec_info_ptr + die_ref; |
1684 } | 1687 } |
1685 else | 1688 else |
1686 info_ptr = unit->info_ptr_unit + die_ref; | 1689 info_ptr = unit->info_ptr_unit + die_ref; |
1687 abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); | 1690 abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
1688 info_ptr += bytes_read; | 1691 info_ptr += bytes_read; |
1689 | 1692 |
1690 if (abbrev_number) | 1693 if (abbrev_number) |
1691 { | 1694 { |
1692 abbrev = lookup_abbrev (abbrev_number, unit->abbrevs); | 1695 abbrev = lookup_abbrev (abbrev_number, unit->abbrevs); |
1693 if (! abbrev) | 1696 if (! abbrev) |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 amt = sizeof (struct comp_unit); | 2084 amt = sizeof (struct comp_unit); |
2082 unit = (struct comp_unit *) bfd_zalloc (abfd, amt); | 2085 unit = (struct comp_unit *) bfd_zalloc (abfd, amt); |
2083 unit->abfd = abfd; | 2086 unit->abfd = abfd; |
2084 unit->version = version; | 2087 unit->version = version; |
2085 unit->addr_size = addr_size; | 2088 unit->addr_size = addr_size; |
2086 unit->offset_size = offset_size; | 2089 unit->offset_size = offset_size; |
2087 unit->abbrevs = abbrevs; | 2090 unit->abbrevs = abbrevs; |
2088 unit->end_ptr = end_ptr; | 2091 unit->end_ptr = end_ptr; |
2089 unit->stash = stash; | 2092 unit->stash = stash; |
2090 unit->info_ptr_unit = info_ptr_unit; | 2093 unit->info_ptr_unit = info_ptr_unit; |
| 2094 unit->sec_info_ptr = stash->sec_info_ptr; |
2091 | 2095 |
2092 for (i = 0; i < abbrev->num_attrs; ++i) | 2096 for (i = 0; i < abbrev->num_attrs; ++i) |
2093 { | 2097 { |
2094 info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); | 2098 info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); |
2095 | 2099 |
2096 /* Store the data if it is of an attribute we want to keep in a | 2100 /* Store the data if it is of an attribute we want to keep in a |
2097 partial symbol table. */ | 2101 partial symbol table. */ |
2098 switch (attr.name) | 2102 switch (attr.name) |
2099 { | 2103 { |
2100 case DW_AT_stmt_list: | 2104 case DW_AT_stmt_list: |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 free (stash->dwarf_abbrev_buffer); | 3305 free (stash->dwarf_abbrev_buffer); |
3302 if (stash->dwarf_line_buffer) | 3306 if (stash->dwarf_line_buffer) |
3303 free (stash->dwarf_line_buffer); | 3307 free (stash->dwarf_line_buffer); |
3304 if (stash->dwarf_str_buffer) | 3308 if (stash->dwarf_str_buffer) |
3305 free (stash->dwarf_str_buffer); | 3309 free (stash->dwarf_str_buffer); |
3306 if (stash->dwarf_ranges_buffer) | 3310 if (stash->dwarf_ranges_buffer) |
3307 free (stash->dwarf_ranges_buffer); | 3311 free (stash->dwarf_ranges_buffer); |
3308 if (stash->info_ptr_memory) | 3312 if (stash->info_ptr_memory) |
3309 free (stash->info_ptr_memory); | 3313 free (stash->info_ptr_memory); |
3310 } | 3314 } |
OLD | NEW |