Home | History | Annotate | Download | only in bfd

Lines Matching defs:unit

89   /* Last comp unit in list above.  */
95 /* The next unread compilation unit within the .debug_info section.
208 /* Likewise, chain the compilation unit read after this one.
216 unit as specified in the compilation unit header. */
231 /* TRUE if there is a line number table associated with this comp. unit. */
244 /* Pointer to the first child die for the comp unit. */
247 /* The end of the comp unit. */
253 /* A list of the functions found in this comp. unit. */
256 /* A list of the variables found in this comp. unit. */
262 /* DWARF format version for this unit - from unit header. */
265 /* Address size for this unit - from unit header. */
268 /* Offset size for this unit - from unit header. */
271 /* Base address for this unit - from DW_AT_low_pc attribute of
621 read_indirect_string (struct comp_unit * unit,
626 struct dwarf2_debug *stash = unit->stash;
629 if (unit->offset_size == 4)
630 offset = read_4_bytes (unit->abfd, buf);
632 offset = read_8_bytes (unit->abfd, buf);
634 *bytes_read_ptr = unit->offset_size;
636 if (! read_section (unit->abfd, &stash->debug_sections[debug_str],
652 read_alt_indirect_string (struct comp_unit * unit,
657 struct dwarf2_debug *stash = unit->stash;
660 if (unit->offset_size == 4)
661 offset = read_4_bytes (unit->abfd, buf);
663 offset = read_8_bytes (unit->abfd, buf);
665 *bytes_read_ptr = unit->offset_size;
670 char * debug_filename = bfd_follow_gnu_debugaltlink (unit->abfd, DEBUGDIR);
688 if (! read_section (unit->stash->alt_bfd_ptr,
703 /* Resolve an alternate reference from UNIT at OFFSET.
708 read_alt_indirect_ref (struct comp_unit * unit,
711 struct dwarf2_debug *stash = unit->stash;
716 char * debug_filename = bfd_follow_gnu_debugaltlink (unit->abfd, DEBUGDIR);
734 if (! read_section (unit->stash->alt_bfd_ptr,
746 read_address (struct comp_unit *unit, bfd_byte *buf)
748 int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma;
752 switch (unit->addr_size)
755 return bfd_get_signed_64 (unit->abfd, buf);
757 return bfd_get_signed_32 (unit->abfd, buf);
759 return bfd_get_signed_16 (unit->abfd, buf);
766 switch (unit->addr_size)
769 return bfd_get_64 (unit->abfd, buf);
771 return bfd_get_32 (unit->abfd, buf);
773 return bfd_get_16 (unit->abfd, buf);
896 Under Irix6 the abbreviations for a compilation unit are not
900 for the next compile unit) or if the end of the abbreviation
927 struct comp_unit *unit,
930 bfd *abfd = unit->abfd;
942 if (unit->version == 3 || unit->version == 4)
944 if (unit->offset_size == 4)
945 attr->u.val = read_4_bytes (unit->abfd, info_ptr);
947 attr->u.val = read_8_bytes (unit->abfd, info_ptr);
948 info_ptr += unit->offset_size;
953 attr->u.val = read_address (unit, info_ptr);
954 info_ptr += unit->addr_size;
958 if (unit->offset_size == 4)
959 attr->u.val = read_4_bytes (unit->abfd, info_ptr);
961 attr->u.val = read_8_bytes (unit->abfd, info_ptr);
962 info_ptr += unit->offset_size;
1003 attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read);
1007 attr->u.str = read_alt_indirect_string (unit, info_ptr, &bytes_read);
1079 info_ptr = read_attribute_value (attr, form, unit, info_ptr);
1095 struct comp_unit *unit,
1099 info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
1394 arange_add (const struct comp_unit *unit, struct arange *first_arange,
1431 arange = (struct arange *) bfd_alloc (unit->abfd, sizeof (*arange));
1538 /* Decode the line number information for UNIT. */
1541 decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
1543 bfd *abfd = unit->abfd;
1555 stash->syms, unit->line_offset,
1564 table->comp_dir = unit->comp_dir;
1577 line_ptr = stash->dwarf_line_buffer + unit->line_offset;
1589 else if (lh.total_length == 0 && unit->addr_size == 8)
1774 if (!arange_add (unit, &unit->arange, low_pc, high_pc))
1778 address = read_address (unit, line_ptr);
1780 line_ptr += unit->addr_size;
1982 read_debug_ranges (struct comp_unit *unit)
1984 struct dwarf2_debug *stash = unit->stash;
1985 return read_section (unit->abfd, &stash->debug_sections[debug_ranges],
1992 /* If ADDR is within UNIT's function tables, set FUNCTIONNAME_PTR, and return
1998 lookup_address_in_function_table (struct comp_unit *unit,
2008 for (each_func = unit->function_table;
2040 /* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR
2044 lookup_symbol_in_function_table (struct comp_unit *unit,
2057 for (each_func = unit->function_table;
2092 /* If SYM is within variable table of UNIT, set FILENAME_PTR and
2096 lookup_symbol_in_variable_table (struct comp_unit *unit,
2106 for (each = unit->variable_table; each; each = each->prev_var)
2127 find_abstract_instance_name (struct comp_unit *unit,
2130 bfd *abfd = unit->abfd;
2147 info_ptr = unit->sec_info_ptr + die_ref;
2150 if (info_ptr >= unit->info_ptr_unit && info_ptr < unit->end_ptr)
2157 for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
2162 for (u = unit->next_unit; u != NULL; u = u->next_unit)
2167 unit = u;
2173 info_ptr = read_alt_indirect_ref (unit, die_ref);
2185 info_ptr = unit->info_ptr_unit + die_ref;
2192 abbrev = lookup_abbrev (abbrev_number, unit->abbrevs);
2203 info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit,
2216 name = find_abstract_instance_name (unit, &attr);
2235 read_rangelist (struct comp_unit *unit, struct arange *arange,
2239 bfd_vma base_address = unit->base_address;
2241 if (! unit->stash->dwarf_ranges_buffer)
2243 if (! read_debug_ranges (unit))
2246 ranges_ptr = unit->stash->dwarf_ranges_buffer + offset;
2253 low_pc = read_address (unit, ranges_ptr);
2254 ranges_ptr += unit->addr_size;
2255 high_pc = read_address (unit, ranges_ptr);
2256 ranges_ptr += unit->addr_size;
2264 if (!arange_add (unit, arange,
2272 /* DWARF2 Compilation unit functions. */
2274 /* Scan over each die in a comp. unit looking for functions to add
2278 scan_unit_for_symbols (struct comp_unit *unit)
2280 bfd *abfd = unit->abfd;
2281 bfd_byte *info_ptr = unit->first_child_die_ptr;
2315 abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
2335 func->prev_func = unit->function_table;
2336 unit->function_table = func;
2337 BFD_ASSERT (!unit->cached);
2359 var->prev_var = unit->variable_table;
2360 unit->variable_table = var;
2361 BFD_ASSERT (!unit->cached);
2370 info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
2379 func->caller_file = concat_filename (unit->line_table,
2389 func->name = find_abstract_instance_name (unit, &attr);
2417 if (!read_rangelist (unit, &func->arange, attr.u.val))
2422 func->file = concat_filename (unit->line_table,
2443 var->file = concat_filename (unit->line_table,
2474 if (attr.u.blk->size == unit->addr_size + 1U)
2475 var->addr = bfd_get (unit->addr_size * 8,
2476 unit->abfd,
2497 if (!arange_add (unit, &func->arange, low_pc, high_pc))
2529 /* Parse a DWARF2 compilation unit starting at INFO_PTR. This
2530 includes the compilation unit header that proceeds the DIE's, but
2532 unit header. END_PTR points one past the end of this comp unit.
2535 This routine does not read the whole compilation unit; only enough
2536 to get to the line number information for the compilation unit. */
2544 struct comp_unit* unit;
2600 /* Read the abbrevs for this compilation unit into a table. */
2625 unit = (struct comp_unit *) bfd_zalloc (abfd, amt);
2626 if (unit == NULL)
2628 unit->abfd = abfd;
2629 unit->version = version;
2630 unit->addr_size = addr_size;
2631 unit->offset_size = offset_size;
2632 unit->abbrevs = abbrevs;
2633 unit->end_ptr = end_ptr;
2634 unit->stash = stash;
2635 unit->info_ptr_unit = info_ptr_unit;
2636 unit->sec_info_ptr = stash->sec_info_ptr;
2640 info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
2649 unit->stmtlist = 1;
2650 unit->line_offset = attr.u.val;
2654 unit->name = attr.u.str;
2659 /* If the compilation unit DIE has a DW_AT_low_pc attribute,
2663 unit->base_address = low_pc;
2672 if (!read_rangelist (unit, &unit->arange, attr.u.val))
2688 unit->comp_dir = comp_dir;
2700 if (!arange_add (unit, &unit->arange, low_pc, high_pc))
2704 unit->first_child_die_ptr = info_ptr;
2705 return unit;
2708 /* Return TRUE if UNIT may contain the address given by ADDR. When
2710 range info in the compilation unit header may not be correct. We
2711 need to consult the line info table to see if a compilation unit
2715 comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr)
2719 if (unit->error)
2722 arange = &unit->arange;
2734 /* If UNIT contains ADDR, set the output parameters to the values for
2743 comp_unit_find_nearest_line (struct comp_unit *unit,
2754 if (unit->error)
2757 if (! unit->line_table)
2759 if (! unit->stmtlist)
2761 unit->error = 1;
2765 unit->line_table = decode_line_info (unit, stash);
2767 if (! unit->line_table)
2769 unit->error = 1;
2773 if (unit->first_child_die_ptr < unit->end_ptr
2774 && ! scan_unit_for_symbols (unit))
2776 unit->error = 1;
2782 func_p = lookup_address_in_function_table (unit, addr,
2787 return lookup_address_in_line_info_table (unit->line_table, addr,
2798 comp_unit_maybe_decode_line_info (struct comp_unit *unit,
2801 if (unit->error)
2804 if (! unit->line_table)
2806 if (! unit->stmtlist)
2808 unit->error = 1;
2812 unit->line_table = decode_line_info (unit, stash);
2814 if (! unit->line_table)
2816 unit->error = 1;
2820 if (unit->first_child_die_ptr < unit->end_ptr
2821 && ! scan_unit_for_symbols (unit))
2823 unit->error = 1;
2831 /* If UNIT contains SYM at ADDR, set the output parameters to the
2836 Return TRUE if UNIT contains SYM, and no errors were encountered;
2840 comp_unit_find_line (struct comp_unit *unit,
2847 if (!comp_unit_maybe_decode_line_info (unit, stash))
2851 return lookup_symbol_in_function_table (unit, sym, addr,
2855 return lookup_symbol_in_variable_table (unit, sym, addr,
2891 unit into hash tables for faster lookup. Returns TRUE if no
2896 struct comp_unit *unit,
2906 if (!comp_unit_maybe_decode_line_info (unit, stash))
2909 BFD_ASSERT (!unit->cached);
2916 unit->function_table = reverse_funcinfo_list (unit->function_table);
2917 for (each_func = unit->function_table;
2929 unit->function_table = reverse_funcinfo_list (unit->function_table);
2934 unit->variable_table = reverse_varinfo_list (unit->variable_table);
2935 for (each_var = unit->variable_table;
2950 unit->variable_table = reverse_varinfo_list (unit->variable_table);
2951 unit->cached = TRUE;
3382 be created even though there is no compilation unit. That
3619 /* Read each compilation unit from the section .debug_info, and check
3622 on to the next compilation unit.
3625 a pointer to the next un-read compilation unit. Check the
3833 unit->high == 0), we need to consult the line info table
3834 to see if a compilation unit contains the given