]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2006-05-03 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Wed, 3 May 2006 16:30:56 +0000 (16:30 +0000)
committerPaul Brook <paul@codesourcery.com>
Wed, 3 May 2006 16:30:56 +0000 (16:30 +0000)
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.

ChangeLog.csl
gdb/Makefile.in
gdb/arm-tdep.c
gdb/c-typeprint.c
gdb/c-valprint.c
gdb/dwarf2expr.c
gdb/dwarf2read.c
gdb/eval.c
gdb/symtab.c
gdb/varobj.c

index 56a994cf5e2e97abf4e30b7e1b452bfbd57732ec..de7ebbf6e10c51a54ac773a0aafddca7f72255d3 100644 (file)
@@ -1,3 +1,32 @@
+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>
 
index d955c09dc4e58d24408bb69a7ae722adf3f13e38..c06fb07299c66a289f44307a2ce8b998568d2b7e 100644 (file)
@@ -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) \
index 25a5416c7e090e6b09f37ded2e85d4ce600e1a94..9ebb24b80588b238ddfba95e22d35253ecca3901 100644 (file)
@@ -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;
index 8ac2c037cb6bd315302749fbbc7acb3bc4f2031b..c0c85dd5469ee2df20ef055aa7b05afc3f85f477 100644 (file)
@@ -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, ", ...");
index 861e3bfe2e180a0c72d5ad1ac9c123a43ef0511d..7b96679fe050d20cbe8478aaef7d623c79963441 100644 (file)
@@ -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
index fdff8eaa851cbf1a48a021d75352c6446be5c7c5..784ba27c07660746eb8627db62e342e315b073c5 100644 (file)
@@ -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, &reg);
-         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;
index db03984ab9fb2cc25d5c16a088f7ed935ce10130..1e62a45ea43aa6ad57237e9ba0e656593b1e5fda 100644 (file)
@@ -675,6 +675,13 @@ dwarf2_statement_list_fits_in_line_number_section_complaint (void)
             _("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)
 {
@@ -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:
index ac9a5ee19de6599103d9d341b1ccf8396e01d697..f07097bf532945dd257eb20060bdb6a4f25eb49f 100644 (file)
@@ -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;
index ad4ed038cc1aa7579608552f48ed6d099c06282a..3d79530272598be5c30c82e626812e9af690d893 100644 (file)
@@ -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;
 }
 \f
 struct symtabs_and_lines
index babb685fbf58adf6eac0ac2a4139d06bf47820fc..81ef853e2d6007db5d8edc48c7e3b1fd47866a07 100644 (file)
@@ -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;
     }