mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-30 05:23:49 +08:00
1b31505692
* 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.
129 lines
3.6 KiB
C
129 lines
3.6 KiB
C
/* dwarf.h - DWARF support header file
|
|
Copyright 2005, 2007, 2008
|
|
Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU Binutils.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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. */
|
|
|
|
#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
|
|
{
|
|
/* 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;
|
|
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 *);
|
|
unsigned int relocate : 1;
|
|
unsigned int eh_frame : 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;
|
|
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);
|
|
|
|
extern int eh_addr_size;
|
|
|
|
extern int do_debug_info;
|
|
extern int do_debug_abbrevs;
|
|
extern int do_debug_lines;
|
|
extern int do_debug_lines_decoded;
|
|
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;
|
|
|
|
extern void init_dwarf_regnames (unsigned int);
|
|
|
|
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);
|
|
|
|
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;
|