+2006-05-03 Paul Brook <paul@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb/c-valprint.c: Handle class member typedefs.
+
+ * gdb/symtab.c (skip_prologue_using_sal): Treat two consecutive lines
+ at the same address as a prolouge marker.
+ * gdb/arm-tdep.c (arm_skip_prologue): Use skip_prologue_using_sal.
+
+ * gdb/dwarf2expr.c (execute_stack_op): Check for bogus DW_OP_reg.
+
+ * gdb/dwarf2read.c (read_structure_type): Use tag name for C++/Java
+ classes.
+
+ * Makefile.in (eval.o): Update dependencies.
+ * eval.c: Include "ui-out.h" and "exceptions.h".
+ (evaluate_subexp_standard): Use TRY_CATCH around value_of_variable.
+ Use value_zero if an error occurs when avoiding side effects.
+ * varobj.c (varobj_create): Call release_value after evaluate_type.
+ (c_value_of_root): Initialize new_val. Don't release_value a NULL
+ value.
+
+ * gdb/c-typeprint.c (cp_type_print_method_args): Don't print type
+ details.
+
+ * gdb/dwarf2read.c (dwarf2_debug_line_missing_file_complaint): New
+ function.
+ (dwarf_decode_lines): Check for line info without a file.
+
2006-05-03 Paul Brook <paul@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
eval.o: eval.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(expression_h) $(target_h) $(frame_h) $(language_h) \
$(f_lang_h) $(cp_abi_h) $(infcall_h) $(objc_lang_h) $(block_h) \
- $(parser_defs_h) $(cp_support_h)
+ $(parser_defs_h) $(cp_support_h) $(exceptions_h) $(uiout_h)
event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \
$(gdb_string_h) $(exceptions_h) $(gdb_assert_h) $(gdb_select_h)
event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
/* See what the symbol table says. */
+ /* See if we can determine the end of the prologue via the symbol table.
+ If so, then return either PC, or the PC after the prologue, whichever
+ is greater. */
+ if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
+ {
+ CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
+ }
+
+#if 0
if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end))
{
struct symbol *sym;
return sal.end;
}
}
+#endif
/* Can't find the prologue end in the symbol table, try it the hard way
by disassembling the instructions. */
+ func_end = skip_prologue_using_sal (pc);
/* Like arm_scan_prologue, stop no later than pc + 64. */
if (func_end == 0 || func_end > pc + 64)
func_end = pc + 64;
{
while (i < nargs)
{
- type_print (args[i++].type, "", stream, 0);
+ type_print (args[i++].type, "", stream, -1);
if (i == nargs && varargs)
fprintf_filtered (stream, ", ...");
}
else if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
{
- cp_print_class_member (valaddr + embedded_offset,
- TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
+ struct type *target_type, *domain_type;
+
+ target_type = check_typedef (TYPE_TARGET_TYPE (type));
+ domain_type = TYPE_DOMAIN_TYPE (target_type);
+ cp_print_class_member (valaddr + embedded_offset, domain_type,
stream, "&");
}
else
LONGEST offset;
int bytes_read;
+ if (ctx->in_reg && op != DW_OP_piece && op != DW_OP_nop)
+ error (_("DWARF-2 expression error: DW_OP_reg operations must be "
+ "used either alone or in conjuction with DW_OP_piece."));
+
switch (op)
{
case DW_OP_lit0:
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
- if (op_ptr != op_end && *op_ptr != DW_OP_piece)
- error (_("DWARF-2 expression error: DW_OP_reg operations must be "
- "used either alone or in conjuction with DW_OP_piece."));
-
result = op - DW_OP_reg0;
ctx->in_reg = 1;
case DW_OP_regx:
op_ptr = read_uleb128 (op_ptr, op_end, ®);
- if (op_ptr != op_end && *op_ptr != DW_OP_piece)
- error (_("DWARF-2 expression error: DW_OP_reg operations must be "
- "used either alone or in conjuction with DW_OP_piece."));
-
result = reg;
ctx->in_reg = 1;
break;
_("statement list doesn't fit in .debug_line section"));
}
+static void
+dwarf2_debug_line_missing_file_complaint (void)
+{
+ complaint (&symfile_complaints,
+ _(".debug_line section has line data without a file"));
+}
+
static void
dwarf2_complex_location_expr_complaint (void)
{
&objfile->objfile_obstack);
back_to = make_cleanup (xfree, new_prefix);
processing_current_prefix = new_prefix;
+
+ /* Suppress printing of "class ". */
+ TYPE_NAME (type) = TYPE_TAG_NAME (type);
}
else
{
address += (adj_opcode / lh->line_range)
* lh->minimum_instruction_length;
line += lh->line_base + (adj_opcode % lh->line_range);
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p)
- {
- /* Append row to matrix using current values. */
- record_line (current_subfile, line,
- check_cu_functions (address, cu));
- }
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ lh->file_names[file - 1].included_p = 1;
+ if (!decode_for_pst_p)
+ {
+ /* Append row to matrix using current values. */
+ record_line (current_subfile, line,
+ check_cu_functions (address, cu));
+ }
+ }
basic_block = 1;
}
else switch (op_code)
{
case DW_LNE_end_sequence:
end_sequence = 1;
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p)
- record_line (current_subfile, 0, address);
+
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ lh->file_names[file - 1].included_p = 1;
+ if (!decode_for_pst_p)
+ record_line (current_subfile, 0, address);
+ }
break;
case DW_LNE_set_address:
address = read_address (abfd, line_ptr, cu, &bytes_read);
}
break;
case DW_LNS_copy:
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p)
- record_line (current_subfile, line,
- check_cu_functions (address, cu));
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ lh->file_names[file - 1].included_p = 1;
+ if (!decode_for_pst_p)
+ record_line (current_subfile, line,
+ check_cu_functions (address, cu));
+ }
basic_block = 0;
break;
case DW_LNS_advance_pc:
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
- fe = &lh->file_names[file - 1];
- if (fe->dir_index)
- dir = lh->include_dirs[fe->dir_index - 1];
- else if (!IS_ABSOLUTE_PATH (fe->name))
- dir = comp_dir;
- else
- dir = NULL;
- if (!decode_for_pst_p)
- dwarf2_start_subfile (fe->name, dir);
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ fe = &lh->file_names[file - 1];
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ else if (!IS_ABSOLUTE_PATH (fe->name))
+ dir = comp_dir;
+ else
+ dir = NULL;
+ if (!decode_for_pst_p)
+ dwarf2_start_subfile (fe->name, dir);
+ }
}
break;
case DW_LNS_set_column:
#include "block.h"
#include "parser-defs.h"
#include "cp-support.h"
+#include "ui-out.h"
+#include "exceptions.h"
/* This is defined in valops.c */
extern int overload_resolution;
value_rtti_target_type () if we are dealing with a pointer
or reference to a base class and print object is on. */
- return value_of_variable (exp->elts[pc + 2].symbol,
- exp->elts[pc + 1].block);
+ {
+ volatile struct gdb_exception except;
+ struct value *ret = NULL;
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ ret = value_of_variable (exp->elts[pc + 2].symbol,
+ exp->elts[pc + 1].block);
+ }
+
+ if (except.reason < 0)
+ {
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol), not_lval);
+ else
+ throw_exception (except);
+ }
+
+ return ret;
+ }
case OP_LAST:
(*pos) += 2;
prologue_sal = find_pc_line (start_pc, 0);
if (prologue_sal.line != 0)
{
+ /* For langauges other than assembly, treat two consecutive line
+ entries at the same address as a zero-instruction prologue.
+ The GNU assembler emits separate line notes for each instruction
+ in a multi-instruction macro, but compilers generally will not
+ do this. */
+ if (prologue_sal.symtab->language != language_asm)
+ {
+ struct linetable *linetable = LINETABLE (prologue_sal.symtab);
+ int exact;
+ int idx = 0;
+
+ /* Skip any earlier lines, and any end-of-sequence marker
+ from a previous function. */
+ while (linetable->item[idx].pc != prologue_sal.pc
+ || linetable->item[idx].line == 0)
+ idx++;
+
+ if (idx+1 < linetable->nitems
+ && linetable->item[idx+1].line != 0
+ && linetable->item[idx+1].pc == start_pc)
+ return start_pc;
+ }
+
while (prologue_sal.end < end_pc)
{
struct symtab_and_line sal;
prologue_sal = sal;
}
}
- return prologue_sal.end;
+
+ if (prologue_sal.end < end_pc)
+ /* Return the end of this line, or zero if we could not find a
+ line. */
+ return prologue_sal.end;
+ else
+ /* Don't return END_PC, which is past the end of the function. */
+ return prologue_sal.pc;
}
\f
struct symtabs_and_lines
gdb_value_fetch_lazy (var->value);
}
else
- var->value = evaluate_type (var->root->exp);
+ {
+ var->value = evaluate_type (var->root->exp);
+ release_value (var->value);
+ }
var->type = value_type (var->value);
static struct value *
c_value_of_root (struct varobj **var_handle)
{
- struct value *new_val;
+ struct value *new_val = NULL;
struct varobj *var = *var_handle;
struct frame_info *fi;
int within_scope;
else
var->error = 0;
}
+
+ release_value (new_val);
}
else
var->error = 1;
- release_value (new_val);
return new_val;
}