2006-01-17 Jim Blandy <jimb@redhat.com>

* dwarf2read.c (struct dwarf2_per_objfile, struct comp_unit_head)
	(struct line_header, struct partial_die_info, struct dwarf_block):
	Use gdb_byte for members that refer to Dwarf section contents.
	(dwarf2_read_abbrevs, dwarf2_read_section, dwarf_decode_lines,
	dwarf_decode_macros, load_comp_unit, load_partial_dies,
	locate_pdi_sibling, partial_read_comp_unit_head, peek_die_abbrev,
	read_1_byte, read_1_signed_byte, read_2_bytes, read_4_bytes,
	read_8_bytes, read_address, read_attribute, read_attribute_value,
	read_comp_unit, read_comp_unit_head, read_die_and_children,
	read_die_and_siblings, read_full_die, read_indirect_string,
	read_initial_length, read_n_bytes, read_offset, read_partial_die,
	read_signed_leb128, read_string, read_unsigned_leb128,
	skip_children, skip_leb128, skip_one_die): Same.
This commit is contained in:
Jim Blandy 2006-01-17 22:01:42 +00:00
parent c9021189f6
commit fe1b8b76fd
2 changed files with 162 additions and 144 deletions

View File

@ -1,3 +1,19 @@
2006-01-17 Jim Blandy <jimb@redhat.com>
* dwarf2read.c (struct dwarf2_per_objfile, struct comp_unit_head)
(struct line_header, struct partial_die_info, struct dwarf_block):
Use gdb_byte for members that refer to Dwarf section contents.
(dwarf2_read_abbrevs, dwarf2_read_section, dwarf_decode_lines,
dwarf_decode_macros, load_comp_unit, load_partial_dies,
locate_pdi_sibling, partial_read_comp_unit_head, peek_die_abbrev,
read_1_byte, read_1_signed_byte, read_2_bytes, read_4_bytes,
read_8_bytes, read_address, read_attribute, read_attribute_value,
read_comp_unit, read_comp_unit_head, read_die_and_children,
read_die_and_siblings, read_full_die, read_indirect_string,
read_initial_length, read_n_bytes, read_offset, read_partial_die,
read_signed_leb128, read_string, read_unsigned_leb128,
skip_children, skip_leb128, skip_one_die): Same.
2006-01-17 Daniel Jacobowitz <dan@codesourcery.com> 2006-01-17 Daniel Jacobowitz <dan@codesourcery.com>
* complaints.c (stop_whining): Make signed. * complaints.c (stop_whining): Make signed.

View File

