aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.h
AgeCommit message (Collapse)AuthorFilesLines
2017-09-22LVU: dump loclists with locviewsAlexandre Oliva1-0/+3
When dumping location lists, also dump locview lists that may be interspersed with them, and bring view pairs next to the corresponding location list entries. This patch supports DW_AT_GNU_locviews as a separate attribute for DWARF4- loc_lists and split (dwo) loclists, as well as DWARF5 loclists. It also supports, in DWARF5 loclists, the proposed DW_LLE_GNU_view_pair loclist entry type proposed for DWARF6. The tests use 32-bit DWARF, even on 64-bit targets, resolving offsets to constants so as to reduce the risk that relocations be created for them, or that the offsets be rejected as nonconstants. The patch also adds an xfail to an unrelated test, namely dw5, so that no unexpected fails remain on nds32*-elf, one of the tested targets. Reviewed-by: Alan Modra <amodra@gmail.com> for include/ChangeLog * dwarf2.def (DW_AT_GNU_locviews): New. * dwarf2.h (enum dwarf_location_list_entry_type): Add DW_LLE_GNU_view_pair. (DW_LLE_view_pair): Define. for binutils/ChangeLog * dwarf.h (debug_info): Add loc_views and num_loc_views. * dwarf.c (vm1): New constant. (print_dwarf_view): New function. (read_and_display_attr_value): Support DW_AT_GNU_locviews. (process_debug_info): Keep num_loc_offsets and num_loc_views in sync. (display_view_pair_list): New function. (display_loc_list_dwo): Take vstart_ptr; update it. Dump location view pairs before the range they apply to, when a viewlist augments the loc list. (display_loc_list): Likewise. Check view numbers in range tests. (display_loclists_list): Likewise. Handle view pair entries, and warn on trailing ones. (loc_views): New variable. (loc_offsets_compar): Compare loc_views if loc_offsets are the same. (display_debug_loc): Check and sort loc_views too. Accept loc_view as expected_start. Skip if lists and views are the same. Dump locview list separately in order, and pass the locview list base to each list dump function. Warn and skip overlap and hole checking if we find loclists and locviews to not be adjacent. * testsuite/binutils-all/locview-1.s: New. * testsuite/binutils-all/readelf.locview-1: New. * testsuite/binutils-all/locview-2.s: New. * testsuite/binutils-all/readelf.locview-2: New. * testsuite/binutils-all/readelf.exp: Run new tests. Fix option spelling in pr18374 fail message. XFAIL dw5 test on nds32*-elf.
2017-07-02DWARF-5: readelf: .debug_namesJan Kratochvil1-0/+1
Display DWARF-5 .debug_names (standardized .gdb_index). binutils/ChangeLog 2017-07-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c: Include assert.h. (MAX, MIN, get_IDX_name, display_debug_names): New. (debug_displays): Add .debug_names. * dwarf.h: (enum dwarf_section_display_enum): Add debug_names. * readelf.c (process_section_headers): Add ".debug_names".
2017-03-02Fix dwarf_section_display_enum regression by DWARF-5Jan Kratochvil1-0/+2
binutils/ 2017-03-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.h (enum dwarf_section_display_enum): Add loclists and rnglists.
2017-02-23DWARF-5 basic functionalityJan Kratochvil1-0/+5
binutils/ 2017-02-23 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (fetch_indirect_line_string): New function. (abbrev_attr): New field implicit_const. (add_abbrev_attr): New parameter implicit_const. (process_abbrev_section): Support DW_FORM_implicit_const. (decode_location_expression): Support DW_OP_entry_value. (read_and_display_attr_value): Add parameter implicit_const. Support DW_FORM_line_strp and DW_FORM_implicit_const. (read_and_display_attr): Add parameter implicit_const. (process_debug_info): Support line_str and DWARF-5. (read_debug_line_header): Support DWARF-5. (display_formatted_table): New function. (display_debug_lines_raw): New parameter file. Support DWARF-5. (display_debug_lines_decoded): New parameter fileptr. Support DWARF-5. (display_debug_lines): Pass file parameter. (display_debug_macro): Update read_and_display_attr_value caller. (display_debug_abbrev): Support DW_FORM_implicit_const. (display_loclists_list): New function. (display_loc_list): Support .debug_loclists. (display_debug_ranges_list): New function from display_debug_ranges. (display_debug_rnglists_list): New function. (display_debug_ranges): Support .debug_rnglists. (debug_displays): Add .debug_line_str, .debug_loclists and .debug_rnglists. * dwarf.h: Include dwarf2.h (DWARF2_Internal_LineInfo): Add li_offset_size. (DWARF2_Internal_CompUnit): Add cu_unit_type. (enum dwarf_section_display_enum): Add line_str. * readelf.c (process_section_headers): Add rnglists and loclists.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-11-27Fix spelling in comments in C source files (binutils)Ambrogino Modigliani1-1/+1
* dwarf.c: Fix spelling in comments. * dwarf.h: Fix spelling in comments. * objcopy.c: Fix spelling in comments. * od-macho.c: Fix spelling in comments. * rclex.c: Fix spelling in comments. * readelf.c: Fix spelling in comments. * stabs.c: Fix spelling in comments.
2016-04-13Add init_dwarf_regnames_s390Andreas Arnez1-0/+1
Define and use DWARF register names for s390. binutils/ChangeLog: * dwarf.h (init_dwarf_regnames_s390): Declare. * dwarf.c (dwarf_regnames_s390): New. (init_dwarf_regnames_s390): New. (init_dwarf_regnames): Call it. * objdump.c (dump_dwarf): Likewise.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-05-15Fix PR18374 by making readelf and objdump ignore end-of-list markers in the ↵Nick Clifton1-1/+11
.debug_loc section if there are relocations against them. PR binutils/18374 bin * dwarf.h (struct dwarf_section): Add reloc_info and num_relocs fields. (struct dwarf_section_display): Change bitfield to boolean. (reloc_at): Add prototype. * dwarf.c (display_loc_list): Ignore list terminators if there are relocs against them. (display_debug_loc): Issue a warning if there are relocs against the .debug_loc section. (display_displays): Initialise reloc_info and num_relocs fields. * objdump.c (load_specific_debug_section): Initialise reloc_info and num_relocs fields. (reloc_at): New function. * readelf.c (is_32bit_abs_reloc): Add IA64's R_IA64_DIS32LSB reloc. (reloc_at): New function. (apply_relocations): Add relocs_return and num_relocs_return parameters. Fill them in with the loaded relocs if non-NULL. (dump_section_as_bytes): Update call to apply_relocations. (load_specific_debug_section): Initialise reloc_info and num_relocs fields. tests * binutils-all/pr18374.s: New test file. * binutils-all/readelf.exp: Assemble and run the new test. * binutils-all/readelf.pr18374: Expected output from readelf.
2015-05-11Add init_dwarf_regnames_iamcuH.J. Lu1-0/+1
* dwarf.c (dwarf_regnames_iamcu): New. (init_dwarf_regnames_iamcu): Likewise. (init_dwarf_regnames): Call init_dwarf_regnames_iamcu for EM_IAMCU. * dwarf.h (init_dwarf_regnames_iamcu): New. * objdump.c (dump_dwarf): Call init_dwarf_regnames_iamcu for bfd_arch_iamcu.
2015-02-10Fix memory access violations triggered by running objdump compiled with ↵Nick Clifton1-43/+3
out-of-bounds sanitization checking. PR binutils/17512 * dwarf.c (eh_addr_size): Use an unsigned type. (size_of_encoded_value): Return an unsigned type. (read_leb128): Break if the shift becomes too big. (process_extended_line_op): Do not read the address if the length is too long. (read_cie): Warn and fail if the pointer size or segment size are too big. * dwarf.h (DWARF2_External_LineInfo): Delete unused and incorrect structure definition. (DWARF2_External_PubNames): Likewise. (DWARF2_External_CompUnit): Likewise. (DWARF2_External_ARange): Likewise. (DWARF2_Internal_LineInfo): Use dwarf_vma type for li_prologue_length. (eh_addr_size): Update prototype. * coffcode.h (styp_to_sec_flags): Use an unsigned long type to hold the flag bits. * peXXigen.c (pe_print_reloc): Use unsigned types to hold the size and number of relocs. (pe_print_debugdata): Use a 32-bit aligned buffer to store the codeview record. * versados.c (process_otr): Check the esdid value before using it to access the EDATA.
2015-01-12More fixes for memory access errors when running readelf on fuzzed binaries.Nick Clifton1-0/+1
PR binutils/17531 * dwarf.c (process_debug_info): Check for abbrev_base being larger than the section size. (process_cu_tu_index): Use xcalloc2 to allocate the CU and TU arrays. (xcalloc2): New function. Like xcalloc, but checks for overflow. * dwarf.h (xcalloc2): Prototype.
2015-01-05More fixes for invalid memory accesses triggered by fuzzed binaries.Nick Clifton1-4/+4
PR binutils/17531 * dwarf.c (alloc_num_debug_info_entries): New variable. (process_debug_info): Set it. Use it to avoid displaying attributes for which there is no info. (display_debug_abbrev): Check that the debug_info_entry index is valid before using it. (display_loc_list_dwo): Likewise. (process_cu_tu_index): Add range check for an overlarge dw_sect value. (free_debug_memory): Reset alloc_num_debug_info_entries. * readelf.c (slurp_ia64_unwind_table): Warn if the reloc could not be indentified. (dynamic_section_mips_val): Warn if the timestamp is invalid. (print_mips_got_entry): Add a data_end parameter. Warn if a read would go beyond the end of the data, and return an error value. (process_mips_specific): Do not read options from beyond the end of the section. Correct code to display optional data at the end of an option. Warn if there are too many GOT symbols. Update calls to print_mips_got_entry, and handle error returns.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-12-01More fixes for memory access violations exposed by fuzzed binaries.Nick Clifton1-0/+2
PR binutils/17512 * dwarf.h (struct dwarf_section): Add user_data field. * dwarf.c (frame_need_space): Check for an over large register number. (display_debug_frames): Check the return value from frame_need_space. Check for a CFA expression that is so long the start address wraps around. (debug_displays): Initialise the user_data field. * objdump.c (load_specific_debug_section): Save the BFD section pointer in the user_data field of the dwarf_section structure. (free_debug_section): Update BFD section data when freeing section contents. * readelf.c (load_specific_debug_section): Initialise the user_data field. * archive.c (do_slurp_coff_armap): Add range checks to prevent running off the end of the string table. * compress.c (bfd_get_full_section_contents): Return a NULL pointer for zero sized sections. Do not attempt to copy a buffer onto itself. * elf-attrs.c (_bfd_elf_parse_attributes): Check for an empty header. Add range checks to avoid running off the end of the section. * elf.c (bfd_elf_get_str_section): Seek before allocating so that if the seek fails, no memory is allocated. (bfd_elf_string_from_elf_section): Do not allocate a string from a non string section. It only leads to trouble later on. (_bfd_elf_print_private_bfd_data): Check for there being too little external dynamic data. (bfd_section_from_shdr): Replace assertion with a failure mode. (bfd_section_from_shdr): When walking a loaded group section use the internal structure size, not the external size. Check for the group section being empty. * elf32-i386.c (elf_i386_rtype_to_howto): Replace assertion with a failure mode. * elfcode.h (elf_slurp_reloc_table): Likewise. * reloc.c (bfd_perform_relocation): Avoid seg-fault if the howto parameter is NULL.
2014-08-22aarch64: Decode dwarf2 register numbersRichard Henderson1-0/+1
* dwarf.h (init_dwarf_regnames_aarch64): Declare. * dwarf.c (dwarf_regnames_aarch64): New. (init_dwarf_regnames_aarch64): New. (init_dwarf_regnames): Call it. * objdump.c (dump_dwarf): Likewise.
2014-03-05Update copyright yearsAlan Modra1-1/+1
2013-11-07 Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.Doug Evans1-0/+4
* dwarf.c (get_gdb_index_symbol_kind_name): New function. (display_debug_pubnames_worker): Renamed from display_debug_pubnames. Add support for .debug_gnu_pubnames, .debug_gnu_pubtypes. (display_debug_pubnames, display_debug_pubnames_gnu): New functions. (display_gdb_index): Redo printing of symbol kind. (debug_displays): Add .debug_gnu_pubnames, .debug_gnu_pubtypes. * dwarf.h (dwarf_section_display_enum): Add gnu_pubnames, gnu_pubtypes. * readelf.c (process_section_headers): Add gnu_pubnames, gnu_pubtypes.
2013-03-25 PR binutils/15202Nick Clifton1-3/+2
* dwarf.c (read_leb128): Add END parameter. Do not read at or beyond end. (read_sleb128): Add END parameter. (read_uleb128): New function. (process_extended_line_op): Pass END to leb128 functions. (process_abbrev_section): Likewise. (decode_location_expression): Likewise. (read_and_display_attr_value): Likewise. (read_and_display_attr): Likewise. (process_debug_info): Likewise. (display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. (display_debug_macinfo): Likewise. (get_line_filename_and_dirname): Likewise. (display_debug_macro): Likewise. (display_loc_list_dwo): Likewise. (display_debug_ranges): Likewise. * dwarf.h (read_leb128): Update prototype. * readelf.c (read_uleb128): Add END parameter. (decode_arm_unwind_bytecode): Pass END to read_uleb128. (decode_tic6x_unwind_bytecode): Likewise. (display_tag_value): New function. (display_arm_attribute): Add END parameter. Pass END to read_uleb128. Use display_tag_value. (display_gnu_attribute): Likewise. (display_power_gnu_attribute): Likewise. (display_sparc_gnu_attribute): Likewise. (display_mips_gnu_attribute): Likewise. (display_tic6x_attribute): Likewise. (process_attributes): Likewise. (display_raw_attribute): New function.
2012-10-24binutils/Cary Coutant1-0/+6
* dwarf.c (do_debug_addr, do_debug_cu_index): New global flags. (load_debug_info): Fix typo. (cu_tu_indexes_read, shndx_pool, shndx_pool_size, shndx_pool_used): New global variables. (prealloc_cu_tu_list, add_shndx_to_cu_tu_entry, end_cu_tu_entry) (process_cu_tu_index, load_cu_tu_indexes, find_cu_tu_set) (display_cu_index): New functions. (dwarf_select_sections_by_names): Add "debug_addr", "cu_index". Sort entries alphabetically. (dwarf_select_sections_all): Set do_debug_addr, do_debug_cu_index. (debug_displays): Add .debug_cu_index, .debug_tu_index. Clean up formatting. * dwarf.h (dwarf_section_display_enum): Add dwp_cu_index, dwp_tu_index. (do_debug_addr, do_debug_cu_index): New global flags. (find_cu_tu_set): New function declaration. * objdump.c (usage): Add --dwarf=addr, --dwarf=cu_index. * readelf.c (find_section_in_set): New function. (usage): Add --debug-dump=addr, --debug_dump=cu_index. (process_section_headers): Check do_debug_addr and do_debug_cu_index. (section_subset): New global variable. (load_debug_section): Restrict search to section subset. (display_debug_section): Add section index as paramter. Select subset of sections when dumping a .dwp file. Update caller.
2012-05-11 * doc/binutils.texi: Add --dwarf-check option.Cary Coutant1-24/+44
* dwarf.c (dwarf_check): New global flag. (fetch_indexed_string): New function. (fetch_indexed_value): New function. (get_FORM_name): Add DW_FORM_GNU_str_index and DW_FORM_GNU_addr_index. (decode_location_expression): Add DW_OP_GNU_addr_index. (read_and_display_attr_value): Add DW_FORM_GNU_str_index, DW_FORM_GNU_addr_index, DW_AT_GNU_addr_base, and DW_AT_GNU_ranges_base. (get_AT_name): Add new attributes for Fission. (process_debug_info): Load new debug sections for Fission. (load_debug_info): Check for .debug_info.dwo section. (display_loc_list, display_loc_list_dwo): New functions. (display_debug_loc): Move logic to above two functions. (display_debug_info): Choose abbrev section based on info section. (display_debug_types): Likewise. (display_trace_info): Likewise. (comp_addr_base): New function. (display_debug_addr): New function. (display_debug_str_offsets): New function. (display_debug_ranges): Allow missing range lists. Suppress diagnostics if dwarf_check not set. (debug_displays): Add column to select abbrev section. * dwarf.h (enum dwarf_section_display_enum): Add new debug sections for Fission. (struct dwarf_section): Add abbrev_sec field. (struct dwarf_section_display): New type. (debug_info): Add addr_base, ranges_base fields. (dwarf_check): New global variable. * objdump.c (usage): Add --dwarf-check option. (enum option_values): Add OPTION_DWARF_CHECK. (long_options): Add --dwarf-check. (main): Likewise. * readelf.c (OPTION_DWARF_CHECK): New macro. (options): Add --dwarf-check. (parse_args): Likewise. (process_section_headers): Use const_strneq instead of streq.
2011-09-30 * binutils/dwarf.h (dwarf_section_display_enum): Add missing enumCary Coutant1-0/+1
constant.
2011-07-26 * dwarf2.c (dwarf_debug_sections): Add .debug_macroJakub Jelinek1-0/+1
and .zdebug_macro entry. (dwarf_debug_section_enum): Add debug_macro. * NEWS: Mention .debug_macro support. * dwarf.c (read_and_display_attr_value): Don't print a tab if attribute is 0. (get_AT_name): Handle DW_AT_GNU_macros. (get_line_filename_and_dirname, display_debug_macro): New functions. (debug_displays): Add an entry for .debug_macro and .zdebug_macro. * readelf.c (process_section_headers): With do_debug_macinfo handle also .debug_macro sections. * dwarf.h (dwarf_section_display_enum): Add macro.
2011-04-28 * NEWS: Add note about --dwarf-depth, --dwarf-start, andTom Tromey1-0/+3
dwarf-mode.el. * objdump.c (suppress_bfd_header): New global. (usage): Update. (OPTION_DWARF_DEPTH, OPTION_DWARF_START): New constants. (options): Add dwarf-depth and dwarf-start entries. (dump_bfd): Use suppress_bfd_header. (main): Handle OPTION_DWARF_START, OPTION_DWARF_DEPTH. * doc/binutils.texi (objcopy): Document --dwarf-depth and --dwarf-start. (readelf): Likewise. * dwarf-mode.el: New file. * dwarf.c (dwarf_cutoff_level, dwarf_start_die): New globals. (read_and_display_attr_value): Also check debug_info_p. (process_debug_info): Handle dwarf_start_die and dwarf_cutoff_level. * dwarf.h (dwarf_cutoff_level, dwarf_start_die): Declare. * readelf.c (usage): Update. (OPTION_DWARF_DEPTH): New macro. (OPTION_DWARF_START): Likewise. (options): Add dwarf-depth and dwarf-start entries. (parse_args): Handle OPTION_DWARF_START and OPTION_DWARF_DEPTH. testsuite * binutils-all/objdump.W: Correct output.
2011-03-25 Replace bfd_vma type and analog types by dwarf_vma and analogs.Nick Clifton1-23/+22
Use dwarf specific print functions to display these type values. * dwarf.h (dwarf_signed_vma): New type; (DWARF2_External_LineInfo): Replace bfd_vma by dwarf_vma. (DWARF2_External_PubNames): Likewise. (DWARF2_External_CompUnit): Likewise. (DWARF2_External_ARange): Likewise. (read_leb128): Change return type to dwarf_vma. * dwarf.c (print_dwarf_vma): Use __MINGW32__ conditional and check byte_size values. (dwarf_vmatoa): Change parameter type to dwarf_vma. (dwarf_svmatoa): New static function. (read_leb128): Change return type to dwarf_vma. (read_sleb128): New static function. (struct State_Machine_Registers): Change address field type to dwarf_vma. (process_extended_line_op): Adapt to type changes. (fetch_indirect_string): Likewise. (idisplay_block): Likewise. (decode_location_expression): Likewise. (read_and_display_attr_value): Likewise. (process_debug_info): Likewise. (display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. (SLEB macro): Use new read_sleb128 function.
2011-02-23ChangeLog include/Kai Tietz1-6/+92
2011-02-23 Kai Tietz <kai.tietz@onevision.com> * dwarf2.h (_ELF_DWARF2_H): Renamed to _DWARF2_H. (DWARF2_External_LineInfo, DWARF2_Internal_LineInfo, DWARF2_External_PubNames, DWARF2_Internal_PubNames, DWARF2_External_CompUnit, DWARF2_Internal_CompUnit, DWARF2_External_ARange, DWARF2_Internal_ARange): Removed. ChangeLog binutils/ 2011-02-23 Kai Tietz <kai.tietz@onevision.com> * dwarf.c (read_leb128): Use bfd_vma instead of long type. (dwarf_vmatoa): New helper routine. (process_extended_line_op): Use for adr bfd_vma type and print those typed values via BFD_VMA_FMT or via dwarf_vmatoa for localized prints. (fetch_indirect_string): Adjust offset's type. (decode_location_expression): Adjust argument types and uvalue type. (read_and_display_attr_value): Likewise. (read_and_display_attr): Likewise. (decode_location_expression): Adjust printf format. (process_debug_info): Likewise. (display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. (display_debug_pubnames): Likewise. (display_debug_loc): Likewise. (display_debug_aranges): Likewise. * dwarf.h (DWARF2_External_LineInfo, DWARF2_Internal_LineInfo, DWARF2_External_PubNames, DWARF2_Internal_PubNames, DWARF2_External_CompUnit, DWARF2_Internal_CompUnit, DWARF2_External_ARange, DWARF2_Internal_ARange): Added.. (read_leb128): Adjust return type.
2010-12-03 * dwarf.c: #include "bfd_stdint.h".Doug Evans1-0/+1
(do_gdb_index): New global. (display_gdb_index): New function. (dwarf_select_sections_by_names) Add "gdb_index". (dwarf_select_sections_all): Set do_gdb_index. (debug_displays): Add .gdb_index. * dwarf.h (do_gdb_index): Declare. * objdump.c (usage): Add gdb_index. * readelf.c (usage): Add gdb_index. (process_section_headers): Process ".gdb_index". * doc/binutils.texi (readelf): Document gdb_index dump. (objdump): Ditto.
2010-11-21Add and use elfcomm.c/elfcomm.h.H.J. Lu1-17/+2
2010-11-21 H.J. Lu <hongjiu.lu@intel.com> PR binutils/12235 * elfcomm.c: New. * elfcomm.h: Likewise. * Makefile.am (HFILES): Add elfcomm.h. (CFILES): Add elfcomm.c. (ELFLIBS): New. (readelf_SOURCES): Add $(ELFLIBS). (elfedit_SOURCES): Likewise. (objdump_SOURCES): Likewise. * Makefile.in: Regenerated. * dwarf.c: Include "elfcomm.h". (byte_get): Removed. (byte_get_little_endian): Likewise. (byte_get_big_endian): Likewise. (byte_get_signed): Likewise. (error): Likewise. (warn): Likewise. * dwarf.h (dwarf_vma): Defined with HOST_WIDEST_INT. (dwarf_size_type): Likewise. (byte_get): Removed. (byte_get_signed): Likewise. (byte_get_little_endian): Likewise. (byte_get_big_endian): Likewise. (error): Likewise. (warn): Likewise. * elfedit.c: Include "elfcomm.h". Don't include "aout/ar.h". Call error () instead of non_fatal (). (streq): Removed. (strneq): Likewise. (const_strneq): Likewise. (non_fatal): Likewise. (BYTE_GET): Likewise. (BYTE_PUT): Likewise. (byte_get): Likewise. (byte_put): Likewise. (byte_get_little_endian): Likewise. (byte_get_big_endian): Likewise. (byte_put_little_endian): Likewise. (byte_put_big_endian): Likewise. (adjust_relative_path): Likewise. (archive_info): Likewise. (setup_archive): Likewise. (release_archive): Likewise. (setup_nested_archive): Likewise. (get_archive_member_name): Likewise. (get_archive_member_name_at): Likewise. (make_qualified_name): Likewise. * objdump.c: Include "elfcomm.h". * readelf.c: Include "elfcomm.h". Don't include "aout/ar.h". (BYTE_GET): Removed. (BYTE_GET_SIGNED): Removed. (streq): Likewise. (strneq): Likewise. (const_strneq): Likewise. (byte_put): Likewise. (byte_put_little_endian): Likewise. (byte_put_big_endian): Likewise. (adjust_relative_path): Likewise. (archive_info): Likewise. (setup_archive): Likewise. (release_archive): Likewise. (setup_nested_archive): Likewise. (get_archive_member_name): Likewise. (get_archive_member_name_at): Likewise. (make_qualified_name): Likewise.
2010-10-09Use BYTE_GET_SIGNED on r_addend.H.J. Lu1-0/+1
2010-10-08 H.J. Lu <hongjiu.lu@intel.com> * dwarf.c (byte_get_signed): Make it extern. * dwarf.h (byte_get_signed): New. * readelf.c (BYTE_GET_SIGNED): New. (slurp_rela_relocs): Use BYTE_GET_SIGNED on r_addend. (dump_relocations): Properly dump r_addend.
2010-09-09 * dwarf.h (debug_info): Add offset_info and dwarf_version fields.Jakub Jelinek1-1/+3
* dwarf.c (decode_location_expression): Add offset_size and dwarf_version arguments. Prefix DIE offset with 0x for DW_OP_call{2,4,_ref}. Fix up DW_OP_call_ref operand size, complain if in frame info section. Handle DW_OP_GNU_implicit_pointer. (read_and_display_attr_value, display_debug_loc, display_debug_frames): Adjust decode_location_expression callers. (process_debug_info): Save offset_size and dwarf_version values into debug_information array. * dwarf2.h (DW_OP_GNU_implicit_pointer): New.
2010-09-02 * dwarf.c (init_dwarf_regnames_i386, init_dwarf_regnames_x86_64): New.Richard Henderson1-0/+2
(init_dwarf_regnames): Use them. * dwarf.h: Declare them. * objdump.c (dump_dwarf): Use bfd_get_arch + bfd_get_mach to set up the regnames, rather than using elf_machine_code.
2010-05-242010-05-24 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-0/+6
* readelf.c (usage): Add new trace sections for --debug-dump. (process_section_headers): Handle dump of trace sections. * objdump.c (usage): Add new trace sections for --dwarf. * dwarf.h (do_trace_info, do_trace_abbrevs): New variables. (do_trace_aranges): Ditto. (enum dwarf_section_display_enum): Add trace_info, trace_abbrev and trace_aranges literals. * dwarf.c (do_trace_info, do_trace_abbrevs): New variables. (do_trace_aranges): Ditto. (process_debug_info): Add abbrev_sec argument and replace abbrev with abbrev_sec. (load_debug_info): Adjust call of process_debug_info. (display_debug_info): Ditto. (display_trace_info): New function. (dwarf_select_sections_by_names): Add trace_info, trace_abbrevs and trace_aranges sections name. (dwarf_select_sections_all): Also select trace sections. (debug_displays): Reindent. Add entries for the trace sections. * doc/binutils.texi (readelf): Document new --dwarf parameters. (objdump): Ditto.
2010-03-02 * NEWS: Document .ARM.exidx / .ARM.extab support.Daniel Jacobowitz1-0/+3
* dwarf.c (read_leb128): Make non-static. * dwarf.h (read_leb128): Declare. * readelf.c (REMOVE_ARCH_BITS): Define. (find_section_by_address): New. (read_uleb128): Move higher. Use read_leb128 from dwarf.c. (find_symbol_for_address): Handle the Thumb bit for ARM, by using REMOVE_ARCH_BITS. (struct arm_section, struct arm_unw_aux_info, arm_print_vma_and_name) (arm_free_section, arm_section_get_word, decode_arm_unwind) (dump_arm_unwind, arm_process_unwind): New. (process_unwind): Handle ARM.
2009-12-03 PR binutils/11045Nick Clifton1-0/+1
* dwarf.c (do_debug_pubtypes): New variable. (dwarf_select_sections_by_names): Handle .debug_pubtypes. (dwarf_select_sections_by_letters): Add 't' for .debug_pubtype. (dwarf_select_sections_all): Set do_debug_pubtypes. (debug_displays): Add support for .debug_pubtypes. * dwarf.h (do_debug_pubtypes): Export. * objdump.c (usage): Add -wt or --dwarf=pubtypes. * readelf.c (usage): Likewise. (process_section_headers): Enable debug display if do_debug_pubtypes is set. * doc/binutils.texi: Document -wt/--dwarf=pubtypes option.
2009-09-25 PR 10656Nick Clifton1-6/+8
* readelf.c: Remove duplicate declaration of variable do_wide. * dwarf.h: Add export of do_wide. * hist.h: Move declaration of histograms and num_histograms variables from here to... * hist.c: ...here.
2009-09-02update copyright datesAlan Modra1-1/+1
2009-07-14binutils/Jan Kratochvil1-0/+1
Support unordered .debug_info references to .debug_ranges. * dwarf.c (struct range_entry, range_entry_compar): New. (display_debug_ranges): Remove variables last_offset, first, j, seen_first_offset, use_debug_info and next. New variables range_entries and range_entry_fill. Create the sorted copy range_entries. Remove the FIXME error on detected unordered references. * dwarf.h (debug_info <range_lists>): New comment. binutils/testsuite/ * binutils-all/objcopy.exp (testranges): New test. * binutils-all/testranges.d, binutils-all/testranges.s: New files.
2009-07-062009-07-06 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-1/+0
* objdump.c (dump_dwarf_section): Handle .eh_frame like other dwarf sections. * dwarf.h (struct dwarf_section_display): Remove eh_frame field. * dwarf.c (debug_displays): Adjust for removed field.
2009-02-092009-02-09 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-2/+6
* NEWS: Mention feature match between objdump and readelf for dumping dwarf info. * doc/binutils.texi (objdump): Document -W/--dwarf improvments to objdump. * objdump.c (usage): Update documentation for -W/--dwarf. (enum option_values): Add OPTION_DWARF. (long_options): --dwarf can accept arguments. (dump_dwarf_section): Also check enabled field. (main): Option -W can accept arguments, code moved to dwarf.c and call dwarf_select_sections_all instead. * readelf.c (process_section_headers): Remove do_debug_lines_decoded. (parse_args): Move code to... * dwarf.c (dwarf_select_sections_by_letters, dwarf_select_sections_by_names): : ...here (new functions). (do_debug_lines_decoded): Remove and replaced by ... (FLAG_DEBUG_LINES_RAW, FLAG_DEBUG_LINES_DECODED): ... new macros. (display_debug_lines): Adjust for previous change. (dwarf_select_sections_all): New function. (debug_displays): Add initializer for enabled field. * dwarf.h (do_debug_lines_decoded): Remove. Add prototypes for the new functions. (struct dwarf_section_display): Add enabled field.
2008-07-10bfd/Craig Silverstein1-2/+8
* 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-04-11 * dwarf.c (display_debug_lines): Rename toNick Clifton1-1/+2
display_debug_lines_raw. (display_debug_lines_decoded): New function. Displays the interpreted contents of a .debug_line section. (display_debug_lines): New function: Selects either a raw dump or a decoded dump (or both) as requested by the user. * dwarf.h (do_debug_lines_decoded): New extern. * readelf.c: Add support for -wL or --debug-dump=decodedline option to display the decoded contents of a .debug_line section. * doc/binutils.texi: Document the new option. * NEWS: Mention the new feature.
2008-01-28binutils/H.J. Lu1-1/+3
2008-01-28 H.J. Lu <hongjiu.lu@intel.com> * dwarf.c: Include "elf/common.h". (eh_addr_size): Changed to int. (dwarf_regnames_i386): New. (dwarf_regnames_x86_64): Likewise. (dwarf_regnames): Likewise. (dwarf_regnames_count): Likewise. (init_dwarf_regnames): Likewise. (regname): Likewise. (frame_display_row): Properly support different address size. Call regname to get register name. (display_debug_frames): Call regname to get register name. Display DW_CFA_def_cfa_register as DW_CFA_def_cfa_register instead of DW_CFA_def_cfa_reg. * dwarf.h (init_dwarf_regnames): New. * objdump.c: Include "elf-bfd.h". (dump_dwarf): Call init_dwarf_regnames on ELF input. * readelf.c (guess_is_rela): Change argument to int. (parse_args): Remove the undocumented upper case options for -wX. (process_file_header): Call init_dwarf_regnames if do_dwarf_register is true. gas/testsuite/ 2008-01-28 H.J. Lu <hongjiu.lu@intel.com> * gas/cfi/cfi-alpha-1.d: Replace DW_CFA_def_cfa_reg with DW_CFA_def_cfa_register. * gas/cfi/cfi-alpha-3.d: Likewise. * gas/cfi/cfi-hppa-1.d: Likewise. * gas/cfi/cfi-i386.d: Likewise. * gas/cfi/cfi-m68k.d: Likewise. * gas/cfi/cfi-mips-1.d: Likewise. * gas/cfi/cfi-sh-1.d: Likewise. * gas/cfi/cfi-sparc-1.d: Likewise. * gas/cfi/cfi-sparc64-1.d: Likewise. * gas/cfi/cfi-x86_64.d: Likewise. * gas/cfi/cfi-common-1.d: Updated for i386/x86-64 register names. * gas/cfi/cfi-common-2.d: Likewise. * gas/cfi/cfi-common-5.d: Likewise. * gas/cfi/cfi-i386.d: Likewise. * gas/cfi/cfi-x86_64.d: Likewise. ld/testsuite/ 2008-01-28 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/eh1.d: Replace DW_CFA_def_cfa_reg with DW_CFA_def_cfa_register. Updated for i386/x86-64 register names. * ld-elf/eh2.d: Likewise. * ld-elf/eh3.d: Likewise. * ld-elf/eh4.d: Likewise. * ld-elf/eh5.d: Likewise.
2007-10-31* dwarf.c (is_relocatable): Remove definition.Nick Clifton1-1/+0
(display_debug_frames): Remove check in is_relocatable. * dwarf.h (is_relocatable): Remove declaration. * objdump.c (is_relocatable): New static definition. * readelf.c (dump_relocations): Make the function void. (is_32bit_abs_reloc): Add support for x86, Arc, Arm, D10V, Dlx, OR32 and Score. (is_32bit_pcrel_reloc): Add support for x86 and Arm. (is_16bit_abs_reloc): Add support for D10V. (debug_apply_rela_addends): Rename to debug_apply_relocations. Add code to support rel relocations. (load_debug_section): Fix call to debug_apply_relocations. (get_file_header): Remove setting of is_relocatable. * gas/cfi/cfi-common-6.d: Allow for possible relocation of the .debug.eh_frame section.
2007-07-05Change sources over to using GPLv3Nick Clifton1-15/+16
2007-04-26bfd/Alan Modra1-4/+1
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.
2005-09-302005-09-30 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-0/+122
* Makefile.am (CFILES): Add dwarf.c. (readelf_SOURCES): Likewise. * Makefile.in: Regenerated. * dwarf.c: New file. * dwarf.h. Likewise. * readelf.c: Include "dwarf.h" instead of "bfd.h". (do_debug_info): Remove the static definition. (do_debug_abbrevs): Likewise. (do_debug_lines): Likewise. (do_debug_pubnames): Likewise. (do_debug_aranges): Likewise. (do_debug_ranges): Likewise. (do_debug_frames): Likewise. (do_debug_frames_interp): Likewise. (do_debug_macinfo): Likewise. (do_debug_str): Likewise. (do_debug_loc): Likewise. (is_relocatable): Likewise. (have_frame_base): Likewise. (need_base_address): Likewise. (eh_addr_size): Likewise. (error): Likewise. (warn): Likewise. (cmalloc): Likewise. (xcmalloc): Likewise. (xcrealloc): Likewise. (dwarf_section): Removed. (byte_get_little_endian): Likewise. (byte_get_signed): Likewise. (byte_get_big_endian): Likewise. (read_leb128): Likewise. (State_Machine_Registers): Likewise. (state_machine_regs): Likewise. (reset_state_machine): Likewise. (process_extended_line_op): Likewise. (debug_str_section): Likewise. (fetch_indirect_string): Likewise. (debug_abbrev_section): Likewise. (abbrev_attr): Likewise. (first_abbrev): Likewise. (last_abbrev): Likewise. (free_abbrevs): Likewise. (add_abbrev_attr): Likewise. (process_abbrev_section): Likewise. (get_TAG_name): Likewise. (get_FORM_name): Likewise. (display_block): Likewise. (decode_location_expression): Likewise. (debug_info): Likewise. (debug_information): Likewise. (num_debug_info_entries): Likewise. (last_pointer_size): Likewise. (warned_about_missing_comp_units): Likewise. (read_and_display_attr_value): Likewise. (get_AT_name): Likewise. (read_and_display_attr): Likewise. (process_debug_info): Likewise. (get_pointer_size_and_offset_of_comp_unit): Likewise. (get_debug_info): Likewise. (display_debug_lines): Likewise. (display_debug_pubnames): Likewise. (display_debug_macinfo): Likewise. (display_debug_abbrev): Likewise. (display_debug_loc): Likewise. (display_debug_str): Likewise. (display_debug_aranges): Likewise. (display_debug_ranges): Likewise. (Frame_Chunk): Likewise. (DW_CFA_unreferenced): Likewise. (frame_need_space): Likewise. (frame_display_row): Likewise. (size_of_encoded_value): Likewise. (get_encoded_value): Likewise. (GET): Likewise. (LEB): Likewise. (SLEB): Likewise. (display_debug_frames): Likewise. (display_debug_not_supported): Likewise. (debug_displays): Likewise. (load_debug_section): Updated. (free_debug_section): Likewise. (display_debug_section): Likewise. (process_object): Call free_debug_memory to free debug memory.