binutils-gdb/binutils/dwarf.h

133 lines
3.8 KiB
C
Raw Normal View History

bfd/ * 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-07-10 03:32:23 +02:00
/* dwarf.h - DWARF support header file
Copyright 2005, 2007, 2008
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
Free Software Foundation, Inc.
2007-07-05 18:54:46 +02:00
This file is part of GNU Binutils.
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
2007-07-05 18:54:46 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
2007-07-05 18:54:46 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
2007-07-05 18:54:46 +02:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
/* We can't use any bfd types here since readelf may define BFD64 and
objdump may not. */
typedef unsigned long long dwarf_vma;
typedef unsigned long long dwarf_size_type;
#else
typedef unsigned long dwarf_vma;
typedef unsigned long dwarf_size_type;
#endif
struct dwarf_section
{
bfd/ * 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-07-10 03:32:23 +02:00
/* A debug section has a different name when it's stored compressed
* or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
* possibilities. NAME is set to whichever one is used for this
* input file, as determined by load_debug_section(). */
const char *uncompressed_name;
const char *compressed_name;
const char *name;
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
unsigned char *start;
dwarf_vma address;
dwarf_size_type size;
};
/* A structure containing the name of a debug section
and a pointer to a function that can decode it. */
struct dwarf_section_display
{
struct dwarf_section section;
int (*display) (struct dwarf_section *, void *);
int *enabled;
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
unsigned int relocate : 1;
};
enum dwarf_section_display_enum {
abbrev = 0,
aranges,
frame,
info,
line,
pubnames,
eh_frame,
macinfo,
str,
loc,
pubtypes,
ranges,
static_func,
static_vars,
types,
weaknames,
max
};
extern struct dwarf_section_display debug_displays [];
/* This structure records the information that
we extract from the.debug_info section. */
typedef struct
{
unsigned int pointer_size;
unsigned long cu_offset;
unsigned long base_address;
/* This is an array of offsets to the location list table. */
unsigned long *loc_offsets;
int *have_frame_base;
unsigned int num_loc_offsets;
unsigned int max_loc_offsets;
/* List of .debug_ranges offsets seen in this .debug_info. */
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
unsigned long *range_lists;
unsigned int num_range_lists;
unsigned int max_range_lists;
}
debug_info;
extern dwarf_vma (*byte_get) (unsigned char *, int);
extern dwarf_vma byte_get_little_endian (unsigned char *, int);
extern dwarf_vma byte_get_big_endian (unsigned char *, int);
binutils/ 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.
2008-01-28 16:15:32 +01:00
extern int eh_addr_size;
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
extern int do_debug_info;
extern int do_debug_abbrevs;
extern int do_debug_lines;
extern int do_debug_pubnames;
extern int do_debug_aranges;
extern int do_debug_ranges;
extern int do_debug_frames;
extern int do_debug_frames_interp;
extern int do_debug_macinfo;
extern int do_debug_str;
extern int do_debug_loc;
binutils/ 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.
2008-01-28 16:15:32 +01:00
extern void init_dwarf_regnames (unsigned int);
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
extern int load_debug_section (enum dwarf_section_display_enum,
void *);
extern void free_debug_section (enum dwarf_section_display_enum);
extern void free_debug_memory (void);
extern void dwarf_select_sections_by_names (const char *names);
extern void dwarf_select_sections_by_letters (const char *letters);
extern void dwarf_select_sections_all (void);
2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * 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.
2005-09-30 16:55:05 +02:00
void *cmalloc (size_t, size_t);
void *xcmalloc (size_t, size_t);
void *xcrealloc (void *, size_t, size_t);
void error (const char *, ...) ATTRIBUTE_PRINTF_1;
void warn (const char *, ...) ATTRIBUTE_PRINTF_1;