@ -162,13 +162,13 @@ struct dwarf2_per_objfile
unsigned int eh_frame_size; unsigned int eh_frame_size;
/* Loaded data from the sections. */ /* Loaded data from the sections. */
char *info_buffer; gdb_byte *info_buffer;
char *abbrev_buffer; gdb_byte *abbrev_buffer;
char *line_buffer; gdb_byte *line_buffer;
char *str_buffer; gdb_byte *str_buffer;
char *macinfo_buffer; gdb_byte *macinfo_buffer;
char *ranges_buffer; gdb_byte *ranges_buffer;
char *loc_buffer; gdb_byte *loc_buffer;
/* A list of all the compilation units. This is used to locate /* A list of all the compilation units. This is used to locate
the target compilation unit of a particular reference. */ the target compilation unit of a particular reference. */
@ -239,11 +239,11 @@ struct comp_unit_head
/* Pointer to this compilation unit header in the .debug_info /* Pointer to this compilation unit header in the .debug_info
section. */ section. */
char *cu_head_ptr; gdb_byte *cu_head_ptr;
/* Pointer to the first die of this compilation unit. This will be /* Pointer to the first die of this compilation unit. This will be
the first byte following the compilation unit header. */ the first byte following the compilation unit header. */
char *first_die_ptr; gdb_byte *first_die_ptr;
/* Pointer to the next compilation unit header in the program. */ /* Pointer to the next compilation unit header in the program. */
struct comp_unit_head *next; struct comp_unit_head *next;
@ -425,7 +425,7 @@ struct line_header
/* The start and end of the statement program following this /* The start and end of the statement program following this
header. These point into dwarf2_per_objfile->line_buffer. */ header. These point into dwarf2_per_objfile->line_buffer. */
char *statement_program_start, *statement_program_end; gdb_byte *statement_program_start, *statement_program_end;
}; };
/* When we construct a partial symbol table entry we only /* When we construct a partial symbol table entry we only
@ -475,7 +475,7 @@ struct partial_die_info
/* Pointer into the info_buffer pointing at the target of /* Pointer into the info_buffer pointing at the target of
DW_AT_sibling, if any. */ DW_AT_sibling, if any. */
char *sibling; gdb_byte *sibling;
/* If HAS_SPECIFICATION, the offset of the DIE referred to by /* If HAS_SPECIFICATION, the offset of the DIE referred to by
DW_AT_specification (or DW_AT_abstract_origin or DW_AT_specification (or DW_AT_abstract_origin or
@ -565,7 +565,7 @@ struct function_range
struct dwarf_block struct dwarf_block
{ {
unsigned int size; unsigned int size;
char *data; gdb_byte *data;
}; };
#ifndef ATTR_ALLOC_CHUNK #ifndef ATTR_ALLOC_CHUNK
@ -739,33 +739,33 @@ static void add_partial_namespace (struct partial_die_info *pdi,
static void add_partial_enumeration (struct partial_die_info *enum_pdi, static void add_partial_enumeration (struct partial_die_info *enum_pdi,
struct dwarf2_cu *cu); struct dwarf2_cu *cu);
static char *locate_pdi_sibling (struct partial_die_info *orig_pdi, static gdb_byte *locate_pdi_sibling (struct partial_die_info *orig_pdi,
char *info_ptr, gdb_byte *info_ptr,
bfd *abfd, bfd *abfd,
struct dwarf2_cu *cu); struct dwarf2_cu *cu);
static void dwarf2_psymtab_to_symtab (struct partial_symtab *); static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
static void psymtab_to_symtab_1 (struct partial_symtab *); static void psymtab_to_symtab_1 (struct partial_symtab *);
char *dwarf2_read_section (struct objfile *, asection *); gdb_byte *dwarf2_read_section (struct objfile *, asection *);
static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu);
static void dwarf2_free_abbrev_table (void *); static void dwarf2_free_abbrev_table (void *);
static struct abbrev_info *peek_die_abbrev (char *, unsigned int *, static struct abbrev_info *peek_die_abbrev (gdb_byte *, unsigned int *,
struct dwarf2_cu *); struct dwarf2_cu *);
static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int, static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int,
struct dwarf2_cu *); struct dwarf2_cu *);
static struct partial_die_info *load_partial_dies (bfd *, char *, int, static struct partial_die_info *load_partial_dies (bfd *, gdb_byte *, int,
struct dwarf2_cu *); struct dwarf2_cu *);
static char *read_partial_die (struct partial_die_info *, static gdb_byte *read_partial_die (struct partial_die_info *,
struct abbrev_info *abbrev, unsigned int, struct abbrev_info *abbrev, unsigned int,
bfd *, char *, struct dwarf2_cu *); bfd *, gdb_byte *, struct dwarf2_cu *);
static struct partial_die_info *find_partial_die (unsigned long, static struct partial_die_info *find_partial_die (unsigned long,
struct dwarf2_cu *); struct dwarf2_cu *);
@ -773,46 +773,47 @@ static struct partial_die_info *find_partial_die (unsigned long,
static void fixup_partial_die (struct partial_die_info *, static void fixup_partial_die (struct partial_die_info *,
struct dwarf2_cu *); struct dwarf2_cu *);
static char *read_full_die (struct die_info **, bfd *, char *, static gdb_byte *read_full_die (struct die_info **, bfd *, gdb_byte *,
struct dwarf2_cu *, int *); struct dwarf2_cu *, int *);
static char *read_attribute (struct attribute *, struct attr_abbrev *, static gdb_byte *read_attribute (struct attribute *, struct attr_abbrev *,
bfd *, char *, struct dwarf2_cu *); bfd *, gdb_byte *, struct dwarf2_cu *);
static char *read_attribute_value (struct attribute *, unsigned, static gdb_byte *read_attribute_value (struct attribute *, unsigned,
bfd *, char *, struct dwarf2_cu *); bfd *, gdb_byte *, struct dwarf2_cu *);
static unsigned int read_1_byte (bfd *, char *); static unsigned int read_1_byte (bfd *, gdb_byte *);
static int read_1_signed_byte (bfd *, char *); static int read_1_signed_byte (bfd *, gdb_byte *);
static unsigned int read_2_bytes (bfd *, char *); static unsigned int read_2_bytes (bfd *, gdb_byte *);
static unsigned int read_4_bytes (bfd *, char *); static unsigned int read_4_bytes (bfd *, gdb_byte *);
static unsigned long read_8_bytes (bfd *, char *); static unsigned long read_8_bytes (bfd *, gdb_byte *);
static CORE_ADDR read_address (bfd *, char *ptr, struct dwarf2_cu *, static CORE_ADDR read_address (bfd *, gdb_byte *ptr, struct dwarf2_cu *,
unsigned int *); unsigned int *);
static LONGEST read_initial_length (bfd *, char *, static LONGEST read_initial_length (bfd *, gdb_byte *,
struct comp_unit_head *, unsigned int *); struct comp_unit_head *, unsigned int *);
static LONGEST read_offset (bfd *, char *, const struct comp_unit_head *, static LONGEST read_offset (bfd *, gdb_byte *, const struct comp_unit_head *,
unsigned int *); unsigned int *);
static char *read_n_bytes (bfd *, char *, unsigned int); static gdb_byte *read_n_bytes (bfd *, gdb_byte *, unsigned int);
static char *read_string (bfd *, char *, unsigned int *); static char *read_string (bfd *, gdb_byte *, unsigned int *);
static char *read_indirect_string (bfd *, char *, const struct comp_unit_head *, static char *read_indirect_string (bfd *, gdb_byte *,
unsigned int *); const struct comp_unit_head *,
unsigned int *);
static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *); static unsigned long read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *);
static long read_signed_leb128 (bfd *, char *, unsigned int *); static long read_signed_leb128 (bfd *, gdb_byte *, unsigned int *);
static char *skip_leb128 (bfd *, char *); static gdb_byte *skip_leb128 (bfd *, gdb_byte *);
static void set_cu_language (unsigned int, struct dwarf2_cu *); static void set_cu_language (unsigned int, struct dwarf2_cu *);
@ -862,7 +863,9 @@ static void read_type_die (struct die_info *, struct dwarf2_cu *);
static char *determine_prefix (struct die_info *die, struct dwarf2_cu *); static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
static char *typename_concat (struct obstack *, const char *prefix, const char *suffix, static char *typename_concat (struct obstack *,
const char *prefix,
const char *suffix,
struct dwarf2_cu *); struct dwarf2_cu *);
static void read_typedef (struct die_info *, struct dwarf2_cu *); static void read_typedef (struct die_info *, struct dwarf2_cu *);
@ -938,16 +941,16 @@ static void read_tag_string_type (struct die_info *, struct dwarf2_cu *);
static void read_subroutine_type (struct die_info *, struct dwarf2_cu *); static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
static struct die_info *read_comp_unit (char *, bfd *, struct dwarf2_cu *); static struct die_info *read_comp_unit (gdb_byte *, bfd *, struct dwarf2_cu *);
static struct die_info *read_die_and_children (char *info_ptr, bfd *abfd, static struct die_info *read_die_and_children (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *, struct dwarf2_cu *,
char **new_info_ptr, gdb_byte **new_info_ptr,
struct die_info *parent); struct die_info *parent);
static struct die_info *read_die_and_siblings (char *info_ptr, bfd *abfd, static struct die_info *read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *, struct dwarf2_cu *,
char **new_info_ptr, gdb_byte **new_info_ptr,
struct die_info *parent); struct die_info *parent);
static void free_die_list (struct die_info *); static void free_die_list (struct die_info *);
@ -1022,8 +1025,8 @@ static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu); struct dwarf2_cu *cu);
static char *skip_one_die (char *info_ptr, struct abbrev_info *abbrev, static gdb_byte *skip_one_die (gdb_byte *info_ptr, struct abbrev_info *abbrev,
struct dwarf2_cu *cu); struct dwarf2_cu *cu);
static void free_stack_comp_unit (void *); static void free_stack_comp_unit (void *);
@ -1264,9 +1267,9 @@ dwarf2_build_psymtabs_easy (struct objfile *objfile, int mainline)
/* Read in the comp unit header information from the debug_info at /* Read in the comp unit header information from the debug_info at
info_ptr. */ info_ptr. */
static char * static gdb_byte *
read_comp_unit_head (struct comp_unit_head *cu_header, read_comp_unit_head (struct comp_unit_head *cu_header,
char *info_ptr, bfd *abfd) gdb_byte *info_ptr, bfd *abfd)
{ {
int signed_addr; int signed_addr;
unsigned int bytes_read; unsigned int bytes_read;
@ -1288,11 +1291,11 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
return info_ptr; return info_ptr;
} }
static char * static gdb_byte *
partial_read_comp_unit_head (struct comp_unit_head *header, char *info_ptr, partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
bfd *abfd) bfd *abfd)
{ {
char *beg_of_comp_unit = info_ptr; gdb_byte *beg_of_comp_unit = info_ptr;
info_ptr = read_comp_unit_head (header, info_ptr, abfd); info_ptr = read_comp_unit_head (header, info_ptr, abfd);
@ -1388,8 +1391,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
/* Instead of reading this into a big buffer, we should probably use /* Instead of reading this into a big buffer, we should probably use
mmap() on architectures that support it. (FIXME) */ mmap() on architectures that support it. (FIXME) */
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
char *info_ptr; gdb_byte *info_ptr;
char *beg_of_comp_unit; gdb_byte *beg_of_comp_unit;
struct partial_die_info comp_unit_die; struct partial_die_info comp_unit_die;
struct partial_symtab *pst; struct partial_symtab *pst;
struct cleanup *back_to; struct cleanup *back_to;
@ -1555,7 +1558,7 @@ static void
load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile)
{ {
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
char *info_ptr, *beg_of_comp_unit; gdb_byte *info_ptr, *beg_of_comp_unit;
struct partial_die_info comp_unit_die; struct partial_die_info comp_unit_die;
struct dwarf2_cu *cu; struct dwarf2_cu *cu;
struct abbrev_info *abbrev; struct abbrev_info *abbrev;
@ -1614,7 +1617,7 @@ create_all_comp_units (struct objfile *objfile)
int n_allocated; int n_allocated;
int n_comp_units; int n_comp_units;
struct dwarf2_per_cu_data **all_comp_units; struct dwarf2_per_cu_data **all_comp_units;
char *info_ptr = dwarf2_per_objfile->info_buffer; gdb_byte *info_ptr = dwarf2_per_objfile->info_buffer;
n_comp_units = 0; n_comp_units = 0;
n_allocated = 10; n_allocated = 10;
@ -1624,7 +1627,7 @@ create_all_comp_units (struct objfile *objfile)
while (info_ptr < dwarf2_per_objfile->info_buffer + dwarf2_per_objfile->info_size) while (info_ptr < dwarf2_per_objfile->info_buffer + dwarf2_per_objfile->info_size)
{ {
struct comp_unit_head cu_header; struct comp_unit_head cu_header;
char *beg_of_comp_unit; gdb_byte *beg_of_comp_unit;
struct dwarf2_per_cu_data *this_cu; struct dwarf2_per_cu_data *this_cu;
unsigned long offset; unsigned long offset;
unsigned int bytes_read; unsigned int bytes_read;
@ -2138,7 +2141,7 @@ add_partial_enumeration (struct partial_die_info *enum_pdi,
the initial number. */ the initial number. */
static struct abbrev_info * static struct abbrev_info *
peek_die_abbrev (char *info_ptr, unsigned int *bytes_read, peek_die_abbrev (gdb_byte *info_ptr, unsigned int *bytes_read,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
bfd *abfd = cu->objfile->obfd; bfd *abfd = cu->objfile->obfd;
@ -2164,8 +2167,8 @@ peek_die_abbrev (char *info_ptr, unsigned int *bytes_read,
pointer to the end of a series of DIEs, terminated by an empty pointer to the end of a series of DIEs, terminated by an empty
DIE. Any children of the skipped DIEs will also be skipped. */ DIE. Any children of the skipped DIEs will also be skipped. */
static char * static gdb_byte *
skip_children (char *info_ptr, struct dwarf2_cu *cu) skip_children (gdb_byte *info_ptr, struct dwarf2_cu *cu)
{ {
struct abbrev_info *abbrev; struct abbrev_info *abbrev;
unsigned int bytes_read; unsigned int bytes_read;
@ -2186,8 +2189,8 @@ skip_children (char *info_ptr, struct dwarf2_cu *cu)
ABBREV. Returns a pointer to this DIE's sibling, skipping any ABBREV. Returns a pointer to this DIE's sibling, skipping any
children. */ children. */
static char * static gdb_byte *
skip_one_die (char *info_ptr, struct abbrev_info *abbrev, skip_one_die (gdb_byte *info_ptr, struct abbrev_info *abbrev,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
unsigned int bytes_read; unsigned int bytes_read;
@ -2283,8 +2286,8 @@ skip_one_die (char *info_ptr, struct abbrev_info *abbrev,
/* Locate ORIG_PDI's sibling; INFO_PTR should point to the start of /* Locate ORIG_PDI's sibling; INFO_PTR should point to the start of
the next DIE after ORIG_PDI. */ the next DIE after ORIG_PDI. */
static char * static gdb_byte *
locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr, locate_pdi_sibling (struct partial_die_info *orig_pdi, gdb_byte *info_ptr,
bfd *abfd, struct dwarf2_cu *cu) bfd *abfd, struct dwarf2_cu *cu)
{ {
/* Do we know the sibling already? */ /* Do we know the sibling already? */
@ -2485,7 +2488,7 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
bfd *abfd = pst->objfile->obfd; bfd *abfd = pst->objfile->obfd;
struct dwarf2_cu *cu; struct dwarf2_cu *cu;
unsigned long offset; unsigned long offset;
char *info_ptr; gdb_byte *info_ptr;
struct cleanup *back_to, *free_cu_cleanup; struct cleanup *back_to, *free_cu_cleanup;
struct attribute *attr; struct attribute *attr;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -3058,7 +3061,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR base; CORE_ADDR base;
int found_base; int found_base;
unsigned int dummy; unsigned int dummy;
char *buffer; gdb_byte *buffer;
CORE_ADDR marker; CORE_ADDR marker;
int low_set; int low_set;
@ -3445,11 +3448,11 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
if (fip->nbaseclasses) if (fip->nbaseclasses)
{ {
int num_bytes = B_BYTES (fip->nbaseclasses); int num_bytes = B_BYTES (fip->nbaseclasses);
char *pointer; unsigned char *pointer;
ALLOCATE_CPLUS_STRUCT_TYPE (type); ALLOCATE_CPLUS_STRUCT_TYPE (type);
pointer = (char *) TYPE_ALLOC (type, num_bytes); pointer = TYPE_ALLOC (type, num_bytes);
TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *) pointer; TYPE_FIELD_VIRTUAL_BITS (type) = pointer;
B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->nbaseclasses); B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->nbaseclasses);
TYPE_N_BASECLASSES (type) = fip->nbaseclasses; TYPE_N_BASECLASSES (type) = fip->nbaseclasses;
} }
@ -4836,7 +4839,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
/* Read a whole compilation unit into a linked list of dies. */ /* Read a whole compilation unit into a linked list of dies. */
static struct die_info * static struct die_info *
read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu) read_comp_unit (gdb_byte *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
{ {
return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL); return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL);
} }
@ -4848,13 +4851,13 @@ read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
is the parent of the die in question. */ is the parent of the die in question. */
static struct die_info * static struct die_info *
read_die_and_children (char *info_ptr, bfd *abfd, read_die_and_children (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *cu, struct dwarf2_cu *cu,
char **new_info_ptr, gdb_byte **new_info_ptr,
struct die_info *parent) struct die_info *parent)
{ {
struct die_info *die; struct die_info *die;
char *cur_ptr; gdb_byte *cur_ptr;
int has_children; int has_children;
cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children); cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
@ -4881,13 +4884,13 @@ read_die_and_children (char *info_ptr, bfd *abfd,
in read_die_and_children. */ in read_die_and_children. */
static struct die_info * static struct die_info *
read_die_and_siblings (char *info_ptr, bfd *abfd, read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *cu, struct dwarf2_cu *cu,
char **new_info_ptr, gdb_byte **new_info_ptr,
struct die_info *parent) struct die_info *parent)
{ {
struct die_info *first_die, *last_sibling; struct die_info *first_die, *last_sibling;
char *cur_ptr; gdb_byte *cur_ptr;
cur_ptr = info_ptr; cur_ptr = info_ptr;
first_die = last_sibling = NULL; first_die = last_sibling = NULL;
@ -4940,19 +4943,18 @@ free_die_list (struct die_info *dies)
/* Read the contents of the section at OFFSET and of size SIZE from the /* Read the contents of the section at OFFSET and of size SIZE from the
object file specified by OBJFILE into the objfile_obstack and return it. */ object file specified by OBJFILE into the objfile_obstack and return it. */
char * gdb_byte *
dwarf2_read_section (struct objfile *objfile, asection *sectp) dwarf2_read_section (struct objfile *objfile, asection *sectp)
{ {
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
char *buf, *retbuf; gdb_byte *buf, *retbuf;
bfd_size_type size = bfd_get_section_size (sectp); bfd_size_type size = bfd_get_section_size (sectp);
if (size == 0) if (size == 0)
return NULL; return NULL;
buf = (char *) obstack_alloc (&objfile->objfile_obstack, size); buf = obstack_alloc (&objfile->objfile_obstack, size);
retbuf retbuf = symfile_relocate_debug_section (abfd, sectp, buf);
= (char *) symfile_relocate_debug_section (abfd, sectp, (bfd_byte *) buf);
if (retbuf != NULL) if (retbuf != NULL)
return retbuf; return retbuf;
@ -4974,7 +4976,7 @@ static void
dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu) dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu)
{ {
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
char *abbrev_ptr; gdb_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev; struct abbrev_info *cur_abbrev;
unsigned int abbrev_number, bytes_read, abbrev_name; unsigned int abbrev_number, bytes_read, abbrev_name;
unsigned int abbrev_form, hash_number; unsigned int abbrev_form, hash_number;
@ -5139,7 +5141,7 @@ is_type_tag_for_partial (int tag)
/* Load all DIEs that are interesting for partial symbols into memory. */ /* Load all DIEs that are interesting for partial symbols into memory. */
static struct partial_die_info * static struct partial_die_info *
load_partial_dies (bfd *abfd, char *info_ptr, int building_psymtab, load_partial_dies (bfd *abfd, gdb_byte *info_ptr, int building_psymtab,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct partial_die_info *part_die; struct partial_die_info *part_die;
@ -5335,11 +5337,11 @@ load_partial_dies (bfd *abfd, char *info_ptr, int building_psymtab,
/* Read a minimal amount of information into the minimal die structure. */ /* Read a minimal amount of information into the minimal die structure. */
static char * static gdb_byte *
read_partial_die (struct partial_die_info *part_die, read_partial_die (struct partial_die_info *part_die,
struct abbrev_info *abbrev, struct abbrev_info *abbrev,
unsigned int abbrev_len, bfd *abfd, unsigned int abbrev_len, bfd *abfd,
char *info_ptr, struct dwarf2_cu *cu) gdb_byte *info_ptr, struct dwarf2_cu *cu)
{ {
unsigned int bytes_read, i; unsigned int bytes_read, i;
struct attribute attr; struct attribute attr;
@ -5544,8 +5546,8 @@ fixup_partial_die (struct partial_die_info *part_die,
child, sibling, and parent fields. Set HAS_CHILDREN to tell child, sibling, and parent fields. Set HAS_CHILDREN to tell
whether the die has children or not. */ whether the die has children or not. */
static char * static gdb_byte *
read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr, read_full_die (struct die_info **diep, bfd *abfd, gdb_byte *info_ptr,
struct dwarf2_cu *cu, int *has_children) struct dwarf2_cu *cu, int *has_children)
{ {
unsigned int abbrev_number, bytes_read, i, offset; unsigned int abbrev_number, bytes_read, i, offset;
@ -5628,9 +5630,9 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr,
/* Read an attribute value described by an attribute form. */ /* Read an attribute value described by an attribute form. */
static char * static gdb_byte *
read_attribute_value (struct attribute *attr, unsigned form, read_attribute_value (struct attribute *attr, unsigned form,
bfd *abfd, char *info_ptr, bfd *abfd, gdb_byte *info_ptr,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
@ -5750,9 +5752,9 @@ read_attribute_value (struct attribute *attr, unsigned form,
/* Read an attribute described by an abbreviated attribute. */ /* Read an attribute described by an abbreviated attribute. */
static char * static gdb_byte *
read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, read_attribute (struct attribute *attr, struct attr_abbrev *abbrev,
bfd *abfd, char *info_ptr, struct dwarf2_cu *cu) bfd *abfd, gdb_byte *info_ptr, struct dwarf2_cu *cu)
{ {
attr->name = abbrev->name; attr->name = abbrev->name;
return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu); return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu);
@ -5761,49 +5763,49 @@ read_attribute (struct attribute *attr, struct attr_abbrev *abbrev,
/* read dwarf information from a buffer */ /* read dwarf information from a buffer */
static unsigned int static unsigned int
read_1_byte (bfd *abfd, char *buf) read_1_byte (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_8 (abfd, (bfd_byte *) buf); return bfd_get_8 (abfd, buf);
} }
static int static int
read_1_signed_byte (bfd *abfd, char *buf) read_1_signed_byte (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_signed_8 (abfd, (bfd_byte *) buf); return bfd_get_signed_8 (abfd, buf);
} }
static unsigned int static unsigned int
read_2_bytes (bfd *abfd, char *buf) read_2_bytes (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_16 (abfd, (bfd_byte *) buf); return bfd_get_16 (abfd, buf);
} }
static int static int
read_2_signed_bytes (bfd *abfd, char *buf) read_2_signed_bytes (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_signed_16 (abfd, (bfd_byte *) buf); return bfd_get_signed_16 (abfd, buf);
} }
static unsigned int static unsigned int
read_4_bytes (bfd *abfd, char *buf) read_4_bytes (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_32 (abfd, (bfd_byte *) buf); return bfd_get_32 (abfd, buf);
} }
static int static int
read_4_signed_bytes (bfd *abfd, char *buf) read_4_signed_bytes (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_signed_32 (abfd, (bfd_byte *) buf); return bfd_get_signed_32 (abfd, buf);
} }
static unsigned long static unsigned long
read_8_bytes (bfd *abfd, char *buf) read_8_bytes (bfd *abfd, gdb_byte *buf)
{ {
return bfd_get_64 (abfd, (bfd_byte *) buf); return bfd_get_64 (abfd, buf);
} }
static CORE_ADDR static CORE_ADDR
read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu, read_address (bfd *abfd, gdb_byte *buf, struct dwarf2_cu *cu,
unsigned int *bytes_read) unsigned int *bytes_read)
{ {
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
@ -5814,13 +5816,13 @@ read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu,
switch (cu_header->addr_size) switch (cu_header->addr_size)
{ {
case 2: case 2:
retval = bfd_get_signed_16 (abfd, (bfd_byte *) buf); retval = bfd_get_signed_16 (abfd, buf);
break; break;
case 4: case 4:
retval = bfd_get_signed_32 (abfd, (bfd_byte *) buf); retval = bfd_get_signed_32 (abfd, buf);
break; break;
case 8: case 8:
retval = bfd_get_signed_64 (abfd, (bfd_byte *) buf); retval = bfd_get_signed_64 (abfd, buf);
break; break;
default: default:
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
@ -5833,13 +5835,13 @@ read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu,
switch (cu_header->addr_size) switch (cu_header->addr_size)
{ {
case 2: case 2:
retval = bfd_get_16 (abfd, (bfd_byte *) buf); retval = bfd_get_16 (abfd, buf);
break; break;
case 4: case 4:
retval = bfd_get_32 (abfd, (bfd_byte *) buf); retval = bfd_get_32 (abfd, buf);
break; break;
case 8: case 8:
retval = bfd_get_64 (abfd, (bfd_byte *) buf); retval = bfd_get_64 (abfd, buf);
break; break;
default: default:
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
@ -5896,20 +5898,20 @@ read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu,
] */ ] */
static LONGEST static LONGEST
read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header, read_initial_length (bfd *abfd, gdb_byte *buf, struct comp_unit_head *cu_header,
unsigned int *bytes_read) unsigned int *bytes_read)
{ {
LONGEST length = bfd_get_32 (abfd, (bfd_byte *) buf); LONGEST length = bfd_get_32 (abfd, buf);
if (length == 0xffffffff) if (length == 0xffffffff)
{ {
length = bfd_get_64 (abfd, (bfd_byte *) buf + 4); length = bfd_get_64 (abfd, buf + 4);
*bytes_read = 12; *bytes_read = 12;
} }
else if (length == 0) else if (length == 0)
{ {
/* Handle the (non-standard) 64-bit DWARF2 format used by IRIX. */ /* Handle the (non-standard) 64-bit DWARF2 format used by IRIX. */
length = bfd_get_64 (abfd, (bfd_byte *) buf); length = bfd_get_64 (abfd, buf);
*bytes_read = 8; *bytes_read = 8;
} }
else else
@ -5940,7 +5942,7 @@ read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header,
given by cu_header->offset_size. */ given by cu_header->offset_size. */
static LONGEST static LONGEST
read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header, read_offset (bfd *abfd, gdb_byte *buf, const struct comp_unit_head *cu_header,
unsigned int *bytes_read) unsigned int *bytes_read)
{ {
LONGEST retval = 0; LONGEST retval = 0;
@ -5948,11 +5950,11 @@ read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
switch (cu_header->offset_size) switch (cu_header->offset_size)
{ {
case 4: case 4:
retval = bfd_get_32 (abfd, (bfd_byte *) buf); retval = bfd_get_32 (abfd, buf);
*bytes_read = 4; *bytes_read = 4;
break; break;
case 8: case 8:
retval = bfd_get_64 (abfd, (bfd_byte *) buf); retval = bfd_get_64 (abfd, buf);
*bytes_read = 8; *bytes_read = 8;
break; break;
default: default:
@ -5964,8 +5966,8 @@ read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
return retval; return retval;
} }
static char * static gdb_byte *
read_n_bytes (bfd *abfd, char *buf, unsigned int size) read_n_bytes (bfd *abfd, gdb_byte *buf, unsigned int size)
{ {
/* If the size of a host char is 8 bits, we can return a pointer /* If the size of a host char is 8 bits, we can return a pointer
to the buffer, otherwise we have to copy the data to a buffer to the buffer, otherwise we have to copy the data to a buffer
@ -5975,7 +5977,7 @@ read_n_bytes (bfd *abfd, char *buf, unsigned int size)
} }
static char * static char *
read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) read_string (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{ {
/* If the size of a host char is 8 bits, we can return a pointer /* If the size of a host char is 8 bits, we can return a pointer
to the string, otherwise we have to copy the string to a buffer to the string, otherwise we have to copy the string to a buffer
@ -5986,12 +5988,12 @@ read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
*bytes_read_ptr = 1; *bytes_read_ptr = 1;
return NULL; return NULL;
} }
*bytes_read_ptr = strlen (buf) + 1; *bytes_read_ptr = strlen ((char *) buf) + 1;
return buf; return (char *) buf;
} }
static char * static char *
read_indirect_string (bfd *abfd, char *buf, read_indirect_string (bfd *abfd, gdb_byte *buf,
const struct comp_unit_head *cu_header, const struct comp_unit_head *cu_header,
unsigned int *bytes_read_ptr) unsigned int *bytes_read_ptr)
{ {
@ -6013,11 +6015,11 @@ read_indirect_string (bfd *abfd, char *buf,
gdb_assert (HOST_CHAR_BIT == 8); gdb_assert (HOST_CHAR_BIT == 8);
if (dwarf2_per_objfile->str_buffer[str_offset] == '\0') if (dwarf2_per_objfile->str_buffer[str_offset] == '\0')
return NULL; return NULL;
return dwarf2_per_objfile->str_buffer + str_offset; return (char *) (dwarf2_per_objfile->str_buffer + str_offset);
} }
static unsigned long static unsigned long
read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) read_unsigned_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{ {
unsigned long result; unsigned long result;
unsigned int num_read; unsigned int num_read;
@ -6030,7 +6032,7 @@ read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
i = 0; i = 0;
while (1) while (1)
{ {
byte = bfd_get_8 (abfd, (bfd_byte *) buf); byte = bfd_get_8 (abfd, buf);
buf++; buf++;
num_read++; num_read++;
result |= ((unsigned long)(byte & 127) << shift); result |= ((unsigned long)(byte & 127) << shift);
@ -6045,7 +6047,7 @@ read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
} }
static long static long
read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) read_signed_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{ {
long result; long result;
int i, shift, num_read; int i, shift, num_read;
@ -6057,7 +6059,7 @@ read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
i = 0; i = 0;
while (1) while (1)
{ {
byte = bfd_get_8 (abfd, (bfd_byte *) buf); byte = bfd_get_8 (abfd, buf);
buf++; buf++;
num_read++; num_read++;
result |= ((long)(byte & 127) << shift); result |= ((long)(byte & 127) << shift);
@ -6075,14 +6077,14 @@ read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
/* Return a pointer to just past the end of an LEB128 number in BUF. */ /* Return a pointer to just past the end of an LEB128 number in BUF. */
static char * static gdb_byte *
skip_leb128 (bfd *abfd, char *buf) skip_leb128 (bfd *abfd, gdb_byte *buf)
{ {
int byte; int byte;
while (1) while (1)
{ {
byte = bfd_get_8 (abfd, (bfd_byte *) buf); byte = bfd_get_8 (abfd, buf);
buf++; buf++;
if ((byte & 128) == 0) if ((byte & 128) == 0)
return buf; return buf;
@ -6281,7 +6283,7 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
{ {
struct cleanup *back_to; struct cleanup *back_to;
struct line_header *lh; struct line_header *lh;
char *line_ptr; gdb_byte *line_ptr;
unsigned int bytes_read; unsigned int bytes_read;
int i; int i;
char *cur_dir, *cur_file; char *cur_dir, *cur_file;
@ -6333,7 +6335,7 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
lh->opcode_base = read_1_byte (abfd, line_ptr); lh->opcode_base = read_1_byte (abfd, line_ptr);
line_ptr += 1; line_ptr += 1;
lh->standard_opcode_lengths lh->standard_opcode_lengths
= (unsigned char *) xmalloc (lh->opcode_base * sizeof (unsigned char)); = xmalloc (lh->opcode_base * sizeof (lh->standard_opcode_lengths[0]));
lh->standard_opcode_lengths[0] = 1; /* This should never be used anyway. */ lh->standard_opcode_lengths[0] = 1; /* This should never be used anyway. */
for (i = 1; i < lh->opcode_base; ++i) for (i = 1; i < lh->opcode_base; ++i)
@ -6445,8 +6447,8 @@ static void
dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
struct dwarf2_cu *cu, struct partial_symtab *pst) struct dwarf2_cu *cu, struct partial_symtab *pst)
{ {
char *line_ptr; gdb_byte *line_ptr;
char *line_end; gdb_byte *line_end;
unsigned int bytes_read; unsigned int bytes_read;
unsigned char op_code, extended_op, adj_opcode; unsigned char op_code, extended_op, adj_opcode;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -8585,11 +8587,11 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
int i; int i;
int size = blk->size; int size = blk->size;
char *data = blk->data; gdb_byte *data = blk->data;
CORE_ADDR stack[64]; CORE_ADDR stack[64];
int stacki; int stacki;
unsigned int bytes_read, unsnd; unsigned int bytes_read, unsnd;
unsigned char op; gdb_byte op;
i = 0; i = 0;
stacki = 0; stacki = 0;
@ -9073,7 +9075,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
char *comp_dir, bfd *abfd, char *comp_dir, bfd *abfd,
struct dwarf2_cu *cu) struct dwarf2_cu *cu)
{ {
char *mac_ptr, *mac_end; gdb_byte *mac_ptr, *mac_end;
struct macro_source_file *current_file = 0; struct macro_source_file *current_file = 0;
if (dwarf2_per_objfile->macinfo_buffer == NULL) if (dwarf2_per_objfile->macinfo_buffer == NULL)