aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
AgeCommit message (Collapse)AuthorFilesLines
2009-07-10bfdTom Tromey1-1/+1
* Makefile.am (dwarf2.lo): Use dwarf2.h, not elf/dwarf2.h. (elf-eh-frame.lo): Likewise. (elf32-bfin.lo): Likewise. (elf32-frv.lo): Likewise. (elf32-xc16x.lo): Likewise. * Makefile.in: Rebuild. * dwarf2.c: Included dwarf.h, not elf/dwarf2.h. * elf-eh-frame.c: Likewise. * elf32-bfin.c: Likewise. * elf32-frv.c: Likewise. * elf32-xc16x.c: Likewise. binutils * Makefile.am (dwarf.o): Refer to dwarf2.h, not elf/dwarf2.h. * Makefile.in: Rebuild. * dwarf.c: Include dwarf2.h, not elf/dwarf2.h. gas * Makefile.am (DEPTC_alpha_ecoff): Refer to dwarf2.h, not elf/dwarf2.h. (DEPTC_alpha_elf): Likewise. (DEPTC_alpha_evax): Likewise. (DEPTC_arm_elf): Likewise. (DEPTC_hppa_elf): Likewise. (DEPTC_i386_aout): Likewise. (DEPTC_i386_coff): Likewise. (DEPTC_i386_elf): Likewise. (DEPTC_m68k_aout): Likewise. (DEPTC_m68k_coff): Likewise. (DEPTC_m68k_elf): Likewise. (DEPTC_mips_coff): Likewise. (DEPTC_mips_ecoff): Likewise. (DEPTC_mips_elf): Likewise. (DEPTC_ppc_coff): Likewise. (DEPTC_ppc_elf): Likewise. (DEPTC_s390_elf): Likewise. (DEPTC_sh_coff): Likewise. (DEPTC_sh_elf): Likewise. (DEPTC_sh64_elf): Likewise. (DEPTC_sparc_aout): Likewise. (DEPTC_sparc_coff): Likewise. (DEPTC_sparc_elf): Likewise. (as.o): Likewise. (dwarf2dbg.o): Likewise. (dw2gencfi.o): Likewise. (ehopt.o): Likewise. (read.o): Likewise. * Makefile.in: Rebuild. * dw2gencfi.h: Include dwarf2.h, not elf/dwarf2.h. * dwarf2dbg.c: Likewise. * ehopt.c: Likewise. gdb * dwarf2-frame.c: Include dwarf2.h, not elf/dwarf2.h. * dwarf2expr.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * sh-tdep.c: Likewise. * xtensa-tdep.c: Likewise. include * dwarf2.h: New file, moved from elf/. include/elf * dwarf2.h: Move to `..'.
2009-07-032009-07-03 Cary Coutant <ccoutant@google.com>Dave Korn1-0/+4
* dwarf2.c (decode_line_info): Ignore DW_LNE_set_discriminator.
2009-03-162009-03-16 Andrew Stubbs <ams@codesourcery.com>Andrew Stubbs1-2/+1
* dwarf2.c (read_section): Always use rawsize, if available.
2009-03-122009-03-12 Andrew Stubbs <ams@codesourcery.com>Andrew Stubbs1-38/+38
* dwarf2.c (read_section): Always check the offset, even when the section has been read before.
2009-01-30 * dwarf2.c (read_rangelist): Use read_address to read low_pc andAdam Nemet1-14/+5
high_pc in order to properly sign-extend VMAs.
2009-01-22 PR 6832Alan Modra1-8/+9
* dwarf2.c (find_line): Don't update stash->sec_info_ptr until after comp_unit_find_line call.
2008-11-18 * dwarf2.c (read_section): Fix formatting.Nick Clifton1-18/+21
(read_n_bytes): Remove unhelpful comment. (read_indirect_string): Pass symbol table to read_section in case the .debug_str section needs relocating. PR 7037 * elf32-cr16.c (cr16_elf_howto_table): Zero the src_mask field of the reloc descriptions.
2008-11-10 PR 7012Alan Modra1-32/+37
* dwarf2.c (find_line): Don't keep stale pointers into realloc'd memory. Return on errors. Fix memory leak. (_bfd_dwarf2_cleanup_debug_info): Free dwarf_str_buffer.
2008-09-08 PR ld/3191Daniel Jacobowitz1-33/+99
* dwarf2.c (struct adjusted_section): Renamed from struct loadable_section. (struct dwarf2_debug): Adjust for renaming. Add version field. (read_attribute_value): Correctly handle DW_FORM_ref_addr for DWARF3. (find_abstract_instance_name): Pass a pointer to attribute instead of offset. For DW_FORM_ref_addr, get the entry at the offset from the .debug_info section. (scan_unit_for_symbols): Update. (parse_comp_unit): Allow DWARF3. Save the version. (unset_sections): Update for renaming. (place_sections): Likewise. Set new VMAs for DWARF sections also.
2008-09-05Fix last commit.Daniel Jacobowitz1-31/+31
2008-09-05 * dwarf2.c: Change leading whitespace to tabs.Daniel Jacobowitz1-113/+113
2008-07-142008-07-13 Craig Silverstein <csilvers@google.com>Craig Silverstein1-5/+14
* dwarf2.c (struct dwarf2_debug): New variable info_ptr_memory. (find_line): Use info_ptr_memory instead of sec_info_ptr. (_bfd_dwarf2_cleanup_debug_info): Likewise.
2008-07-11(read_section): Take pointer to bfd_size_type insteadAndreas Schwab1-5/+5
of unsigned long as last parameter. (struct dwarf2_debug): Define dwarf_abbrev_size, dwarf_line_size, dwarf_str_size and dwarf_ranges_size as bfd_size_type instead of unsigned long.
2008-07-10bfd/Craig Silverstein1-145/+184
* Makefile.am (BFD32_LIBS): Add compress.lo. (BFD32_LIBS_CFILES): Add compress.c. (BFD_H_FILES): Likewise. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * config.in: Add HAVE_ZLIB_H * configure.in: Add test for libz and zlib.h * configure: Regenerate. * dwarf2.c (read_section): New function. (read_indirect_string): Call new function read_section. (read_abbrevs): Likewise. (decode_line_info): Likewise. (read_debug_ranges): Likewise. (find_line): Call new function read_section when just one .zdebug_info section is found, otherwise read and compress multiple sections. (_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr. * elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix. (special_sections_z): New struct. (special_sections): Refer to special_sections_z. * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize sections named .zdebug_*. (_bfd_mips_elf_fake_sections): Likewise. * compress.c: New file. (bfd_uncompress_section_contents): New function. bfd/doc/ * Makefile.am (BFD_H_DEP): Add ../compress.c. * Makefile.in: Regenerate. binutils/ * config.in: Add HAVE_ZLIB_H * configure.in: Add test for libz and zlib.h * configure: Regenerate. * dwarf.c (debug_displays): Add .zdebug_* strings. * dwarf.h (struct dwarf_section): Add fields uncompressed_namd and compressed_name. * objdump.c (load_debug_section): Call bfd_uncompress_section_contents when loading a compressed section. (dump_dwarf_section): Recognize compressed section name. (mach_o_dwarf_sections): Rename as mach_o_uncompressed_dwarf_sections. (mach_o_compressed_dwarf_sections): New variable. (generic_dwarf_section): Rename as generic_uncompressed_dwarf_sections. (generic_compressed_dwarf_sections): New variable. (check_mach_o_dwarf): Save and restore mach_o_compressed_dwarf_sections. * readelf.c: Add #include for config.h and zlib.h (process_section_headers): Recognize compressed section name. (uncompress_section_contents): New function. (load_debug_section): Call uncompress_section_contents when loading a compressed section. (display_debug_section): Recognize compressed section name. binutils/testsuite: * binutils-all/objdump.exp: Add test for objdump -s on a file with a compressed debug section. Add test for objdump -W on a file that contains a compressed debug section. * binutils-all/readelf.exp: Call readelf_compressed_wa_test. (readelf_compressed_wa_test): New function. * binutils-all/dw2-compressed.S: New file. * binutils-all/objdump.W: New file. * binutils-all/objdump.s: New file. * binutils-all/readelf.wa: New file.
2008-05-21 PR 868Nick Clifton1-0/+29
* dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free memory allocated for filenames in function tables and variable tables.
2008-02-22 PR 868Nick Clifton1-82/+15
*dwarf2.c: Revert previous patch. All of the allocate memory is on an obstack which will be freed at some other time.
2008-02-20PR 868Nick Clifton1-0/+1
* libbfd.c (bfd_realloc_or_free): New function. Performs like bfd_realloc, but if the (re)allocation fails, the pointer is freed. * libbfd-in.h: Prototype. * libbfd.h: Regenerate. * bfdio.c (bfd_bwrite): Use the new function. (bfd_seek): Likewise. * bfdwin.c:(bfd_get_file_window): Likewise. * elf-strtab.c (_bfd_elf_strtab_add): Likewise. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-xtensa.c (vsprintf_msg): Likewise. * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise. * stabs.c (_bfd_link_seciton_stabs): Likewise. * vms-misc.c (_bfd_vms_get_record): Likewise. * vms-tir.c (check_section): Likewise. * vms.c (vms_new_section_hook): Likewise. * elf32-arm.c (elf32_arm_section_map_add): Check that the allocation of sec_data->map succeeded before using it. * elflink.c (elf_link_output_sym): Do not overwrite finfo-> symshndxbuf until it is known that the reallocation succeeded.
2008-02-20PR 868Nick Clifton1-15/+81
* dwarf2.c (read_abbrevs): Free the abbreviation table if we run out of memory. (decode_line_info): Free the line_info_table before returning a failure result. (_bfd_dwarf2_cleanup_debug_info): Free the abbreviation table. Free the line table. Free the function table. Free the variable table.
2008-02-16 * dwarf2.c (find_line): Don't trust debug information after anNathan Sidwell1-34/+35
unparseable compilation unit.
2008-02-12 PR 5755Alan Modra1-301/+67
* arange-set.c: Delete. * arange-set.h: Delete. * dwarf2.c: Revert 2007-09-21 changes. * Makefile.am: Likewise. * Makefile.in: Regenerate. * po/SRC-POTFILES.in: Regenerate.
2007-09-21* Makefile.am (BFD32_LIBS): Add arange-set.lo.Nick Clifton1-66/+300
(BFD32_LIBS_CFILES): Add arange-set.c. (SOURCE_HFILES): Add arange-set.h (dwarf2.lo): Add dependency upon arange-set.h. (arange-set.lo): New target. * Makefile.in: Regenerate. * arange-set.c: New file. * arange-set.h: New file. * dwarf2.c: Include arange-set.h. (struct dwarf2_debug) Add new fields comp_unit_count and comp_unit_arange_set. (struct comp_unit) Replace field arange with a new field arange_set. (dwarf2_arange_set_allocate, dwarf2_arange_set_deallocate, (dwarf2_combine_arange_value, dwarf2_arange_set_new, (dwarf2_arange_set_with_value_new, dwarf2_comp_unit_arange_add): New functions to utilize arange set in dwarf2.c. (arange_add): Formatting change for a line longer than 80 characters. (decode_line_info): Replace call target arange_add with (dwarf2_comp_unit_arange_add. (read_rangelist_insert_arange_list, (read_rangelist_comp_unit_arange_add): New functions used as callbacks for read_rangelist. (read_rangelist): Change interface to accept a callback and data to allow caller to select the action peformed on a new range list read. (scan_unit_for_symbols): Use new interface of read_rangelist. (parse_comp_unit): Create an arange set for each new comp unit. Use new interface of read_rangelist. Replace call to arange_add with that to dwarf2_comp_unit_arange_add. (comp_unit_contains_address): Replace sequential search with a call to arange_set_lookup_address, which can handles large set efficiently. (stash_copy_local_aranges, stash_maybe_enable_arange_set, (stash_find_nearest_line_fast): New functions maintaining and using a valued global arange set for all compilation units to speed up bfd_dwarf2_find_nearest_line. (find_line): Use global arange set. Replace sequential search over all compilation units with a call to stash_find_nearest_line_fast. Add book keeping to count number of compilation units. Replace empty arange list test with a call to arange_set_empty_p.
2007-09-02bfd/H.J. Lu1-3/+13
2007-09-02 H.J. Lu <hongjiu.lu@intel.com> PR ld/4986 * dwarf2.c (new_line_sorts_after): Undo the last change. (add_line_info): Only keep the last entry with the same address and end sequence. ld/testsuite/ 2007-09-02 H.J. Lu <hongjiu.lu@intel.com> PR ld/4986 * ld-ia64/line.exp: New. * ld-ia64/undefined.s: Likewise. * ld-x86-64/line.exp: Don't check CC.
2007-09-01bfd/H.J. Lu1-1/+2
2007-08-31 H.J. Lu <hongjiu.lu@intel.com> PR ld/4986 * dwarf2.c (new_line_sorts_after): Also compare line number. ld/testsuite/ 2007-08-31 H.J. Lu <hongjiu.lu@intel.com> PR ld/4986 * ld-x86-64/line.exp: New * ld-x86-64/undefined.s: Likewise.
2007-07-26Speed up bfd_dwarf2_find_line.Nick Clifton1-31/+553
* dwarf2.c (struct dwarf2_debug): Add new fields to support function and variable info hash tables. Add last_comp_unit, info_hash_count, funcinfo_hash_table, varinfo_hash_table, hash_units_head. (struct comp_unit): Add prev_unit, cached. (struct info_list_node, struct info_hash_entry, struct info_hash_table): New. (info_hash_table_newfunc, create_info_hash_table, insert_info_hash_table, lookup_info_hash_table): New functions implementing function and variable info hash tables. (scan_unit_for_symbols): Add checks to make sure hash tables are consistent with compilation units. (comp_unit_maybe_decode_line_info): New function. (comp_unit_find_line): Use comp_unit_maybe_decode_line_info. (reverse_funcinfo_list, reverse_varinfo_list, comp_unit_hash_info, info_hash_lookup_funcinfo, info_hash_lookup_varinfo, stash_maybe_update_info_hash_table, stash_verify_info_hash_table, stash_maybe_enable_info_hash_tables, stash_find_line_fast): New functions. Make use of info hash tables to speed up bfd_dwarf2_find_line. (find_line): Use hash table for faster lookup if it is turned on. Also add code to maintain bi-directional link in comp units.
2007-07-19PR binutils/4797Nick Clifton1-1/+2
* dwarf2.c: (find_line) Do not dereference functionname_ptr if do_line is true.
2007-07-03Switch sources over to use the GPL version 3Nick Clifton1-2/+3
2007-06-26* dwarf2.c (find_line): New. Contains the duplicated code from:Nick Clifton1-277/+108
(_bfd_dwarf2_find_nearest_line): Use it. (_bfd_dwarf2_find_line): Use it.
2007-06-23 * configure.in (--with-separate-debug-dir): New option.Andreas Schwab1-2/+2
* configure: Regenerate. * Makefile.am (dwarf2.lo): Add rule to pass DEBUGDIR. * Makefile.in: Regenerate. * dwarf2.c (_bfd_dwarf2_find_nearest_line): Pass DEBUGDIR to bfd_follow_gnu_debuglink. (_bfd_dwarf2_find_line): Likewise.
2007-06-22* dwarf2.c: Add support for reading in debug information via a ↵Nick Clifton1-47/+81
.gnu_debuglink section: (struct dwarf2_debug): Add bfd field to record the bfd containing the debug info. (parse_comp_unit): Remove ABFD parameter. Instead use the bfd field in the dwarf2_debug structure. (_bfd_dwarf2_find_nearest_line): If a debug info section could not be found in the current bfd call bfd_follow_gnu_debuglink to see if another file contains the debug information. If it does, open it and continue. (bfd_dwarf2_find_line): Likewise.
2007-04-26bfd/Alan Modra1-2/+2
Many files: Include sysdep.h before bfd.h. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. binutils/ * bucumm.h: Split off host dependencies to.. * sysdep.h: ..here. Many files: Include sysdep.h. Remove duplicate headers and reorder. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. ld/ Many files: Include sysdep.h first. Remove duplicate headers. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. opcodes/ * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. * ns32k-dis.c: Include sysdep.h first.
2007-02-23bfd/Carlos O'Donell1-10/+22
2007-02-23 Carlos O'Donell <carlos@codesourcery.com> * dwarf2.c (_bfd_dwarf2_find_nearest_line): Assume 32-bit DWARF even with 64-bit addresses. (_bfd_dwarf2_find_nearest_line): Likewise.
2006-09-17 * dwarf2.c (concat_filename): Apply DW_AT_comp_dir if dir tableAlan Modra1-10/+31
entry isn't absolute.
2006-09-16* bfd-in.h (STRING_AND_COMMA): New macro. Takes one constant string as itsNick Clifton1-1/+1
argument and emits the string followed by a comma and then the length of the string. (CONST_STRNEQ): New macro. Checks to see if a variable string has a constant string as its initial characters. (CONST_STRNCPY): New macro. Copies a constant string to the start of a variable string. * bfd-in2.h: Regenerate. * <remainign files>: Make use of the new macros.
2006-05-02 * archive.c (bfd_generic_archive_p): Remove unused local variableBen Elliston1-4/+0
`fail'. * dwarf2.c (decode_line_info): Remove unused local variable `basic_block'. * elfcode.h (elf_slurp_reloc_table_from_section): Remove unsed local varibale `s'. * tekhex.c (tekhex_write_object_contents): Remove unused local variable `bytes_written'. * aout-ns32k.c (MY_swap_std_reloc_out): Remove unused local variable `r_addend'. * elf32-dlx.c (dlx_rtype_to_howto): Remove breaks after returns. * elfxx-mips.c (_bfd_elf_mips_mach): Remove breaks after returns. (_bfd_ns32k_relocate_contents): Remove break after return. * elf.c (bfd_section_from_shdr): Remove breaks after returns.
2006-05-02 * dwarf2.c: Formatting.Alan Modra1-1/+1
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify output section check. * elf32-i370.c: Warning fixes inside #ifdef DEBUG. * elf32-m32c.c: Similarly. * elf32-ppc.c: Similarly. * elf32-v850.c: Similarly. * nlm32-sparc.c: Similarly. * elfcode.h: Similarly. (elf_symbol_flags): Delete. * elflink.c (elf_link_input_bfd): Comment typo.
2006-03-112006-03-11 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-2/+4
PR ld/2443 * dwarf2.c (concat_filename): Don't issue an error if file is 0.
2006-03-06 * dwarf2.c: Formatting.Alan Modra1-80/+69
(add_line_info): Remove outer loop.
2006-03-062006-03-05 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-68/+193
Alan Modra <amodra@bigpond.net.au> PR binutils/2338 * dwarf2.c (loadable_section): New struct. (dwarf2_debug): Add loadable_section_count and loadable_sections. (new_line_sorts_after): New. (add_line_info): Use new_line_sorts_after to compare line addresses. (check_function_name): Removed. (unset_sections): New. (place_sections): New. (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections and unset_sections on relocatable files. (_bfd_dwarf2_find_line): Likewise.
2006-02-152006-02-15 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-2/+34
PR binutils/2338 * dwarf2.c (check_function_name): New function. (_bfd_dwarf2_find_nearest_line): Use check_function_name to check if function is correct.
2006-01-172006-01-17 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-29/+22
PR binutils/2096 * dwarf2.c (comp_unit_contains_address): Update comment. (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of lma. Return TRUE only if both comp_unit_contains_address and comp_unit_find_nearest_line return TRUE. (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
2005-12-27(lookup_symbol_in_function_table): Check for a function name before passingNick Clifton1-0/+1
it to strcmp.
2005-09-22Fix addr2line -i problem; reports incorrect function nesting for inline funcs.Jim Wilson1-23/+44
* dwarf2.c (struct funcinfo): Delete nesting_level field. (lookup_address_in_function_table): Delete code to set funcinfo caller_func field. Delete local curr_func. (scan_unit_for_symbols): New locals nested_funcs, nested_funcs_size. Delete code setting funcinfo nesting_level field. Add code to set funcinfo caller_func field.
2005-09-20Add mangled names to addr2line -i output.Jim Wilson1-2/+7
* dwarf2.c (find_abstract_instance_name): Don't early exit when name set. For DW_AT_name case, only set name if not already set. Handle DW_AT_MIPS_linkage_name.
2005-08-17bfd/H.J. Lu1-4/+4
2005-08-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/1179 * dwarf2.c (_bfd_dwarf2_find_nearest_line): Use section lma instead of vma. (_bfd_dwarf2_find_line): Likewise. binutils/ 2005-08-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/1179 * objdump.c (disassemble_bytes): Don't adjust adjust_section_vma. (adjust_addresses): Don't adjust vma for debugging section. Adjust lma only for relocatable files. (dump_bfd): Tell adjust_addresses if it is a relocatable file.
2005-08-10Fix linker error found when compiling glibc with a mismatched gcc.Jim Wilson1-3/+11
* dwarf2.c (scan_unit_for_symbols, case DT_AT_location): Verify that DW_OP_addr is only opcode in location before using it.
2005-08-07Reviewed and approved by Nick Clifton <nickc@redhat.com>Fred Fish1-1/+1
2005-08-05 Fred Fish <fnf@specifix.com> * dwarf2.c (read_rangelist): Use addr_size instead of offset_size to determine how many bytes to read from each rangelist entry.
2005-07-082005-07-08 Paul Koning <pkoning@equallogic.com>Paul Koning1-9/+28
* dwarf2.c (read_address): Check sign_extend_vma to handle targets where addresses are sign extended.
2005-07-062005-07-06 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-13/+21
* dwarf2.c (varinfo): Add addr. (lookup_symbol_in_variable_table): Also check addr. (scan_unit_for_symbols): Set addr for variable. (comp_unit_find_line): Updated.
2005-06-10 * dwarf2.c (decode_line_info): Revert last change. Instead setAlan Modra1-17/+7
initial low_pc to -1 to avoid need to test whether loc_pc has been set.
2005-06-092005-06-09 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-0/+5
PR 1000 * dwarf2.c (lookup_address_in_line_info_table): Restore code handling NULL function info, removed with 2005-04-03 change.