aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-14 17:53:16 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-14 17:53:16 +0000
commit9a619af0d3152e742fbd290baeae96a32f0abf04 (patch)
tree6e52a14dd92f9b11874ecc3aa8d83f63f6d6699b
parent88d4aea7473bf93d98ba72a5f955f428cd365431 (diff)
downloadgdb-9a619af0d3152e742fbd290baeae96a32f0abf04.zip
gdb-9a619af0d3152e742fbd290baeae96a32f0abf04.tar.gz
gdb-9a619af0d3152e742fbd290baeae96a32f0abf04.tar.bz2
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.
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/dbxread.c30
-rw-r--r--gdb/dcache.c3
-rw-r--r--gdb/disasm.c4
-rw-r--r--gdb/doublest.c14
-rw-r--r--gdb/dsrec.c1
-rw-r--r--gdb/dummy-frame.c5
-rw-r--r--gdb/dwarf2-frame.c6
-rw-r--r--gdb/dwarf2expr.c6
-rw-r--r--gdb/dwarf2loc.c14
-rw-r--r--gdb/dwarf2read.c50
11 files changed, 133 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fe0581b..0c134ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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>
PR python/11482
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 447e64e..25bf07b 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -490,6 +490,7 @@ record_minimal_symbol (char *name, CORE_ADDR address, int type,
/* Same with virtual function tables, both global and static. */
{
char *tempstring = name;
+
if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
++tempstring;
if (is_vtable_name (tempstring))
@@ -810,6 +811,7 @@ fill_symbuf (bfd *sym_bfd)
if (symbuf_left <= 0)
{
file_ptr filepos = symbuf_sections->section->filepos;
+
if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
perror_with_name (bfd_get_filename (sym_bfd));
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)
{
int offset = next_bincl - bincl_list;
+
bincls_allocated *= 2;
bincl_list = (struct header_file_location *)
xrealloc ((char *) bincl_list,
@@ -1091,8 +1094,8 @@ read_dbx_dynamic_symtab (struct objfile *objfile)
{
arelent *rel = *relptr;
CORE_ADDR address =
- rel->address + ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
+ rel->address + ANOFFSET (objfile->section_offsets,
+ SECT_OFF_DATA (objfile));
switch (bfd_get_arch (abfd))
{
@@ -1554,6 +1557,7 @@ read_dbx_symtab (struct objfile *objfile)
case N_BINCL:
{
enum language tmp_language;
+
/* Add this bincl to the bincl_list for future EXCLs. No
need to save the string; it'll be around until
read_dbx_symtab function returns */
@@ -1590,8 +1594,8 @@ pos %d"),
case N_SOL:
{
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);
tmp_language = deduce_language_from_filename (namestring);
@@ -1618,6 +1622,7 @@ pos %d"),
continue;
{
int i;
+
for (i = 0; i < includes_used; i++)
if (strcmp (namestring, psymtab_include_list[i]) == 0)
{
@@ -1688,6 +1693,7 @@ pos %d"),
{
char *new_name, *name = xmalloc (p - namestring + 1);
memcpy (name, namestring, p - namestring);
+
name[p - namestring] = '\0';
new_name = cp_canonicalize_string (name);
if (new_name != NULL)
@@ -1865,6 +1871,7 @@ pos %d"),
{
int name_len = p - namestring;
char *name = xmalloc (name_len + 1);
+
memcpy (name, namestring, name_len);
name[name_len] = '\0';
function_outside_compilation_unit_complaint (name);
@@ -1884,6 +1891,7 @@ pos %d"),
find_stab_function_addr (namestring,
pst ? pst->filename : NULL,
objfile);
+
/* find_stab_function_addr will return 0 if the minimal
symbol wasn't found. (Unfortunately, this might also
be a valid address.) Anyway, if it *does* return 0,
@@ -1933,6 +1941,7 @@ pos %d"),
{
int name_len = p - namestring;
char *name = xmalloc (name_len + 1);
+
memcpy (name, namestring, name_len);
name[name_len] = '\0';
function_outside_compilation_unit_complaint (name);
@@ -1952,6 +1961,7 @@ pos %d"),
find_stab_function_addr (namestring,
pst ? pst->filename : NULL,
objfile);
+
/* find_stab_function_addr will return 0 if the minimal
symbol wasn't found. (Unfortunately, this might also
be a valid address.) Anyway, if it *does* return 0,
@@ -2074,6 +2084,7 @@ pos %d"),
if (dependencies_used >= dependencies_allocated)
{
struct partial_symtab **orig = dependency_list;
+
dependency_list =
(struct partial_symtab **)
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_symtab *result =
- start_psymtab_common (objfile, objfile->section_offsets,
- filename, textlow, global_syms, static_syms);
+ start_psymtab_common (objfile, objfile->section_offsets,
+ filename, textlow, global_syms, static_syms);
result->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
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++)
{
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. */
subpst->section_offsets = pst->section_offsets;
@@ -2476,6 +2487,7 @@ Shouldn't happen.\n",
= symfile_relocate_debug_section (pst->objfile,
DBX_STAB_SECTION (pst->objfile),
NULL);
+
if (stabs_data)
back_to = make_cleanup (free_current_contents,
(void *) &stabs_data);
@@ -2658,8 +2670,7 @@ read_ofile_symtab (struct partial_symtab *pst)
#endif
}
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
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)
{
CORE_ADDR addr = last_function_start + valu;
+
record_line (current_subfile, 0,
gdbarch_addr_bits_remove (gdbarch, addr));
}
@@ -3007,6 +3019,7 @@ no enclosing block"));
{
CORE_ADDR addr = processing_gcc_compilation == 2 ?
last_function_start : valu;
+
record_line (current_subfile, desc,
gdbarch_addr_bits_remove (gdbarch, addr));
sline_found_in_function = 1;
@@ -3141,6 +3154,7 @@ no enclosing block"));
{
int deftype;
char *colon_pos = strchr (name, ':');
+
if (colon_pos == NULL)
deftype = '\0';
else
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 40952d3..d684d74 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -473,6 +473,7 @@ dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
int i;
int res;
int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr);
+
xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
/* 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)
{
int i;
+
for (i = 0; i < len; i++)
dcache_poke_byte (dcache, memaddr + i, myaddr + i);
}
@@ -589,6 +591,7 @@ dcache_info (char *exp, int tty)
if (exp)
{
char *linestart;
+
i = strtol (exp, &linestart, 10);
if (linestart == exp || i < 0)
{
diff --git a/gdb/disasm.c b/gdb/disasm.c
index dd0f539..c51f0bf 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -64,6 +64,7 @@ static void
dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
{
struct gdbarch *gdbarch = info->application_data;
+
print_address (gdbarch, addr, info->stream);
}
@@ -142,6 +143,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout,
CORE_ADDR old_pc = pc;
bfd_byte data;
int status;
+
pc += gdbarch_print_insn (gdbarch, pc, di);
for (;old_pc < pc; old_pc++)
{
@@ -338,6 +340,7 @@ static int ATTRIBUTE_PRINTF (2, 3)
fprintf_disasm (void *stream, const char *format, ...)
{
va_list args;
+
va_start (args, format);
vfprintf_filtered (stream, format, args);
va_end (args);
@@ -349,6 +352,7 @@ static struct disassemble_info
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
{
struct disassemble_info di;
+
init_disassemble_info (&di, file, fprintf_disasm);
di.flavour = bfd_target_unknown_flavour;
di.memory_error_func = dis_asm_memory_error;
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 68533c0..0dc09ab 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -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
byte needed to get to bit 0. */
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
+
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- ((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)
{
double dto;
+
floatformat_to_double (fmt, from, &dto);
*to = (DOUBLEST) dto;
return;
@@ -203,6 +205,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
if (fmt->split_half)
{
DOUBLEST dtop, dbot;
+
floatformat_to_doublest (fmt->split_half, ufrom, &dtop);
/* Preserve the sign of 0, which is the sign of the top
half. */
@@ -292,6 +295,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
if (order == floatformat_little)
{
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
+
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- ((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. */
static volatile double dtop, dbot;
DOUBLEST dtopnv, dbotnv;
+
dtop = (double) dfrom;
/* If the rounded top half is Inf, the bottom must be 0 not NaN
or Inf. */
@@ -479,6 +484,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
while (mant_bits_left > 0)
{
unsigned long mant_long;
+
mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
mant *= 4294967296.0;
@@ -703,18 +709,21 @@ floatformat_to_doublest (const struct floatformat *fmt,
if (fmt == host_float_format)
{
float val;
+
memcpy (&val, in, sizeof (val));
*out = val;
}
else if (fmt == host_double_format)
{
double val;
+
memcpy (&val, in, sizeof (val));
*out = val;
}
else if (fmt == host_long_double_format)
{
long double val;
+
memcpy (&val, in, sizeof (val));
*out = val;
}
@@ -730,16 +739,19 @@ floatformat_from_doublest (const struct floatformat *fmt,
if (fmt == host_float_format)
{
float val = *in;
+
memcpy (out, &val, sizeof (val));
}
else if (fmt == host_double_format)
{
double val = *in;
+
memcpy (out, &val, sizeof (val));
}
else if (fmt == host_long_double_format)
{
long double val = *in;
+
memcpy (out, &val, sizeof (val));
}
else
@@ -764,6 +776,7 @@ static const struct floatformat *
floatformat_from_length (struct gdbarch *gdbarch, int len)
{
const struct floatformat *format;
+
if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
format = gdbarch_float_format (gdbarch)
[gdbarch_byte_order (gdbarch)];
@@ -794,6 +807,7 @@ const struct floatformat *
floatformat_from_type (const struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
+
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL)
return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 4d7586b..39d3f3c 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -90,6 +90,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
if (s->flags & SEC_LOAD)
{
int numbytes;
+
bfd_vma addr = bfd_get_section_vma (abfd, s) + load_offset;
bfd_size_type size = bfd_get_section_size (s);
char *section_name = (char *) bfd_get_section_name (abfd, s);
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index ceaa1b0..d6a7241 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -69,6 +69,7 @@ int
deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct dummy_frame *dummyframe;
+
for (dummyframe = dummy_frame_stack;
dummyframe != NULL;
dummyframe = dummyframe->next)
@@ -217,6 +218,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
if (frame_id_eq (dummyframe->id, this_id))
{
struct dummy_frame_cache *cache;
+
cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
cache->prev_regcache = get_inferior_thread_state_regcache (dummyframe->caller_state);
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. */
struct dummy_frame_cache *cache = (*this_prologue_cache);
+
gdb_assert (cache != NULL);
(*this_id) = cache->this_id;
}
@@ -288,6 +291,7 @@ static void
fprint_dummy_frames (struct ui_file *file)
{
struct dummy_frame *s;
+
for (s = dummy_frame_stack; s != NULL; s = s->next)
{
gdb_print_host_address (s, file);
@@ -307,6 +311,7 @@ maintenance_print_dummy_frames (char *args, int from_tty)
{
struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w");
+
if (file == NULL)
perror_with_name (_("maintenance print dummy-frames"));
cleanups = make_cleanup_ui_file_delete (file);
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 9624910..0dec2b6 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -647,6 +647,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
unwinder. */
{
int size = register_size (gdbarch, 0);
+
dwarf2_frame_state_alloc_regs (&fs->regs, 32);
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. */
CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
struct dwarf2_fde *fde = dwarf2_frame_find_fde (&block_addr);
+
if (!fde)
return 0;
@@ -1256,6 +1258,7 @@ const struct frame_base *
dwarf2_frame_base_sniffer (struct frame_info *this_frame)
{
CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
+
if (dwarf2_frame_find_fde (&block_addr))
return &dwarf2_frame_base;
@@ -1466,6 +1469,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
{
ULONGEST value;
gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
+
*bytes_read_ptr += read_uleb128 (buf, end_buf, &value) - buf;
return base + value;
}
@@ -1482,6 +1486,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
{
LONGEST value;
gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
+
*bytes_read_ptr += read_sleb128 (buf, end_buf, &value) - buf;
return base + value;
}
@@ -1553,6 +1558,7 @@ bsearch_fde_cmp (const void *key, const void *element)
{
CORE_ADDR seek_pc = *(CORE_ADDR *) key;
struct dwarf2_fde *fde = *(struct dwarf2_fde **) element;
+
if (seek_pc < fde->initial_location)
return -1;
if (seek_pc < fde->initial_location + fde->address_range)
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 9e5ce61..13d318e 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -41,6 +41,7 @@ struct dwarf_expr_context *
new_dwarf_expr_context (void)
{
struct dwarf_expr_context *retval;
+
retval = xcalloc (1, sizeof (struct dwarf_expr_context));
retval->stack_len = 0;
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)
{
size_t newlen = ctx->stack_len + need + 10;
+
ctx->stack = xrealloc (ctx->stack,
newlen * sizeof (struct dwarf_stack_value));
ctx->stack_allocated = newlen;
@@ -337,6 +339,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
gdb_byte *op_ptr, gdb_byte *op_end)
{
enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch);
+
ctx->location = DWARF_VALUE_MEMORY;
ctx->initialized = 1; /* Default is initialized. */
@@ -498,6 +501,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_implicit_value:
{
ULONGEST len;
+
op_ptr = read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end)
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:
{
gdb_byte *buf = alloca (ctx->addr_size);
+
(ctx->read_mem) (ctx->baton, buf, result, ctx->addr_size);
result = dwarf2_read_address (ctx->gdbarch,
buf, buf + ctx->addr_size,
@@ -666,6 +671,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
{
int addr_size = *op_ptr++;
gdb_byte *buf = alloca (addr_size);
+
(ctx->read_mem) (ctx->baton, buf, result, addr_size);
result = dwarf2_read_address (ctx->gdbarch,
buf, buf + addr_size,
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index a67e073..c137b97 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -192,6 +192,7 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
else
{
struct dwarf2_locexpr_baton *symbaton;
+
symbaton = SYMBOL_LOCATION_BATON (framefunc);
if (symbaton != NULL)
{
@@ -214,6 +215,7 @@ static CORE_ADDR
dwarf_expr_frame_cfa (void *baton)
{
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+
return dwarf2_frame_cfa (debaton->frame);
}
@@ -270,6 +272,7 @@ read_pieced_value (struct value *v)
for (i = 0; i < c->n_pieces; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
+
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -308,6 +311,7 @@ read_pieced_value (struct value *v)
{
struct gdbarch *gdbarch = get_type_arch (value_type (v));
size_t n = p->size;
+
if (n > c->addr_size)
n = c->addr_size;
store_unsigned_integer (contents + offset, n,
@@ -319,6 +323,7 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_LITERAL:
{
size_t n = p->size;
+
if (n > p->v.literal.length)
n = p->v.literal.length;
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++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
+
switch (p->location)
{
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);
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
+
if (gdb_regnum != -1)
retval = value_from_register (type, gdb_regnum, frame);
else
@@ -544,6 +551,7 @@ static CORE_ADDR
needs_frame_read_reg (void *baton, int regnum)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -574,6 +582,7 @@ static CORE_ADDR
needs_frame_frame_cfa (void *baton)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -583,6 +592,7 @@ static CORE_ADDR
needs_frame_tls_address (void *baton, CORE_ADDR offset)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -671,6 +681,7 @@ dwarf2_tracepoint_var_loc (struct symbol *symbol,
else if (data[0] == DW_OP_regx)
{
ULONGEST reg;
+
data = read_uleb128 (data + 1, end, &reg);
loc->kind = axs_lvalue_register;
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 value *val;
+
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
dlbaton->size, dlbaton->per_cu);
@@ -913,6 +925,7 @@ static int
locexpr_read_needs_frame (struct symbol *symbol)
{
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
dlbaton->per_cu);
}
@@ -1037,6 +1050,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
data + 1,
data + size - 1,
addr_size);
+
fprintf_filtered (stream,
_("a thread-local variable at offset %s "
"in the thread-local storage for `%s'"),
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 594a01a..2d69764 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1133,6 +1133,7 @@ dwarf2_has_info (struct objfile *objfile)
/* Initialize per-objfile state. */
struct dwarf2_per_objfile *data
= obstack_alloc (&objfile->objfile_obstack, sizeof (*data));
+
memset (data, 0, sizeof (*data));
set_objfile_data (objfile, dwarf2_objfile_data_key, 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))
{
flagword aflag = bfd_get_section_flags (ignore_abfd, sectp);
+
if (aflag & SEC_HAS_CONTENTS)
{
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
+ cu_header->length
+ cu_header->initial_length_size);
+
return (offset >= bottom && offset < top);
}
@@ -1584,6 +1587,7 @@ dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
if (attr)
{
unsigned int line_offset = DW_UNSND (attr);
+
lh = dwarf_decode_line_header (line_offset, abfd, cu);
}
if (lh == NULL)
@@ -1598,6 +1602,7 @@ static hashval_t
hash_type_signature (const void *item)
{
const struct signatured_type *type_sig = item;
+
/* This drops the top 32 bits of the signature, but is ok for a hash. */
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 *rhs = item_rhs;
+
return lhs->signature == rhs->signature;
}
@@ -2881,6 +2887,7 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
struct dwarf2_per_objfile *dpo_backlink
= objfile_data (pst->objfile->separate_debug_objfile_backlink,
dwarf2_objfile_data_key);
+
dwarf2_per_objfile->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))
{
struct dwarf2_cu *spec_cu = cu;
+
return die_needs_namespace (die_specification (die, &spec_cu),
spec_cu);
}
@@ -3303,6 +3311,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
if (*prefix != '\0')
{
char *prefixed_name = typename_concat (NULL, prefix, name, cu);
+
fputs_unfiltered (prefixed_name, buf);
xfree (prefixed_name);
}
@@ -3346,6 +3355,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
char *cname
= dwarf2_canonicalize_name (name, cu,
&cu->objfile->objfile_obstack);
+
if (cname != NULL)
name = cname;
}
@@ -3623,6 +3633,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr && line_header)
{
unsigned int macro_offset = DW_UNSND (attr);
+
dwarf_decode_macros (line_header, macro_offset,
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
40573). */
struct die_info *child_origin_die = child_die;
+
while (1)
{
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)
{
CORE_ADDR high = DW_ADDR (attr);
+
attr = dwarf2_attr (die, DW_AT_low_pc, cu);
if (attr)
{
CORE_ADDR low = DW_ADDR (attr);
+
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)
{
struct dwarf_block blk;
+
blk.size = DW_BLOCK (attr)->size - 1;
blk.data = DW_BLOCK (attr)->data + 1;
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 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
get_die_type to ensure only one type for this DIE is created.
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 die_info *type_die = follow_die_ref_or_sig (die, attr, &type_cu);
+
type = read_type_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)
{
struct type *child_type = read_type_die (child_die, cu);
+
if (child_type != NULL)
{
/* 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)
{
int i = 0;
+
while (i < ndim)
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 dwarf2_cu *ext_cu = cu;
+
ext_die = dwarf2_extension (die, &ext_cu);
type = read_type_die (ext_die, ext_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)
{
const char *previous_prefix = determine_prefix (die, cu);
+
cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL,
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);
}
- else {
- /* Should we also complain about unhandled address classes? */
- }
+ else
+ {
+ /* Should we also complain about unhandled address classes? */
+ }
}
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)
{
const char *name = dwarf2_name (child_die, cu);
+
if (name && !strcmp (name, "this"))
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 1;
}
@@ -6195,6 +6218,7 @@ static hashval_t
die_hash (const void *item)
{
const struct die_info *die = item;
+
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_rhs = item_rhs;
+
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)
{
LONGEST offset = read_offset_1 (abfd, buf, cu_header->offset_size);
+
*bytes_read = cu_header->offset_size;
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++)
{
char *dir = NULL;
+
fe = &lh->file_names[i];
if (fe->dir_index)
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)
{
int file_index = DW_UNSND (attr);
+
if (cu->line_header == NULL
|| file_index > cu->line_header->num_file_names)
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)
{
struct file_entry *fe;
+
fe = &cu->line_header->file_names[file_index - 1];
SYMBOL_SYMTAB (sym) = fe->symtab;
}
@@ -9168,6 +9197,7 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
if (obs == NULL)
{
char *retval = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
+
strcpy (retval, prefix);
strcat (retval, sep);
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))
{
struct dwarf2_per_cu_data *per_cu;
+
per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
/* 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
won't be able to find the file by name. */
char fake_name[80];
+
sprintf (fake_name, "<bad macro file number %d>", file);
complaint (&symfile_complaints,
@@ -11109,9 +11141,9 @@ static char *
copy_string (const char *buf, int len)
{
char *s = xmalloc (len + 1);
+
memcpy (s, buf, len);
s[len] = '\0';
-
return s;
}
@@ -11689,8 +11721,8 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
struct dwarf2_per_objfile *per_objfile
= objfile_data (objfile, dwarf2_objfile_data_key);
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
-
struct comp_unit_head cu_header;
+
memset (&cu_header, 0, sizeof cu_header);
read_comp_unit_head (&cu_header, info_ptr, objfile->obfd);
return cu_header.addr_size;
@@ -11712,6 +11744,7 @@ dwarf2_find_containing_comp_unit (unsigned int offset,
while (high > low)
{
int mid = low + (high - low) / 2;
+
if (dwarf2_per_objfile->all_comp_units[mid]->offset >= offset)
high = mid;
else
@@ -11746,6 +11779,7 @@ static struct dwarf2_per_cu_data *
dwarf2_find_comp_unit (unsigned int offset, struct objfile *objfile)
{
struct dwarf2_per_cu_data *this_cu;
+
this_cu = dwarf2_find_containing_comp_unit (offset, objfile);
if (this_cu->offset != offset)
error (_("no compilation unit with offset %u."), offset);
@@ -11931,6 +11965,7 @@ static hashval_t
offset_and_type_hash (const void *item)
{
const struct dwarf2_offset_and_type *ofs = item;
+
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_rhs = item_rhs;
+
return ofs_lhs->offset == ofs_rhs->offset;
}
@@ -12078,6 +12114,7 @@ static hashval_t
partial_die_hash (const void *item)
{
const struct partial_die_info *part_die = item;
+
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_rhs = item_rhs;
+
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 map_begin = begin & ~(pagesize - 1);
size_t map_length = info->size + begin - map_begin;
+
gdb_assert (munmap ((void *) map_begin, map_length) == 0);
#else
/* 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)
{
struct dwarf2_per_objfile *data = d;
+
munmap_section_buffer (&data->info);
munmap_section_buffer (&data->abbrev);
munmap_section_buffer (&data->line);