2010-05-14 Michael Snyder <msnyder@vmware.com>

* dbxread.c: White space.
	* dcache.c: White space.
	* disasm.c: White space.
	* doublest.c: White space.
	* dsrec.c: White space.
	* dummy-frame.c: White space.
	* dwarf2expr.c: White space.
	* dwarf2-frame.c: White space.
	* dwarf2loc.c: White space.
	* dwarf2read.c: White space.
This commit is contained in:
Michael Snyder 2010-05-14 17:53:16 +00:00
parent 88d4aea747
commit 9a619af0d3
11 changed files with 133 additions and 13 deletions

View file

@ -1,3 +1,16 @@
2010-05-14 Michael Snyder <msnyder@vmware.com>
* dbxread.c: White space.
* dcache.c: White space.
* disasm.c: White space.
* doublest.c: White space.
* dsrec.c: White space.
* dummy-frame.c: White space.
* dwarf2expr.c: White space.
* dwarf2-frame.c: White space.
* dwarf2loc.c: White space.
* dwarf2read.c: White space.
2010-05-14 Phil Muldoon <pmuldoon@redhat.com> 2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11482 PR python/11482

View file

@ -490,6 +490,7 @@ record_minimal_symbol (char *name, CORE_ADDR address, int type,
/* Same with virtual function tables, both global and static. */ /* Same with virtual function tables, both global and static. */
{ {
char *tempstring = name; char *tempstring = name;
if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd)) if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
++tempstring; ++tempstring;
if (is_vtable_name (tempstring)) if (is_vtable_name (tempstring))
@ -810,6 +811,7 @@ fill_symbuf (bfd *sym_bfd)
if (symbuf_left <= 0) if (symbuf_left <= 0)
{ {
file_ptr filepos = symbuf_sections->section->filepos; file_ptr filepos = symbuf_sections->section->filepos;
if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0) if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
perror_with_name (bfd_get_filename (sym_bfd)); perror_with_name (bfd_get_filename (sym_bfd));
symbuf_left = bfd_section_size (sym_bfd, symbuf_sections->section); symbuf_left = bfd_section_size (sym_bfd, symbuf_sections->section);
@ -902,6 +904,7 @@ add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
if (next_bincl >= bincl_list + bincls_allocated) if (next_bincl >= bincl_list + bincls_allocated)
{ {
int offset = next_bincl - bincl_list; int offset = next_bincl - bincl_list;
bincls_allocated *= 2; bincls_allocated *= 2;
bincl_list = (struct header_file_location *) bincl_list = (struct header_file_location *)
xrealloc ((char *) bincl_list, xrealloc ((char *) bincl_list,
@ -1091,8 +1094,8 @@ read_dbx_dynamic_symtab (struct objfile *objfile)
{ {
arelent *rel = *relptr; arelent *rel = *relptr;
CORE_ADDR address = CORE_ADDR address =
rel->address + ANOFFSET (objfile->section_offsets, rel->address + ANOFFSET (objfile->section_offsets,
SECT_OFF_DATA (objfile)); SECT_OFF_DATA (objfile));
switch (bfd_get_arch (abfd)) switch (bfd_get_arch (abfd))
{ {
@ -1554,6 +1557,7 @@ read_dbx_symtab (struct objfile *objfile)
case N_BINCL: case N_BINCL:
{ {
enum language tmp_language; enum language tmp_language;
/* Add this bincl to the bincl_list for future EXCLs. No /* Add this bincl to the bincl_list for future EXCLs. No
need to save the string; it'll be around until need to save the string; it'll be around until
read_dbx_symtab function returns */ read_dbx_symtab function returns */
@ -1590,8 +1594,8 @@ pos %d"),
case N_SOL: case N_SOL:
{ {
enum language tmp_language; enum language tmp_language;
/* Mark down an include file in the current psymtab */
/* Mark down an include file in the current psymtab */
namestring = set_namestring (objfile, &nlist); namestring = set_namestring (objfile, &nlist);
tmp_language = deduce_language_from_filename (namestring); tmp_language = deduce_language_from_filename (namestring);
@ -1618,6 +1622,7 @@ pos %d"),
continue; continue;
{ {
int i; int i;
for (i = 0; i < includes_used; i++) for (i = 0; i < includes_used; i++)
if (strcmp (namestring, psymtab_include_list[i]) == 0) if (strcmp (namestring, psymtab_include_list[i]) == 0)
{ {
@ -1688,6 +1693,7 @@ pos %d"),
{ {
char *new_name, *name = xmalloc (p - namestring + 1); char *new_name, *name = xmalloc (p - namestring + 1);
memcpy (name, namestring, p - namestring); memcpy (name, namestring, p - namestring);
name[p - namestring] = '\0'; name[p - namestring] = '\0';
new_name = cp_canonicalize_string (name); new_name = cp_canonicalize_string (name);
if (new_name != NULL) if (new_name != NULL)
@ -1865,6 +1871,7 @@ pos %d"),
{ {
int name_len = p - namestring; int name_len = p - namestring;
char *name = xmalloc (name_len + 1); char *name = xmalloc (name_len + 1);
memcpy (name, namestring, name_len); memcpy (name, namestring, name_len);
name[name_len] = '\0'; name[name_len] = '\0';
function_outside_compilation_unit_complaint (name); function_outside_compilation_unit_complaint (name);
@ -1884,6 +1891,7 @@ pos %d"),
find_stab_function_addr (namestring, find_stab_function_addr (namestring,
pst ? pst->filename : NULL, pst ? pst->filename : NULL,
objfile); objfile);
/* find_stab_function_addr will return 0 if the minimal /* find_stab_function_addr will return 0 if the minimal
symbol wasn't found. (Unfortunately, this might also symbol wasn't found. (Unfortunately, this might also
be a valid address.) Anyway, if it *does* return 0, be a valid address.) Anyway, if it *does* return 0,
@ -1933,6 +1941,7 @@ pos %d"),
{ {
int name_len = p - namestring; int name_len = p - namestring;
char *name = xmalloc (name_len + 1); char *name = xmalloc (name_len + 1);
memcpy (name, namestring, name_len); memcpy (name, namestring, name_len);
name[name_len] = '\0'; name[name_len] = '\0';
function_outside_compilation_unit_complaint (name); function_outside_compilation_unit_complaint (name);
@ -1952,6 +1961,7 @@ pos %d"),
find_stab_function_addr (namestring, find_stab_function_addr (namestring,
pst ? pst->filename : NULL, pst ? pst->filename : NULL,
objfile); objfile);
/* find_stab_function_addr will return 0 if the minimal /* find_stab_function_addr will return 0 if the minimal
symbol wasn't found. (Unfortunately, this might also symbol wasn't found. (Unfortunately, this might also
be a valid address.) Anyway, if it *does* return 0, be a valid address.) Anyway, if it *does* return 0,
@ -2074,6 +2084,7 @@ pos %d"),
if (dependencies_used >= dependencies_allocated) if (dependencies_used >= dependencies_allocated)
{ {
struct partial_symtab **orig = dependency_list; struct partial_symtab **orig = dependency_list;
dependency_list = dependency_list =
(struct partial_symtab **) (struct partial_symtab **)
alloca ((dependencies_allocated *= 2) alloca ((dependencies_allocated *= 2)
@ -2186,8 +2197,8 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
struct partial_symbol **static_syms) struct partial_symbol **static_syms)
{ {
struct partial_symtab *result = struct partial_symtab *result =
start_psymtab_common (objfile, objfile->section_offsets, start_psymtab_common (objfile, objfile->section_offsets,
filename, textlow, global_syms, static_syms); filename, textlow, global_syms, static_syms);
result->read_symtab_private = obstack_alloc (&objfile->objfile_obstack, result->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc)); sizeof (struct symloc));
@ -2329,7 +2340,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
for (i = 0; i < num_includes; i++) for (i = 0; i < num_includes; i++)
{ {
struct partial_symtab *subpst = struct partial_symtab *subpst =
allocate_psymtab (include_list[i], objfile); allocate_psymtab (include_list[i], objfile);
/* Copy the sesction_offsets array from the main psymtab. */ /* Copy the sesction_offsets array from the main psymtab. */
subpst->section_offsets = pst->section_offsets; subpst->section_offsets = pst->section_offsets;
@ -2476,6 +2487,7 @@ Shouldn't happen.\n",
= symfile_relocate_debug_section (pst->objfile, = symfile_relocate_debug_section (pst->objfile,
DBX_STAB_SECTION (pst->objfile), DBX_STAB_SECTION (pst->objfile),
NULL); NULL);
if (stabs_data) if (stabs_data)
back_to = make_cleanup (free_current_contents, back_to = make_cleanup (free_current_contents,
(void *) &stabs_data); (void *) &stabs_data);
@ -2658,8 +2670,7 @@ read_ofile_symtab (struct partial_symtab *pst)
#endif #endif
} }
else if (type & N_EXT || type == (unsigned char) N_TEXT else if (type & N_EXT || type == (unsigned char) N_TEXT
|| type == (unsigned char) N_NBTEXT || type == (unsigned char) N_NBTEXT)
)
{ {
/* Global symbol: see if we came across a dbx defintion for /* Global symbol: see if we came across a dbx defintion for
a corresponding symbol. If so, store the value. Remove a corresponding symbol. If so, store the value. Remove
@ -2787,6 +2798,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
if (sline_found_in_function) if (sline_found_in_function)
{ {
CORE_ADDR addr = last_function_start + valu; CORE_ADDR addr = last_function_start + valu;
record_line (current_subfile, 0, record_line (current_subfile, 0,
gdbarch_addr_bits_remove (gdbarch, addr)); gdbarch_addr_bits_remove (gdbarch, addr));
} }
@ -3007,6 +3019,7 @@ no enclosing block"));
{ {
CORE_ADDR addr = processing_gcc_compilation == 2 ? CORE_ADDR addr = processing_gcc_compilation == 2 ?
last_function_start : valu; last_function_start : valu;
record_line (current_subfile, desc, record_line (current_subfile, desc,
gdbarch_addr_bits_remove (gdbarch, addr)); gdbarch_addr_bits_remove (gdbarch, addr));
sline_found_in_function = 1; sline_found_in_function = 1;
@ -3141,6 +3154,7 @@ no enclosing block"));
{ {
int deftype; int deftype;
char *colon_pos = strchr (name, ':'); char *colon_pos = strchr (name, ':');
if (colon_pos == NULL) if (colon_pos == NULL)
deftype = '\0'; deftype = '\0';
else else

View file

@ -473,6 +473,7 @@ dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
int i; int i;
int res; int res;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr); int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
xfunc = should_write ? dcache_poke_byte : dcache_peek_byte; xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
/* If this is a different inferior from what we've recorded, /* If this is a different inferior from what we've recorded,
@ -532,6 +533,7 @@ void
dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len) dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
dcache_poke_byte (dcache, memaddr + i, myaddr + i); dcache_poke_byte (dcache, memaddr + i, myaddr + i);
} }
@ -589,6 +591,7 @@ dcache_info (char *exp, int tty)
if (exp) if (exp)
{ {
char *linestart; char *linestart;
i = strtol (exp, &linestart, 10); i = strtol (exp, &linestart, 10);
if (linestart == exp || i < 0) if (linestart == exp || i < 0)
{ {

View file

@ -64,6 +64,7 @@ static void
dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
{ {
struct gdbarch *gdbarch = info->application_data; struct gdbarch *gdbarch = info->application_data;
print_address (gdbarch, addr, info->stream); print_address (gdbarch, addr, info->stream);
} }
@ -142,6 +143,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout,
CORE_ADDR old_pc = pc; CORE_ADDR old_pc = pc;
bfd_byte data; bfd_byte data;
int status; int status;
pc += gdbarch_print_insn (gdbarch, pc, di); pc += gdbarch_print_insn (gdbarch, pc, di);
for (;old_pc < pc; old_pc++) for (;old_pc < pc; old_pc++)
{ {
@ -338,6 +340,7 @@ static int ATTRIBUTE_PRINTF (2, 3)
fprintf_disasm (void *stream, const char *format, ...) fprintf_disasm (void *stream, const char *format, ...)
{ {
va_list args; va_list args;
va_start (args, format); va_start (args, format);
vfprintf_filtered (stream, format, args); vfprintf_filtered (stream, format, args);
va_end (args); va_end (args);
@ -349,6 +352,7 @@ static struct disassemble_info
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
{ {
struct disassemble_info di; struct disassemble_info di;
init_disassemble_info (&di, file, fprintf_disasm); init_disassemble_info (&di, file, fprintf_disasm);
di.flavour = bfd_target_unknown_flavour; di.flavour = bfd_target_unknown_flavour;
di.memory_error_func = dis_asm_memory_error; di.memory_error_func = dis_asm_memory_error;

View file

@ -66,6 +66,7 @@ get_field (const bfd_byte *data, enum floatformat_byteorders order,
represents the number of bits from the end of our starting represents the number of bits from the end of our starting
byte needed to get to bit 0. */ byte needed to get to bit 0. */
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT); int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- ((start + len + excess) / FLOATFORMAT_CHAR_BIT); - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT) cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT)
@ -190,6 +191,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
if (kind == float_infinite || kind == float_nan) if (kind == float_infinite || kind == float_nan)
{ {
double dto; double dto;
floatformat_to_double (fmt, from, &dto); floatformat_to_double (fmt, from, &dto);
*to = (DOUBLEST) dto; *to = (DOUBLEST) dto;
return; return;
@ -203,6 +205,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
if (fmt->split_half) if (fmt->split_half)
{ {
DOUBLEST dtop, dbot; DOUBLEST dtop, dbot;
floatformat_to_doublest (fmt->split_half, ufrom, &dtop); floatformat_to_doublest (fmt->split_half, ufrom, &dtop);
/* Preserve the sign of 0, which is the sign of the top /* Preserve the sign of 0, which is the sign of the top
half. */ half. */
@ -292,6 +295,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
if (order == floatformat_little) if (order == floatformat_little)
{ {
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT); int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- ((start + len + excess) / FLOATFORMAT_CHAR_BIT); - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT) cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT)
@ -418,6 +422,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
the result of converting to double. */ the result of converting to double. */
static volatile double dtop, dbot; static volatile double dtop, dbot;
DOUBLEST dtopnv, dbotnv; DOUBLEST dtopnv, dbotnv;
dtop = (double) dfrom; dtop = (double) dfrom;
/* If the rounded top half is Inf, the bottom must be 0 not NaN /* If the rounded top half is Inf, the bottom must be 0 not NaN
or Inf. */ or Inf. */
@ -479,6 +484,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
while (mant_bits_left > 0) while (mant_bits_left > 0)
{ {
unsigned long mant_long; unsigned long mant_long;
mant_bits = mant_bits_left < 32 ? mant_bits_left : 32; mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
mant *= 4294967296.0; mant *= 4294967296.0;
@ -703,18 +709,21 @@ floatformat_to_doublest (const struct floatformat *fmt,
if (fmt == host_float_format) if (fmt == host_float_format)
{ {
float val; float val;
memcpy (&val, in, sizeof (val)); memcpy (&val, in, sizeof (val));
*out = val; *out = val;
} }
else if (fmt == host_double_format) else if (fmt == host_double_format)
{ {
double val; double val;
memcpy (&val, in, sizeof (val)); memcpy (&val, in, sizeof (val));
*out = val; *out = val;
} }
else if (fmt == host_long_double_format) else if (fmt == host_long_double_format)
{ {
long double val; long double val;
memcpy (&val, in, sizeof (val)); memcpy (&val, in, sizeof (val));
*out = val; *out = val;
} }
@ -730,16 +739,19 @@ floatformat_from_doublest (const struct floatformat *fmt,
if (fmt == host_float_format) if (fmt == host_float_format)
{ {
float val = *in; float val = *in;
memcpy (out, &val, sizeof (val)); memcpy (out, &val, sizeof (val));
} }
else if (fmt == host_double_format) else if (fmt == host_double_format)
{ {
double val = *in; double val = *in;
memcpy (out, &val, sizeof (val)); memcpy (out, &val, sizeof (val));
} }
else if (fmt == host_long_double_format) else if (fmt == host_long_double_format)
{ {
long double val = *in; long double val = *in;
memcpy (out, &val, sizeof (val)); memcpy (out, &val, sizeof (val));
} }
else else
@ -764,6 +776,7 @@ static const struct floatformat *
floatformat_from_length (struct gdbarch *gdbarch, int len) floatformat_from_length (struct gdbarch *gdbarch, int len)
{ {
const struct floatformat *format; const struct floatformat *format;
if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch)) if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
format = gdbarch_float_format (gdbarch) format = gdbarch_float_format (gdbarch)
[gdbarch_byte_order (gdbarch)]; [gdbarch_byte_order (gdbarch)];
@ -794,6 +807,7 @@ const struct floatformat *
floatformat_from_type (const struct type *type) floatformat_from_type (const struct type *type)
{ {
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL) if (TYPE_FLOATFORMAT (type) != NULL)
return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)]; return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];

View file

@ -90,6 +90,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
if (s->flags & SEC_LOAD) if (s->flags & SEC_LOAD)
{ {
int numbytes; int numbytes;
bfd_vma addr = bfd_get_section_vma (abfd, s) + load_offset; bfd_vma addr = bfd_get_section_vma (abfd, s) + load_offset;
bfd_size_type size = bfd_get_section_size (s); bfd_size_type size = bfd_get_section_size (s);
char *section_name = (char *) bfd_get_section_name (abfd, s); char *section_name = (char *) bfd_get_section_name (abfd, s);

View file

@ -69,6 +69,7 @@ int
deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc) deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
struct dummy_frame *dummyframe; struct dummy_frame *dummyframe;
for (dummyframe = dummy_frame_stack; for (dummyframe = dummy_frame_stack;
dummyframe != NULL; dummyframe != NULL;
dummyframe = dummyframe->next) dummyframe = dummyframe->next)
@ -217,6 +218,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
if (frame_id_eq (dummyframe->id, this_id)) if (frame_id_eq (dummyframe->id, this_id))
{ {
struct dummy_frame_cache *cache; struct dummy_frame_cache *cache;
cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache); cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
cache->prev_regcache = get_inferior_thread_state_regcache (dummyframe->caller_state); cache->prev_regcache = get_inferior_thread_state_regcache (dummyframe->caller_state);
cache->this_id = this_id; cache->this_id = this_id;
@ -267,6 +269,7 @@ dummy_frame_this_id (struct frame_info *this_frame,
{ {
/* The dummy-frame sniffer always fills in the cache. */ /* The dummy-frame sniffer always fills in the cache. */
struct dummy_frame_cache *cache = (*this_prologue_cache); struct dummy_frame_cache *cache = (*this_prologue_cache);
gdb_assert (cache != NULL); gdb_assert (cache != NULL);
(*this_id) = cache->this_id; (*this_id) = cache->this_id;
} }
@ -288,6 +291,7 @@ static void
fprint_dummy_frames (struct ui_file *file) fprint_dummy_frames (struct ui_file *file)
{ {
struct dummy_frame *s; struct dummy_frame *s;
for (s = dummy_frame_stack; s != NULL; s = s->next) for (s = dummy_frame_stack; s != NULL; s = s->next)
{ {
gdb_print_host_address (s, file); gdb_print_host_address (s, file);
@ -307,6 +311,7 @@ maintenance_print_dummy_frames (char *args, int from_tty)
{ {
struct cleanup *cleanups; struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w"); struct ui_file *file = gdb_fopen (args, "w");
if (file == NULL) if (file == NULL)
perror_with_name (_("maintenance print dummy-frames")); perror_with_name (_("maintenance print dummy-frames"));
cleanups = make_cleanup_ui_file_delete (file); cleanups = make_cleanup_ui_file_delete (file);

View file

@ -647,6 +647,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
unwinder. */ unwinder. */
{ {
int size = register_size (gdbarch, 0); int size = register_size (gdbarch, 0);
dwarf2_frame_state_alloc_regs (&fs->regs, 32); dwarf2_frame_state_alloc_regs (&fs->regs, 32);
for (reg = 8; reg < 16; reg++) for (reg = 8; reg < 16; reg++)
{ {
@ -1186,6 +1187,7 @@ dwarf2_frame_sniffer (const struct frame_unwind *self,
select the FDE of the previous function. */ select the FDE of the previous function. */
CORE_ADDR block_addr = get_frame_address_in_block (this_frame); CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
struct dwarf2_fde *fde = dwarf2_frame_find_fde (&block_addr); struct dwarf2_fde *fde = dwarf2_frame_find_fde (&block_addr);
if (!fde) if (!fde)
return 0; return 0;
@ -1256,6 +1258,7 @@ const struct frame_base *
dwarf2_frame_base_sniffer (struct frame_info *this_frame) dwarf2_frame_base_sniffer (struct frame_info *this_frame)
{ {
CORE_ADDR block_addr = get_frame_address_in_block (this_frame); CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
if (dwarf2_frame_find_fde (&block_addr)) if (dwarf2_frame_find_fde (&block_addr))
return &dwarf2_frame_base; return &dwarf2_frame_base;
@ -1466,6 +1469,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
{ {
ULONGEST value; ULONGEST value;
gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
*bytes_read_ptr += read_uleb128 (buf, end_buf, &value) - buf; *bytes_read_ptr += read_uleb128 (buf, end_buf, &value) - buf;
return base + value; return base + value;
} }
@ -1482,6 +1486,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
{ {
LONGEST value; LONGEST value;
gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
*bytes_read_ptr += read_sleb128 (buf, end_buf, &value) - buf; *bytes_read_ptr += read_sleb128 (buf, end_buf, &value) - buf;
return base + value; return base + value;
} }
@ -1553,6 +1558,7 @@ bsearch_fde_cmp (const void *key, const void *element)
{ {
CORE_ADDR seek_pc = *(CORE_ADDR *) key; CORE_ADDR seek_pc = *(CORE_ADDR *) key;
struct dwarf2_fde *fde = *(struct dwarf2_fde **) element; struct dwarf2_fde *fde = *(struct dwarf2_fde **) element;
if (seek_pc < fde->initial_location) if (seek_pc < fde->initial_location)
return -1; return -1;
if (seek_pc < fde->initial_location + fde->address_range) if (seek_pc < fde->initial_location + fde->address_range)

View file

@ -41,6 +41,7 @@ struct dwarf_expr_context *
new_dwarf_expr_context (void) new_dwarf_expr_context (void)
{ {
struct dwarf_expr_context *retval; struct dwarf_expr_context *retval;
retval = xcalloc (1, sizeof (struct dwarf_expr_context)); retval = xcalloc (1, sizeof (struct dwarf_expr_context));
retval->stack_len = 0; retval->stack_len = 0;
retval->stack_allocated = 10; retval->stack_allocated = 10;
@ -87,6 +88,7 @@ dwarf_expr_grow_stack (struct dwarf_expr_context *ctx, size_t need)
if (ctx->stack_len + need > ctx->stack_allocated) if (ctx->stack_len + need > ctx->stack_allocated)
{ {
size_t newlen = ctx->stack_len + need + 10; size_t newlen = ctx->stack_len + need + 10;
ctx->stack = xrealloc (ctx->stack, ctx->stack = xrealloc (ctx->stack,
newlen * sizeof (struct dwarf_stack_value)); newlen * sizeof (struct dwarf_stack_value));
ctx->stack_allocated = newlen; ctx->stack_allocated = newlen;
@ -337,6 +339,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
gdb_byte *op_ptr, gdb_byte *op_end) gdb_byte *op_ptr, gdb_byte *op_end)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch);
ctx->location = DWARF_VALUE_MEMORY; ctx->location = DWARF_VALUE_MEMORY;
ctx->initialized = 1; /* Default is initialized. */ ctx->initialized = 1; /* Default is initialized. */
@ -498,6 +501,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_implicit_value: case DW_OP_implicit_value:
{ {
ULONGEST len; ULONGEST len;
op_ptr = read_uleb128 (op_ptr, op_end, &len); op_ptr = read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end) if (op_ptr + len > op_end)
error (_("DW_OP_implicit_value: too few bytes available.")); error (_("DW_OP_implicit_value: too few bytes available."));
@ -655,6 +659,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_deref: case DW_OP_deref:
{ {
gdb_byte *buf = alloca (ctx->addr_size); gdb_byte *buf = alloca (ctx->addr_size);
(ctx->read_mem) (ctx->baton, buf, result, ctx->addr_size); (ctx->read_mem) (ctx->baton, buf, result, ctx->addr_size);
result = dwarf2_read_address (ctx->gdbarch, result = dwarf2_read_address (ctx->gdbarch,
buf, buf + ctx->addr_size, buf, buf + ctx->addr_size,
@ -666,6 +671,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
{ {
int addr_size = *op_ptr++; int addr_size = *op_ptr++;
gdb_byte *buf = alloca (addr_size); gdb_byte *buf = alloca (addr_size);
(ctx->read_mem) (ctx->baton, buf, result, addr_size); (ctx->read_mem) (ctx->baton, buf, result, addr_size);
result = dwarf2_read_address (ctx->gdbarch, result = dwarf2_read_address (ctx->gdbarch,
buf, buf + addr_size, buf, buf + addr_size,

View file

@ -192,6 +192,7 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
else else
{ {
struct dwarf2_locexpr_baton *symbaton; struct dwarf2_locexpr_baton *symbaton;
symbaton = SYMBOL_LOCATION_BATON (framefunc); symbaton = SYMBOL_LOCATION_BATON (framefunc);
if (symbaton != NULL) if (symbaton != NULL)
{ {
@ -214,6 +215,7 @@ static CORE_ADDR
dwarf_expr_frame_cfa (void *baton) dwarf_expr_frame_cfa (void *baton)
{ {
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
return dwarf2_frame_cfa (debaton->frame); return dwarf2_frame_cfa (debaton->frame);
} }
@ -270,6 +272,7 @@ read_pieced_value (struct value *v)
for (i = 0; i < c->n_pieces; i++) for (i = 0; i < c->n_pieces; i++)
{ {
struct dwarf_expr_piece *p = &c->pieces[i]; struct dwarf_expr_piece *p = &c->pieces[i];
switch (p->location) switch (p->location)
{ {
case DWARF_VALUE_REGISTER: case DWARF_VALUE_REGISTER:
@ -308,6 +311,7 @@ read_pieced_value (struct value *v)
{ {
struct gdbarch *gdbarch = get_type_arch (value_type (v)); struct gdbarch *gdbarch = get_type_arch (value_type (v));
size_t n = p->size; size_t n = p->size;
if (n > c->addr_size) if (n > c->addr_size)
n = c->addr_size; n = c->addr_size;
store_unsigned_integer (contents + offset, n, store_unsigned_integer (contents + offset, n,
@ -319,6 +323,7 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_LITERAL: case DWARF_VALUE_LITERAL:
{ {
size_t n = p->size; size_t n = p->size;
if (n > p->v.literal.length) if (n > p->v.literal.length)
n = p->v.literal.length; n = p->v.literal.length;
memcpy (contents + offset, p->v.literal.data, n); memcpy (contents + offset, p->v.literal.data, n);
@ -351,6 +356,7 @@ write_pieced_value (struct value *to, struct value *from)
for (i = 0; i < c->n_pieces; i++) for (i = 0; i < c->n_pieces; i++)
{ {
struct dwarf_expr_piece *p = &c->pieces[i]; struct dwarf_expr_piece *p = &c->pieces[i];
switch (p->location) switch (p->location)
{ {
case DWARF_VALUE_REGISTER: case DWARF_VALUE_REGISTER:
@ -469,6 +475,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
struct gdbarch *arch = get_frame_arch (frame); struct gdbarch *arch = get_frame_arch (frame);
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0); CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum); int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
if (gdb_regnum != -1) if (gdb_regnum != -1)
retval = value_from_register (type, gdb_regnum, frame); retval = value_from_register (type, gdb_regnum, frame);
else else
@ -544,6 +551,7 @@ static CORE_ADDR
needs_frame_read_reg (void *baton, int regnum) needs_frame_read_reg (void *baton, int regnum)
{ {
struct needs_frame_baton *nf_baton = baton; struct needs_frame_baton *nf_baton = baton;
nf_baton->needs_frame = 1; nf_baton->needs_frame = 1;
return 1; return 1;
} }
@ -574,6 +582,7 @@ static CORE_ADDR
needs_frame_frame_cfa (void *baton) needs_frame_frame_cfa (void *baton)
{ {
struct needs_frame_baton *nf_baton = baton; struct needs_frame_baton *nf_baton = baton;
nf_baton->needs_frame = 1; nf_baton->needs_frame = 1;
return 1; return 1;
} }
@ -583,6 +592,7 @@ static CORE_ADDR
needs_frame_tls_address (void *baton, CORE_ADDR offset) needs_frame_tls_address (void *baton, CORE_ADDR offset)
{ {
struct needs_frame_baton *nf_baton = baton; struct needs_frame_baton *nf_baton = baton;
nf_baton->needs_frame = 1; nf_baton->needs_frame = 1;
return 1; return 1;
} }
@ -671,6 +681,7 @@ dwarf2_tracepoint_var_loc (struct symbol *symbol,
else if (data[0] == DW_OP_regx) else if (data[0] == DW_OP_regx)
{ {
ULONGEST reg; ULONGEST reg;
data = read_uleb128 (data + 1, end, &reg); data = read_uleb128 (data + 1, end, &reg);
loc->kind = axs_lvalue_register; loc->kind = axs_lvalue_register;
loc->reg = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg); loc->reg = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg);
@ -902,6 +913,7 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
{ {
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
struct value *val; struct value *val;
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data, val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
dlbaton->size, dlbaton->per_cu); dlbaton->size, dlbaton->per_cu);
@ -913,6 +925,7 @@ static int
locexpr_read_needs_frame (struct symbol *symbol) locexpr_read_needs_frame (struct symbol *symbol)
{ {
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size, return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
dlbaton->per_cu); dlbaton->per_cu);
} }
@ -1037,6 +1050,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
data + 1, data + 1,
data + size - 1, data + size - 1,
addr_size); addr_size);
fprintf_filtered (stream, fprintf_filtered (stream,
_("a thread-local variable at offset %s " _("a thread-local variable at offset %s "
"in the thread-local storage for `%s'"), "in the thread-local storage for `%s'"),

View file

@ -1133,6 +1133,7 @@ dwarf2_has_info (struct objfile *objfile)
/* Initialize per-objfile state. */ /* Initialize per-objfile state. */
struct dwarf2_per_objfile *data struct dwarf2_per_objfile *data
= obstack_alloc (&objfile->objfile_obstack, sizeof (*data)); = obstack_alloc (&objfile->objfile_obstack, sizeof (*data));
memset (data, 0, sizeof (*data)); memset (data, 0, sizeof (*data));
set_objfile_data (objfile, dwarf2_objfile_data_key, data); set_objfile_data (objfile, dwarf2_objfile_data_key, data);
dwarf2_per_objfile = data; dwarf2_per_objfile = data;
@ -1201,6 +1202,7 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
else if (section_is_p (sectp->name, EH_FRAME_SECTION)) else if (section_is_p (sectp->name, EH_FRAME_SECTION))
{ {
flagword aflag = bfd_get_section_flags (ignore_abfd, sectp); flagword aflag = bfd_get_section_flags (ignore_abfd, sectp);
if (aflag & SEC_HAS_CONTENTS) if (aflag & SEC_HAS_CONTENTS)
{ {
dwarf2_per_objfile->eh_frame.asection = sectp; dwarf2_per_objfile->eh_frame.asection = sectp;
@ -1443,6 +1445,7 @@ offset_in_cu_p (const struct comp_unit_head *cu_header, unsigned int offset)
unsigned int top = (cu_header->offset unsigned int top = (cu_header->offset
+ cu_header->length + cu_header->length
+ cu_header->initial_length_size); + cu_header->initial_length_size);
return (offset >= bottom && offset < top); return (offset >= bottom && offset < top);
} }
@ -1584,6 +1587,7 @@ dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
if (attr) if (attr)
{ {
unsigned int line_offset = DW_UNSND (attr); unsigned int line_offset = DW_UNSND (attr);
lh = dwarf_decode_line_header (line_offset, abfd, cu); lh = dwarf_decode_line_header (line_offset, abfd, cu);
} }
if (lh == NULL) if (lh == NULL)
@ -1598,6 +1602,7 @@ static hashval_t
hash_type_signature (const void *item) hash_type_signature (const void *item)
{ {
const struct signatured_type *type_sig = item; const struct signatured_type *type_sig = item;
/* This drops the top 32 bits of the signature, but is ok for a hash. */ /* This drops the top 32 bits of the signature, but is ok for a hash. */
return type_sig->signature; return type_sig->signature;
} }
@ -1607,6 +1612,7 @@ eq_type_signature (const void *item_lhs, const void *item_rhs)
{ {
const struct signatured_type *lhs = item_lhs; const struct signatured_type *lhs = item_lhs;
const struct signatured_type *rhs = item_rhs; const struct signatured_type *rhs = item_rhs;
return lhs->signature == rhs->signature; return lhs->signature == rhs->signature;
} }
@ -2881,6 +2887,7 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
struct dwarf2_per_objfile *dpo_backlink struct dwarf2_per_objfile *dpo_backlink
= objfile_data (pst->objfile->separate_debug_objfile_backlink, = objfile_data (pst->objfile->separate_debug_objfile_backlink,
dwarf2_objfile_data_key); dwarf2_objfile_data_key);
dwarf2_per_objfile->has_section_at_zero dwarf2_per_objfile->has_section_at_zero
= dpo_backlink->has_section_at_zero; = dpo_backlink->has_section_at_zero;
} }
@ -3250,6 +3257,7 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (dwarf2_attr (die, DW_AT_specification, cu)) if (dwarf2_attr (die, DW_AT_specification, cu))
{ {
struct dwarf2_cu *spec_cu = cu; struct dwarf2_cu *spec_cu = cu;
return die_needs_namespace (die_specification (die, &spec_cu), return die_needs_namespace (die_specification (die, &spec_cu),
spec_cu); spec_cu);
} }
@ -3303,6 +3311,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
if (*prefix != '\0') if (*prefix != '\0')
{ {
char *prefixed_name = typename_concat (NULL, prefix, name, cu); char *prefixed_name = typename_concat (NULL, prefix, name, cu);
fputs_unfiltered (prefixed_name, buf); fputs_unfiltered (prefixed_name, buf);
xfree (prefixed_name); xfree (prefixed_name);
} }
@ -3346,6 +3355,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
char *cname char *cname
= dwarf2_canonicalize_name (name, cu, = dwarf2_canonicalize_name (name, cu,
&cu->objfile->objfile_obstack); &cu->objfile->objfile_obstack);
if (cname != NULL) if (cname != NULL)
name = cname; name = cname;
} }
@ -3623,6 +3633,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr && line_header) if (attr && line_header)
{ {
unsigned int macro_offset = DW_UNSND (attr); unsigned int macro_offset = DW_UNSND (attr);
dwarf_decode_macros (line_header, macro_offset, dwarf_decode_macros (line_header, macro_offset,
comp_dir, abfd, cu); comp_dir, abfd, cu);
} }
@ -3791,6 +3802,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
but GCC versions at least through 4.4 generate this (GCC PR but GCC versions at least through 4.4 generate this (GCC PR
40573). */ 40573). */
struct die_info *child_origin_die = child_die; struct die_info *child_origin_die = child_die;
while (1) while (1)
{ {
attr = dwarf2_attr (child_origin_die, DW_AT_abstract_origin, cu); attr = dwarf2_attr (child_origin_die, DW_AT_abstract_origin, cu);
@ -4341,10 +4353,12 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
if (attr) if (attr)
{ {
CORE_ADDR high = DW_ADDR (attr); CORE_ADDR high = DW_ADDR (attr);
attr = dwarf2_attr (die, DW_AT_low_pc, cu); attr = dwarf2_attr (die, DW_AT_low_pc, cu);
if (attr) if (attr)
{ {
CORE_ADDR low = DW_ADDR (attr); CORE_ADDR low = DW_ADDR (attr);
record_block_range (block, baseaddr + low, baseaddr + high - 1); record_block_range (block, baseaddr + low, baseaddr + high - 1);
} }
} }
@ -4882,6 +4896,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
&& DW_BLOCK (attr)->data[0] == DW_OP_deref) && DW_BLOCK (attr)->data[0] == DW_OP_deref)
{ {
struct dwarf_block blk; struct dwarf_block blk;
blk.size = DW_BLOCK (attr)->size - 1; blk.size = DW_BLOCK (attr)->size - 1;
blk.data = DW_BLOCK (attr)->data + 1; blk.data = DW_BLOCK (attr)->data + 1;
fnp->voffset = decode_locdesc (&blk, cu); fnp->voffset = decode_locdesc (&blk, cu);
@ -5042,6 +5057,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct dwarf2_cu *type_cu = cu; struct dwarf2_cu *type_cu = cu;
struct die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu); struct die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu);
/* We could just recurse on read_structure_type, but we need to call /* We could just recurse on read_structure_type, but we need to call
get_die_type to ensure only one type for this DIE is created. get_die_type to ensure only one type for this DIE is created.
This is important, for example, because for c++ classes we need This is important, for example, because for c++ classes we need
@ -5286,6 +5302,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct dwarf2_cu *type_cu = cu; struct dwarf2_cu *type_cu = cu;
struct die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu); struct die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu);
type = read_type_die (type_die, type_cu); type = read_type_die (type_die, type_cu);
return set_die_type (die, type, cu); return set_die_type (die, type, cu);
} }
@ -5430,6 +5447,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag == DW_TAG_subrange_type) if (child_die->tag == DW_TAG_subrange_type)
{ {
struct type *child_type = read_type_die (child_die, cu); struct type *child_type = read_type_die (child_die, cu);
if (child_type != NULL) if (child_type != NULL)
{ {
/* The range type was succesfully read. Save it for /* The range type was succesfully read. Save it for
@ -5456,6 +5474,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
if (read_array_order (die, cu) == DW_ORD_col_major) if (read_array_order (die, cu) == DW_ORD_col_major)
{ {
int i = 0; int i = 0;
while (i < ndim) while (i < ndim)
type = create_array_type (NULL, type, range_types[i++]); type = create_array_type (NULL, type, range_types[i++]);
} }
@ -5603,6 +5622,7 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct die_info *ext_die; struct die_info *ext_die;
struct dwarf2_cu *ext_cu = cu; struct dwarf2_cu *ext_cu = cu;
ext_die = dwarf2_extension (die, &ext_cu); ext_die = dwarf2_extension (die, &ext_cu);
type = read_type_die (ext_die, ext_cu); type = read_type_die (ext_die, ext_cu);
return set_die_type (die, type, cu); return set_die_type (die, type, cu);
@ -5650,6 +5670,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (is_anonymous) if (is_anonymous)
{ {
const char *previous_prefix = determine_prefix (die, cu); const char *previous_prefix = determine_prefix (die, cu);
cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL,
NULL, &objfile->objfile_obstack); NULL, &objfile->objfile_obstack);
} }
@ -5759,9 +5780,10 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
{ {
complaint (&symfile_complaints, _("invalid pointer size %d"), byte_size); complaint (&symfile_complaints, _("invalid pointer size %d"), byte_size);
} }
else { else
/* Should we also complain about unhandled address classes? */ {
} /* Should we also complain about unhandled address classes? */
}
} }
TYPE_LENGTH (type) = byte_size; TYPE_LENGTH (type) = byte_size;
@ -5972,6 +5994,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (cu->language == language_java) if (cu->language == language_java)
{ {
const char *name = dwarf2_name (child_die, cu); const char *name = dwarf2_name (child_die, cu);
if (name && !strcmp (name, "this")) if (name && !strcmp (name, "this"))
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 1; TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 1;
} }
@ -6195,6 +6218,7 @@ static hashval_t
die_hash (const void *item) die_hash (const void *item)
{ {
const struct die_info *die = item; const struct die_info *die = item;
return die->offset; return die->offset;
} }
@ -6206,6 +6230,7 @@ die_eq (const void *item_lhs, const void *item_rhs)
{ {
const struct die_info *die_lhs = item_lhs; const struct die_info *die_lhs = item_lhs;
const struct die_info *die_rhs = item_rhs; const struct die_info *die_rhs = item_rhs;
return die_lhs->offset == die_rhs->offset; return die_lhs->offset == die_rhs->offset;
} }
@ -7430,6 +7455,7 @@ read_offset (bfd *abfd, gdb_byte *buf, const struct comp_unit_head *cu_header,
unsigned int *bytes_read) unsigned int *bytes_read)
{ {
LONGEST offset = read_offset_1 (abfd, buf, cu_header->offset_size); LONGEST offset = read_offset_1 (abfd, buf, cu_header->offset_size);
*bytes_read = cu_header->offset_size; *bytes_read = cu_header->offset_size;
return offset; return offset;
} }
@ -8312,6 +8338,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
for (i = 0; i < lh->num_file_names; i++) for (i = 0; i < lh->num_file_names; i++)
{ {
char *dir = NULL; char *dir = NULL;
fe = &lh->file_names[i]; fe = &lh->file_names[i];
if (fe->dir_index) if (fe->dir_index)
dir = lh->include_dirs[fe->dir_index - 1]; dir = lh->include_dirs[fe->dir_index - 1];
@ -8493,6 +8520,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
if (attr) if (attr)
{ {
int file_index = DW_UNSND (attr); int file_index = DW_UNSND (attr);
if (cu->line_header == NULL if (cu->line_header == NULL
|| file_index > cu->line_header->num_file_names) || file_index > cu->line_header->num_file_names)
complaint (&symfile_complaints, complaint (&symfile_complaints,
@ -8500,6 +8528,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
else if (file_index > 0) else if (file_index > 0)
{ {
struct file_entry *fe; struct file_entry *fe;
fe = &cu->line_header->file_names[file_index - 1]; fe = &cu->line_header->file_names[file_index - 1];
SYMBOL_SYMTAB (sym) = fe->symtab; SYMBOL_SYMTAB (sym) = fe->symtab;
} }
@ -9168,6 +9197,7 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
if (obs == NULL) if (obs == NULL)
{ {
char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1); char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
strcpy (retval, prefix); strcpy (retval, prefix);
strcat (retval, sep); strcat (retval, sep);
strcat (retval, suffix); strcat (retval, suffix);
@ -10577,6 +10607,7 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr,
else if (! offset_in_cu_p (&cu->header, offset)) else if (! offset_in_cu_p (&cu->header, offset))
{ {
struct dwarf2_per_cu_data *per_cu; struct dwarf2_per_cu_data *per_cu;
per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile); per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
/* If necessary, add it to the queue and load its DIEs. */ /* If necessary, add it to the queue and load its DIEs. */
@ -11064,6 +11095,7 @@ file_full_name (int file, struct line_header *lh, const char *comp_dir)
record the macro definitions made in the file, even if we record the macro definitions made in the file, even if we
won't be able to find the file by name. */ won't be able to find the file by name. */
char fake_name[80]; char fake_name[80];
sprintf (fake_name, "<bad macro file number %d>", file); sprintf (fake_name, "<bad macro file number %d>", file);
complaint (&symfile_complaints, complaint (&symfile_complaints,
@ -11109,9 +11141,9 @@ static char *
copy_string (const char *buf, int len) copy_string (const char *buf, int len)
{ {
char *s = xmalloc (len + 1); char *s = xmalloc (len + 1);
memcpy (s, buf, len); memcpy (s, buf, len);
s[len] = '\0'; s[len] = '\0';
return s; return s;
} }
@ -11689,8 +11721,8 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
struct dwarf2_per_objfile *per_objfile struct dwarf2_per_objfile *per_objfile
= objfile_data (objfile, dwarf2_objfile_data_key); = objfile_data (objfile, dwarf2_objfile_data_key);
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset; gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
struct comp_unit_head cu_header; struct comp_unit_head cu_header;
memset (&cu_header, 0, sizeof cu_header); memset (&cu_header, 0, sizeof cu_header);
read_comp_unit_head (&cu_header, info_ptr, objfile->obfd); read_comp_unit_head (&cu_header, info_ptr, objfile->obfd);
return cu_header.addr_size; return cu_header.addr_size;
@ -11712,6 +11744,7 @@ dwarf2_find_containing_comp_unit (unsigned int offset,
while (high > low) while (high > low)
{ {
int mid = low + (high - low) / 2; int mid = low + (high - low) / 2;
if (dwarf2_per_objfile->all_comp_units[mid]->offset >= offset) if (dwarf2_per_objfile->all_comp_units[mid]->offset >= offset)
high = mid; high = mid;
else else
@ -11746,6 +11779,7 @@ static struct dwarf2_per_cu_data *
dwarf2_find_comp_unit (unsigned int offset, struct objfile *objfile) dwarf2_find_comp_unit (unsigned int offset, struct objfile *objfile)
{ {
struct dwarf2_per_cu_data *this_cu; struct dwarf2_per_cu_data *this_cu;
this_cu = dwarf2_find_containing_comp_unit (offset, objfile); this_cu = dwarf2_find_containing_comp_unit (offset, objfile);
if (this_cu->offset != offset) if (this_cu->offset != offset)
error (_("no compilation unit with offset %u."), offset); error (_("no compilation unit with offset %u."), offset);
@ -11931,6 +11965,7 @@ static hashval_t
offset_and_type_hash (const void *item) offset_and_type_hash (const void *item)
{ {
const struct dwarf2_offset_and_type *ofs = item; const struct dwarf2_offset_and_type *ofs = item;
return ofs->offset; return ofs->offset;
} }
@ -11941,6 +11976,7 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
{ {
const struct dwarf2_offset_and_type *ofs_lhs = item_lhs; const struct dwarf2_offset_and_type *ofs_lhs = item_lhs;
const struct dwarf2_offset_and_type *ofs_rhs = item_rhs; const struct dwarf2_offset_and_type *ofs_rhs = item_rhs;
return ofs_lhs->offset == ofs_rhs->offset; return ofs_lhs->offset == ofs_rhs->offset;
} }
@ -12078,6 +12114,7 @@ static hashval_t
partial_die_hash (const void *item) partial_die_hash (const void *item)
{ {
const struct partial_die_info *part_die = item; const struct partial_die_info *part_die = item;
return part_die->offset; return part_die->offset;
} }
@ -12089,6 +12126,7 @@ partial_die_eq (const void *item_lhs, const void *item_rhs)
{ {
const struct partial_die_info *part_die_lhs = item_lhs; const struct partial_die_info *part_die_lhs = item_lhs;
const struct partial_die_info *part_die_rhs = item_rhs; const struct partial_die_info *part_die_rhs = item_rhs;
return part_die_lhs->offset == part_die_rhs->offset; return part_die_lhs->offset == part_die_rhs->offset;
} }
@ -12118,6 +12156,7 @@ munmap_section_buffer (struct dwarf2_section_info *info)
intptr_t begin = (intptr_t) info->buffer; intptr_t begin = (intptr_t) info->buffer;
intptr_t map_begin = begin & ~(pagesize - 1); intptr_t map_begin = begin & ~(pagesize - 1);
size_t map_length = info->size + begin - map_begin; size_t map_length = info->size + begin - map_begin;
gdb_assert (munmap ((void *) map_begin, map_length) == 0); gdb_assert (munmap ((void *) map_begin, map_length) == 0);
#else #else
/* Without HAVE_MMAP, we should never be here to begin with. */ /* Without HAVE_MMAP, we should never be here to begin with. */
@ -12132,6 +12171,7 @@ static void
dwarf2_per_objfile_free (struct objfile *objfile, void *d) dwarf2_per_objfile_free (struct objfile *objfile, void *d)
{ {
struct dwarf2_per_objfile *data = d; struct dwarf2_per_objfile *data = d;
munmap_section_buffer (&data->info); munmap_section_buffer (&data->info);
munmap_section_buffer (&data->abbrev); munmap_section_buffer (&data->abbrev);
munmap_section_buffer (&data->line); munmap_section_buffer (&data->line);