diff options
author | Paul Brook <paul@codesourcery.com> | 2006-05-03 16:30:56 +0000 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2006-05-03 16:30:56 +0000 |
commit | 311fe192d55f89f523d0404b8c5b36b541573886 (patch) | |
tree | 3af9b47d50161323c2952ba5fbfb3ba3545403d2 | |
parent | e608c78f02d077a60733236a8eea1ee37b994d64 (diff) | |
download | gdb-311fe192d55f89f523d0404b8c5b36b541573886.tar.gz |
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.
-rw-r--r-- | ChangeLog.csl | 29 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 13 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/c-valprint.c | 7 | ||||
-rw-r--r-- | gdb/dwarf2expr.c | 12 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 77 | ||||
-rw-r--r-- | gdb/eval.c | 24 | ||||
-rw-r--r-- | gdb/symtab.c | 32 | ||||
-rw-r--r-- | gdb/varobj.c | 10 |
10 files changed, 167 insertions, 41 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl index 56a994cf5e2..de7ebbf6e10 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,6 +1,35 @@ 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> + * gdb/dwarf2read.c (read_subroutine_type): Add armcc workaround. * gdb/dwarf2read.c (read_structure_type): Look for ADS vtable diff --git a/gdb/Makefile.in b/gdb/Makefile.in index d955c09dc4e..c06fb07299c 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1977,7 +1977,7 @@ environ.o: environ.c $(defs_h) $(environ_h) $(gdb_string_h) 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) \ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 25a5416c7e0..9ebb24b8058 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -414,6 +414,17 @@ arm_skip_prologue (CORE_ADDR pc) /* 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; @@ -428,10 +439,12 @@ arm_skip_prologue (CORE_ADDR pc) 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; diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 8ac2c037cb6..c0c85dd5469 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -168,7 +168,7 @@ cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, { while (i < nargs) { - type_print (args[i++].type, "", stream, 0); + type_print (args[i++].type, "", stream, -1); if (i == nargs && varargs) fprintf_filtered (stream, ", ..."); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 861e3bfe2e1..7b96679fe05 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -165,8 +165,11 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } 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 diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index fdff8eaa851..784ba27c076 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -266,6 +266,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, 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: @@ -383,10 +387,6 @@ execute_stack_op (struct dwarf_expr_context *ctx, 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; @@ -394,10 +394,6 @@ execute_stack_op (struct dwarf_expr_context *ctx, 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; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index db03984ab9f..1e62a45ea43 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -676,6 +676,13 @@ dwarf2_statement_list_fits_in_line_number_section_complaint (void) } 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) { complaint (&symfile_complaints, _("location expression too complex")); @@ -3785,6 +3792,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) &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 { @@ -6679,13 +6689,18 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, 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) @@ -6699,9 +6714,15 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, { 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); @@ -6734,10 +6755,15 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, } 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: @@ -6759,15 +6785,20 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd, 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: diff --git a/gdb/eval.c b/gdb/eval.c index ac9a5ee19de..f07097bf532 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -37,6 +37,8 @@ #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; @@ -461,8 +463,26 @@ evaluate_subexp_standard (struct type *expect_type, 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; diff --git a/gdb/symtab.c b/gdb/symtab.c index ad4ed038cc1..3d795302725 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4030,6 +4030,29 @@ skip_prologue_using_sal (CORE_ADDR func_addr) 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; @@ -4051,7 +4074,14 @@ skip_prologue_using_sal (CORE_ADDR func_addr) 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; } struct symtabs_and_lines diff --git a/gdb/varobj.c b/gdb/varobj.c index babb685fbf5..81ef853e2d6 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -513,7 +513,10 @@ varobj_create (char *objname, 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); @@ -1868,7 +1871,7 @@ c_name_of_child (struct varobj *parent, int index) 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; @@ -1912,11 +1915,12 @@ c_value_of_root (struct varobj **var_handle) else var->error = 0; } + + release_value (new_val); } else var->error = 1; - release_value (new_val); return new_val; } |