Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Added verbosity to dwarf2*
@ 2002-12-14 10:34 Michal Ludvig
  2002-12-14 13:50 ` [RFA] " Michal Ludvig
  2003-02-03 14:43 ` [PATCH] " Michal Ludvig
  0 siblings, 2 replies; 9+ messages in thread
From: Michal Ludvig @ 2002-12-14 10:34 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

Hi all,
this patch adds some more verbosity to GDB's error messages. I've found 
it very useful for bugreports, because you can locate the failing 
testcase much faster when knowing in what objfile it fails.
It also helps GCC developers hunting their bugs in DWARF2 generator.

OK to commit to mainline? And to 5.3 branch?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz

[-- Attachment #2: gdb-verbosestrings.diff --]
[-- Type: text/plain, Size: 15891 bytes --]

2002-12-14  Michal Ludvig  <mludvig@suse.cz>

	* dwarf2cfi.c (pointer_encoding): Added new parameter.
	* dwarf2cfi.c, dwarf2read.c: Changed all warnings and
	error messages to contain BFD filename. 

Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.20
diff -u -p -r1.20 dwarf2cfi.c
--- dwarf2cfi.c	2 Nov 2002 14:59:10 -0000	1.20
+++ dwarf2cfi.c	11 Nov 2002 15:53:44 -0000
@@ -194,7 +194,7 @@ static LONGEST read_sleb128 (bfd *abfd, 
 static CORE_ADDR read_pointer (bfd *abfd, char **p);
 static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p,
 				       unsigned char encoding);
-static enum ptr_encoding pointer_encoding (unsigned char encoding);
+static enum ptr_encoding pointer_encoding (unsigned char encoding, struct objfile *objfile);
 
 static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read);
 static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read,
@@ -457,7 +457,8 @@ read_pointer (bfd *abfd, char **p)
     case 8:
       return read_8u (abfd, p);
     default:
-      error ("dwarf cfi error: unsupported target address length.");
+      error ("dwarf cfi error: unsupported target address length [%s]", 
+		      bfd_get_filename (abfd));
     }
 }
 
@@ -504,7 +505,8 @@ read_encoded_pointer (bfd *abfd, char **
 
     default:
       internal_error (__FILE__, __LINE__,
-		      "read_encoded_pointer: unknown pointer encoding");
+		      "read_encoded_pointer: unknown pointer encoding [%s]",
+		      bfd_get_filename (abfd));
     }
 
   return ret;
@@ -515,12 +517,13 @@ read_encoded_pointer (bfd *abfd, char **
    - encoding & 0x70 : type (absolute, relative, ...)
    - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80).  */
 enum ptr_encoding
-pointer_encoding (unsigned char encoding)
+pointer_encoding (unsigned char encoding, struct objfile *objfile)
 {
   int ret;
 
   if (encoding & DW_EH_PE_indirect)
-    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect");
+    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect [%s]",
+		    objfile->name);
 
   switch (encoding & 0x70)
     {
@@ -532,7 +535,8 @@ pointer_encoding (unsigned char encoding
       ret = encoding & 0x70;
       break;
     default:
-      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding");
+      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding [%s]", 
+		      objfile->name);
     }
   return ret;
 }
@@ -609,8 +613,9 @@ execute_cfa_program (struct objfile *obj
 	    fs->pc = read_encoded_pointer (objfile->obfd, &insn_ptr,
 					   fs->addr_encoding);
 
-	    if (pointer_encoding (fs->addr_encoding) != PE_absptr)
-	      warning ("CFI: DW_CFA_set_loc uses relative addressing");
+	    if (pointer_encoding (fs->addr_encoding, objfile) != PE_absptr)
+	      warning ("CFI: DW_CFA_set_loc uses relative addressing [%s]", 
+			      objfile->name);
 
 	    break;
 
@@ -759,7 +764,8 @@ execute_cfa_program (struct objfile *obj
 	    break;
 
 	  default:
-	    error ("dwarf cfi error: unknown cfa instruction %d.", insn);
+	    error ("dwarf cfi error: unknown cfa instruction %d [%s]", insn, 
+			    objfile->name);
 	  }
     }
 }
@@ -1022,25 +1028,25 @@ execute_stack_op (struct objfile *objfil
 
 	case DW_OP_dup:
 	  if (stack_elt < 1)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  result = stack[stack_elt - 1];
 	  break;
 
 	case DW_OP_drop:
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  goto no_push;
 
 	case DW_OP_pick:
 	  offset = *op_ptr++;
 	  if (offset >= stack_elt - 1)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  result = stack[stack_elt - 1 - offset];
 	  break;
 
 	case DW_OP_over:
 	  if (stack_elt < 2)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  result = stack[stack_elt - 2];
 	  break;
 
@@ -1049,7 +1055,7 @@ execute_stack_op (struct objfile *objfil
 	    CORE_ADDR t1, t2, t3;
 
 	    if (stack_elt < 3)
-	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	      internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	    t1 = stack[stack_elt - 1];
 	    t2 = stack[stack_elt - 2];
 	    t3 = stack[stack_elt - 3];
@@ -1067,7 +1073,7 @@ execute_stack_op (struct objfile *objfil
 	case DW_OP_plus_uconst:
 	  /* Unary operations.  */
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  result = stack[stack_elt];
 
 	  switch (op)
@@ -1077,7 +1083,7 @@ execute_stack_op (struct objfile *objfil
 		int len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
 		if (len != 4 && len != 8)
 		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error");
+				  "execute_stack_op error [%s]", objfile->name);
 		result = read_memory_unsigned_integer (result, len);
 	      }
 	      break;
@@ -1087,7 +1093,7 @@ execute_stack_op (struct objfile *objfil
 		int len = *op_ptr++;
 		if (len != 1 && len != 2 && len != 4 && len != 8)
 		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error");
+				  "execute_stack_op error [%s]", objfile->name);
 		result = read_memory_unsigned_integer (result, len);
 	      }
 	      break;
@@ -1127,7 +1133,7 @@ execute_stack_op (struct objfile *objfil
 	    /* Binary operations.  */
 	    CORE_ADDR first, second;
 	    if ((stack_elt -= 2) < 0)
-	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	      internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	    second = stack[stack_elt];
 	    first = stack[stack_elt + 1];
 
@@ -1185,7 +1191,7 @@ execute_stack_op (struct objfile *objfil
 		result = (LONGEST) first != (LONGEST) second;
 		break;
 	      default:
-		error ("execute_stack_op: Unknown DW_OP_ value");
+		error ("execute_stack_op: Unknown DW_OP_ value [%s]", objfile->name);
 		break;
 	      }
 	  }
@@ -1198,7 +1204,7 @@ execute_stack_op (struct objfile *objfil
 
 	case DW_OP_bra:
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	  offset = read_2s (objfile->obfd, &op_ptr);
 	  if (stack[stack_elt] != 0)
 	    op_ptr += offset;
@@ -1208,12 +1214,12 @@ execute_stack_op (struct objfile *objfil
 	  goto no_push;
 
 	default:
-	  internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	  internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
 	}
 
       /* Most things push a result value.  */
       if ((size_t) stack_elt >= sizeof (stack) / sizeof (*stack))
-	internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
       stack[++stack_elt] = result;
     no_push:;
     }
@@ -1221,7 +1227,7 @@ execute_stack_op (struct objfile *objfil
   /* We were executing this program to get a value.  It should be
      at top of stack.  */
   if (--stack_elt < 0)
-    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
   return stack[stack_elt];
 }
 
@@ -1306,7 +1312,8 @@ update_context (struct context *context,
 	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr;
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__, "bad switch");
+	    internal_error (__FILE__, __LINE__, "bad switch 0x%02X", 
+			    orig_context->reg[fs->regs.reg[i].loc.reg].how);
 	  }
 	break;
       case REG_SAVED_EXP:
@@ -1323,7 +1330,8 @@ update_context (struct context *context,
 	}
 	break;
       default:
-	internal_error (__FILE__, __LINE__, "bad switch");
+	internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
+			fs->regs.reg[i].how);
       }
   get_reg ((char *) &context->ra, context, fs->retaddr_column);
   unwind_tmp_obstack_free ();
@@ -1533,13 +1541,14 @@ parse_frame_info (struct objfile *objfil
 		      cie = cie->next;
 		    }
 		  if (!cie)
-		    error ("CFI: can't find CIE pointer");
+		    error ("CFI: can't find CIE pointer [%s]", 
+				    bfd_get_filename (abfd));
 		}
 
 	      init_loc = read_encoded_pointer (abfd, &start,
 					       cie->addr_encoding);
 
-	      switch (pointer_encoding (cie->addr_encoding))
+	      switch (pointer_encoding (cie->addr_encoding, objfile))
 		{
 		case PE_absptr:
 		  break;
@@ -1549,7 +1558,8 @@ parse_frame_info (struct objfile *objfil
 		  init_loc += curr_section_vma + start - frame_buffer;
 		  break;
 		default:
-		  warning ("CFI: Unsupported pointer encoding\n");
+		  warning ("CFI: Unsupported pointer encoding [%s]",
+				  bfd_get_filename (abfd));
 		}
 
 	      /* For relocatable objects we must add an offset telling
@@ -1875,7 +1885,8 @@ cfi_get_saved_register (char *raw_buffer
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "cfi_get_saved_register: unknown register rule");
+			  "cfi_get_saved_register: unknown register rule 0x%02X",
+			  UNWIND_CONTEXT (frame)->reg[regnum].how);
 	}
     }
 }
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.75
diff -u -p -r1.75 dwarf2read.c
--- dwarf2read.c	11 Nov 2002 00:55:34 -0000	1.75
+++ dwarf2read.c	11 Nov 2002 15:53:46 -0000
@@ -1228,22 +1228,24 @@ dwarf2_build_psymtabs_hard (struct objfi
 
       if (cu_header.version != 2)
 	{
-	  error ("Dwarf Error: wrong version in compilation unit header.");
+	  error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [%s]", cu_header.version, 2, bfd_get_filename (abfd));
 	  return;
 	}
       if (cu_header.abbrev_offset >= dwarf_abbrev_size)
 	{
-	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6).",
+	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6) [%s]",
 		 (long) cu_header.abbrev_offset,
-		 (long) (beg_of_comp_unit - dwarf_info_buffer));
+		 (long) (beg_of_comp_unit - dwarf_info_buffer),
+		 bfd_get_filename (abfd));
 	  return;
 	}
       if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size
 	  > dwarf_info_buffer + dwarf_info_size)
 	{
-	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).",
+	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0) [%s]",
 		 (long) cu_header.length,
-		 (long) (beg_of_comp_unit - dwarf_info_buffer));
+		 (long) (beg_of_comp_unit - dwarf_info_buffer),
+		 bfd_get_filename (abfd));
 	  return;
 	}
       /* Complete the cu_header */
@@ -3634,7 +3636,8 @@ read_partial_die (struct partial_die_inf
   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
   if (!abbrev)
     {
-      error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: Could not find abbrev number %d [%s]", abbrev_number,
+		      bfd_get_filename (abfd));
     }
   part_die->offset = info_ptr - dwarf_info_buffer;
   part_die->tag = abbrev->tag;
@@ -3778,7 +3781,8 @@ read_full_die (struct die_info **diep, b
   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
   if (!abbrev)
     {
-      error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: could not find abbrev number %d [%s]", abbrev_number, 
+		      bfd_get_filename (abfd));
     }
   die = dwarf_alloc_die ();
   die->offset = offset;
@@ -3914,8 +3918,9 @@ read_attribute_value (struct attribute *
       info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header);
       break;
     default:
-      error ("Dwarf Error: Cannot handle %s in DWARF reader.",
-	     dwarf_form_name (form));
+      error ("Dwarf Error: Cannot handle %s in DWARF reader [%s]",
+	     dwarf_form_name (form),
+	     bfd_get_filename (abfd));
     }
   return info_ptr;
 }
@@ -3996,7 +4001,8 @@ read_address (bfd *abfd, char *buf, cons
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "read_address: bad switch, signed");
+			  "read_address: bad switch, signed [%s]",
+			  bfd_get_filename (abfd));
 	}
     }
   else
@@ -4014,7 +4020,8 @@ read_address (bfd *abfd, char *buf, cons
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "read_address: bad switch, unsigned");
+			  "read_address: bad switch, unsigned [%s]",
+			  bfd_get_filename (abfd));
 	}
     }
 
@@ -4129,7 +4136,8 @@ read_offset (bfd *abfd, char *buf, const
       break;
     default:
       internal_error (__FILE__, __LINE__,
-		      "read_offset: bad switch");
+		      "read_offset: bad switch [%s]",
+		      bfd_get_filename (abfd));
     }
 
  return retval;
@@ -4171,12 +4179,14 @@ read_indirect_string (bfd *abfd, char *b
 
   if (dwarf_str_buffer == NULL)
     {
-      error ("DW_FORM_strp used without .debug_str section");
+      error ("DW_FORM_strp used without .debug_str section [%s]",
+		      bfd_get_filename (abfd));
       return NULL;
     }
   if (str_offset >= dwarf_str_size)
     {
-      error ("DW_FORM_strp pointing outside of .debug_str section");
+      error ("DW_FORM_strp pointing outside of .debug_str section [%s]",
+		      bfd_get_filename (abfd));
       return NULL;
     }
   gdb_assert (HOST_CHAR_BIT == 8);
@@ -5187,7 +5197,8 @@ die_type (struct die_info *die, struct o
       type_die = follow_die_ref (ref);
       if (!type_die)
 	{
-	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+	  error ("Dwarf Error: Cannot find referent at offset %d [%s]", 
+			  ref, objfile->name);
 	  return NULL;
 	}
     }
@@ -5195,7 +5206,8 @@ die_type (struct die_info *die, struct o
   if (!type)
     {
       dump_die (type_die);
-      error ("Dwarf Error: Problem turning type die at offset into gdb type.");
+      error ("Dwarf Error: Problem turning type die at offset into gdb type [%s]",
+		      objfile->name);
     }
   return type;
 }
@@ -5219,7 +5231,8 @@ die_containing_type (struct die_info *di
       type_die = follow_die_ref (ref);
       if (!type_die)
 	{
-	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+	  error ("Dwarf Error: Cannot find referent at offset %d [%s]", ref, 
+			  objfile->name);
 	  return NULL;
 	}
       type = tag_type_to_type (type_die, objfile, cu_header);
@@ -5228,7 +5241,8 @@ die_containing_type (struct die_info *di
     {
       if (type_die)
 	dump_die (type_die);
-      error ("Dwarf Error: Problem turning containing type into gdb type.");
+      error ("Dwarf Error: Problem turning containing type into gdb type [%s]", 
+		      objfile->name);
     }
   return type;
 }
@@ -5265,7 +5279,8 @@ tag_type_to_type (struct die_info *die, 
       if (!die->type)
 	{
 	  dump_die (die);
-	  error ("Dwarf Error: Cannot find type of die.");
+	  error ("Dwarf Error: Cannot find type of die [%s]", 
+			  objfile->name);
 	}
       return die->type;
     }
@@ -6437,8 +6452,8 @@ dwarf2_fundamental_type (struct objfile 
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
-      error ("Dwarf Error: internal error - invalid fundamental type id %d.",
-	     typeid);
+      error ("Dwarf Error: internal error - invalid fundamental type id %d [%s]",
+	     typeid, objfile->name);
     }
 
   /* Look for this particular type in the fundamental type vector.  If

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [RFA] Added verbosity to dwarf2*
  2002-12-14 10:34 [PATCH] Added verbosity to dwarf2* Michal Ludvig
@ 2002-12-14 13:50 ` Michal Ludvig
  2002-12-14 22:18   ` Eli Zaretskii
  2003-02-03 14:43 ` [PATCH] " Michal Ludvig
  1 sibling, 1 reply; 9+ messages in thread
From: Michal Ludvig @ 2002-12-14 13:50 UTC (permalink / raw)
  To: GDB Patches

Oops, should have been [RFA], not [PATCH]. Sorry...

Michal Ludvig

Michal Ludvig wrote:
> Hi all,
> this patch adds some more verbosity to GDB's error messages. I've found 
> it very useful for bugreports, because you can locate the failing 
> testcase much faster when knowing in what objfile it fails.
> It also helps GCC developers hunting their bugs in DWARF2 generator.
> 
> OK to commit to mainline? And to 5.3 branch?
> 
> Michal Ludvig
> 
> 
> ------------------------------------------------------------------------
> 
> 2002-12-14  Michal Ludvig  <mludvig@suse.cz>
> 
> 	* dwarf2cfi.c (pointer_encoding): Added new parameter.
> 	* dwarf2cfi.c, dwarf2read.c: Changed all warnings and
> 	error messages to contain BFD filename. 
> 
> Index: dwarf2cfi.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 dwarf2cfi.c
> --- dwarf2cfi.c	2 Nov 2002 14:59:10 -0000	1.20
> +++ dwarf2cfi.c	11 Nov 2002 15:53:44 -0000
> @@ -194,7 +194,7 @@ static LONGEST read_sleb128 (bfd *abfd, 
>  static CORE_ADDR read_pointer (bfd *abfd, char **p);
>  static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p,
>  				       unsigned char encoding);
> -static enum ptr_encoding pointer_encoding (unsigned char encoding);
> +static enum ptr_encoding pointer_encoding (unsigned char encoding, struct objfile *objfile);
>  
>  static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read);
>  static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read,
> @@ -457,7 +457,8 @@ read_pointer (bfd *abfd, char **p)
>      case 8:
>        return read_8u (abfd, p);
>      default:
> -      error ("dwarf cfi error: unsupported target address length.");
> +      error ("dwarf cfi error: unsupported target address length [%s]", 
> +		      bfd_get_filename (abfd));
>      }
>  }
>  
> @@ -504,7 +505,8 @@ read_encoded_pointer (bfd *abfd, char **
>  
>      default:
>        internal_error (__FILE__, __LINE__,
> -		      "read_encoded_pointer: unknown pointer encoding");
> +		      "read_encoded_pointer: unknown pointer encoding [%s]",
> +		      bfd_get_filename (abfd));
>      }
>  
>    return ret;
> @@ -515,12 +517,13 @@ read_encoded_pointer (bfd *abfd, char **
>     - encoding & 0x70 : type (absolute, relative, ...)
>     - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80).  */
>  enum ptr_encoding
> -pointer_encoding (unsigned char encoding)
> +pointer_encoding (unsigned char encoding, struct objfile *objfile)
>  {
>    int ret;
>  
>    if (encoding & DW_EH_PE_indirect)
> -    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect");
> +    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect [%s]",
> +		    objfile->name);
>  
>    switch (encoding & 0x70)
>      {
> @@ -532,7 +535,8 @@ pointer_encoding (unsigned char encoding
>        ret = encoding & 0x70;
>        break;
>      default:
> -      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding");
> +      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding [%s]", 
> +		      objfile->name);
>      }
>    return ret;
>  }
> @@ -609,8 +613,9 @@ execute_cfa_program (struct objfile *obj
>  	    fs->pc = read_encoded_pointer (objfile->obfd, &insn_ptr,
>  					   fs->addr_encoding);
>  
> -	    if (pointer_encoding (fs->addr_encoding) != PE_absptr)
> -	      warning ("CFI: DW_CFA_set_loc uses relative addressing");
> +	    if (pointer_encoding (fs->addr_encoding, objfile) != PE_absptr)
> +	      warning ("CFI: DW_CFA_set_loc uses relative addressing [%s]", 
> +			      objfile->name);
>  
>  	    break;
>  
> @@ -759,7 +764,8 @@ execute_cfa_program (struct objfile *obj
>  	    break;
>  
>  	  default:
> -	    error ("dwarf cfi error: unknown cfa instruction %d.", insn);
> +	    error ("dwarf cfi error: unknown cfa instruction %d [%s]", insn, 
> +			    objfile->name);
>  	  }
>      }
>  }
> @@ -1022,25 +1028,25 @@ execute_stack_op (struct objfile *objfil
>  
>  	case DW_OP_dup:
>  	  if (stack_elt < 1)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  result = stack[stack_elt - 1];
>  	  break;
>  
>  	case DW_OP_drop:
>  	  if (--stack_elt < 0)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  goto no_push;
>  
>  	case DW_OP_pick:
>  	  offset = *op_ptr++;
>  	  if (offset >= stack_elt - 1)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  result = stack[stack_elt - 1 - offset];
>  	  break;
>  
>  	case DW_OP_over:
>  	  if (stack_elt < 2)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  result = stack[stack_elt - 2];
>  	  break;
>  
> @@ -1049,7 +1055,7 @@ execute_stack_op (struct objfile *objfil
>  	    CORE_ADDR t1, t2, t3;
>  
>  	    if (stack_elt < 3)
> -	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	      internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	    t1 = stack[stack_elt - 1];
>  	    t2 = stack[stack_elt - 2];
>  	    t3 = stack[stack_elt - 3];
> @@ -1067,7 +1073,7 @@ execute_stack_op (struct objfile *objfil
>  	case DW_OP_plus_uconst:
>  	  /* Unary operations.  */
>  	  if (--stack_elt < 0)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  result = stack[stack_elt];
>  
>  	  switch (op)
> @@ -1077,7 +1083,7 @@ execute_stack_op (struct objfile *objfil
>  		int len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
>  		if (len != 4 && len != 8)
>  		  internal_error (__FILE__, __LINE__,
> -				  "execute_stack_op error");
> +				  "execute_stack_op error [%s]", objfile->name);
>  		result = read_memory_unsigned_integer (result, len);
>  	      }
>  	      break;
> @@ -1087,7 +1093,7 @@ execute_stack_op (struct objfile *objfil
>  		int len = *op_ptr++;
>  		if (len != 1 && len != 2 && len != 4 && len != 8)
>  		  internal_error (__FILE__, __LINE__,
> -				  "execute_stack_op error");
> +				  "execute_stack_op error [%s]", objfile->name);
>  		result = read_memory_unsigned_integer (result, len);
>  	      }
>  	      break;
> @@ -1127,7 +1133,7 @@ execute_stack_op (struct objfile *objfil
>  	    /* Binary operations.  */
>  	    CORE_ADDR first, second;
>  	    if ((stack_elt -= 2) < 0)
> -	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	      internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	    second = stack[stack_elt];
>  	    first = stack[stack_elt + 1];
>  
> @@ -1185,7 +1191,7 @@ execute_stack_op (struct objfile *objfil
>  		result = (LONGEST) first != (LONGEST) second;
>  		break;
>  	      default:
> -		error ("execute_stack_op: Unknown DW_OP_ value");
> +		error ("execute_stack_op: Unknown DW_OP_ value [%s]", objfile->name);
>  		break;
>  	      }
>  	  }
> @@ -1198,7 +1204,7 @@ execute_stack_op (struct objfile *objfil
>  
>  	case DW_OP_bra:
>  	  if (--stack_elt < 0)
> -	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	  offset = read_2s (objfile->obfd, &op_ptr);
>  	  if (stack[stack_elt] != 0)
>  	    op_ptr += offset;
> @@ -1208,12 +1214,12 @@ execute_stack_op (struct objfile *objfil
>  	  goto no_push;
>  
>  	default:
> -	  internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	  internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>  	}
>  
>        /* Most things push a result value.  */
>        if ((size_t) stack_elt >= sizeof (stack) / sizeof (*stack))
> -	internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +	internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>        stack[++stack_elt] = result;
>      no_push:;
>      }
> @@ -1221,7 +1227,7 @@ execute_stack_op (struct objfile *objfil
>    /* We were executing this program to get a value.  It should be
>       at top of stack.  */
>    if (--stack_elt < 0)
> -    internal_error (__FILE__, __LINE__, "execute_stack_op error");
> +    internal_error (__FILE__, __LINE__, "execute_stack_op error [%s]", objfile->name);
>    return stack[stack_elt];
>  }
>  
> @@ -1306,7 +1312,8 @@ update_context (struct context *context,
>  	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr;
>  	    break;
>  	  default:
> -	    internal_error (__FILE__, __LINE__, "bad switch");
> +	    internal_error (__FILE__, __LINE__, "bad switch 0x%02X", 
> +			    orig_context->reg[fs->regs.reg[i].loc.reg].how);
>  	  }
>  	break;
>        case REG_SAVED_EXP:
> @@ -1323,7 +1330,8 @@ update_context (struct context *context,
>  	}
>  	break;
>        default:
> -	internal_error (__FILE__, __LINE__, "bad switch");
> +	internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
> +			fs->regs.reg[i].how);
>        }
>    get_reg ((char *) &context->ra, context, fs->retaddr_column);
>    unwind_tmp_obstack_free ();
> @@ -1533,13 +1541,14 @@ parse_frame_info (struct objfile *objfil
>  		      cie = cie->next;
>  		    }
>  		  if (!cie)
> -		    error ("CFI: can't find CIE pointer");
> +		    error ("CFI: can't find CIE pointer [%s]", 
> +				    bfd_get_filename (abfd));
>  		}
>  
>  	      init_loc = read_encoded_pointer (abfd, &start,
>  					       cie->addr_encoding);
>  
> -	      switch (pointer_encoding (cie->addr_encoding))
> +	      switch (pointer_encoding (cie->addr_encoding, objfile))
>  		{
>  		case PE_absptr:
>  		  break;
> @@ -1549,7 +1558,8 @@ parse_frame_info (struct objfile *objfil
>  		  init_loc += curr_section_vma + start - frame_buffer;
>  		  break;
>  		default:
> -		  warning ("CFI: Unsupported pointer encoding\n");
> +		  warning ("CFI: Unsupported pointer encoding [%s]",
> +				  bfd_get_filename (abfd));
>  		}
>  
>  	      /* For relocatable objects we must add an offset telling
> @@ -1875,7 +1885,8 @@ cfi_get_saved_register (char *raw_buffer
>  	  break;
>  	default:
>  	  internal_error (__FILE__, __LINE__,
> -			  "cfi_get_saved_register: unknown register rule");
> +			  "cfi_get_saved_register: unknown register rule 0x%02X",
> +			  UNWIND_CONTEXT (frame)->reg[regnum].how);
>  	}
>      }
>  }
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.75
> diff -u -p -r1.75 dwarf2read.c
> --- dwarf2read.c	11 Nov 2002 00:55:34 -0000	1.75
> +++ dwarf2read.c	11 Nov 2002 15:53:46 -0000
> @@ -1228,22 +1228,24 @@ dwarf2_build_psymtabs_hard (struct objfi
>  
>        if (cu_header.version != 2)
>  	{
> -	  error ("Dwarf Error: wrong version in compilation unit header.");
> +	  error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [%s]", cu_header.version, 2, bfd_get_filename (abfd));
>  	  return;
>  	}
>        if (cu_header.abbrev_offset >= dwarf_abbrev_size)
>  	{
> -	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6).",
> +	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6) [%s]",
>  		 (long) cu_header.abbrev_offset,
> -		 (long) (beg_of_comp_unit - dwarf_info_buffer));
> +		 (long) (beg_of_comp_unit - dwarf_info_buffer),
> +		 bfd_get_filename (abfd));
>  	  return;
>  	}
>        if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size
>  	  > dwarf_info_buffer + dwarf_info_size)
>  	{
> -	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).",
> +	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0) [%s]",
>  		 (long) cu_header.length,
> -		 (long) (beg_of_comp_unit - dwarf_info_buffer));
> +		 (long) (beg_of_comp_unit - dwarf_info_buffer),
> +		 bfd_get_filename (abfd));
>  	  return;
>  	}
>        /* Complete the cu_header */
> @@ -3634,7 +3636,8 @@ read_partial_die (struct partial_die_inf
>    abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
>    if (!abbrev)
>      {
> -      error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
> +      error ("Dwarf Error: Could not find abbrev number %d [%s]", abbrev_number,
> +		      bfd_get_filename (abfd));
>      }
>    part_die->offset = info_ptr - dwarf_info_buffer;
>    part_die->tag = abbrev->tag;
> @@ -3778,7 +3781,8 @@ read_full_die (struct die_info **diep, b
>    abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
>    if (!abbrev)
>      {
> -      error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
> +      error ("Dwarf Error: could not find abbrev number %d [%s]", abbrev_number, 
> +		      bfd_get_filename (abfd));
>      }
>    die = dwarf_alloc_die ();
>    die->offset = offset;
> @@ -3914,8 +3918,9 @@ read_attribute_value (struct attribute *
>        info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header);
>        break;
>      default:
> -      error ("Dwarf Error: Cannot handle %s in DWARF reader.",
> -	     dwarf_form_name (form));
> +      error ("Dwarf Error: Cannot handle %s in DWARF reader [%s]",
> +	     dwarf_form_name (form),
> +	     bfd_get_filename (abfd));
>      }
>    return info_ptr;
>  }
> @@ -3996,7 +4001,8 @@ read_address (bfd *abfd, char *buf, cons
>  	  break;
>  	default:
>  	  internal_error (__FILE__, __LINE__,
> -			  "read_address: bad switch, signed");
> +			  "read_address: bad switch, signed [%s]",
> +			  bfd_get_filename (abfd));
>  	}
>      }
>    else
> @@ -4014,7 +4020,8 @@ read_address (bfd *abfd, char *buf, cons
>  	  break;
>  	default:
>  	  internal_error (__FILE__, __LINE__,
> -			  "read_address: bad switch, unsigned");
> +			  "read_address: bad switch, unsigned [%s]",
> +			  bfd_get_filename (abfd));
>  	}
>      }
>  
> @@ -4129,7 +4136,8 @@ read_offset (bfd *abfd, char *buf, const
>        break;
>      default:
>        internal_error (__FILE__, __LINE__,
> -		      "read_offset: bad switch");
> +		      "read_offset: bad switch [%s]",
> +		      bfd_get_filename (abfd));
>      }
>  
>   return retval;
> @@ -4171,12 +4179,14 @@ read_indirect_string (bfd *abfd, char *b
>  
>    if (dwarf_str_buffer == NULL)
>      {
> -      error ("DW_FORM_strp used without .debug_str section");
> +      error ("DW_FORM_strp used without .debug_str section [%s]",
> +		      bfd_get_filename (abfd));
>        return NULL;
>      }
>    if (str_offset >= dwarf_str_size)
>      {
> -      error ("DW_FORM_strp pointing outside of .debug_str section");
> +      error ("DW_FORM_strp pointing outside of .debug_str section [%s]",
> +		      bfd_get_filename (abfd));
>        return NULL;
>      }
>    gdb_assert (HOST_CHAR_BIT == 8);
> @@ -5187,7 +5197,8 @@ die_type (struct die_info *die, struct o
>        type_die = follow_die_ref (ref);
>        if (!type_die)
>  	{
> -	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
> +	  error ("Dwarf Error: Cannot find referent at offset %d [%s]", 
> +			  ref, objfile->name);
>  	  return NULL;
>  	}
>      }
> @@ -5195,7 +5206,8 @@ die_type (struct die_info *die, struct o
>    if (!type)
>      {
>        dump_die (type_die);
> -      error ("Dwarf Error: Problem turning type die at offset into gdb type.");
> +      error ("Dwarf Error: Problem turning type die at offset into gdb type [%s]",
> +		      objfile->name);
>      }
>    return type;
>  }
> @@ -5219,7 +5231,8 @@ die_containing_type (struct die_info *di
>        type_die = follow_die_ref (ref);
>        if (!type_die)
>  	{
> -	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
> +	  error ("Dwarf Error: Cannot find referent at offset %d [%s]", ref, 
> +			  objfile->name);
>  	  return NULL;
>  	}
>        type = tag_type_to_type (type_die, objfile, cu_header);
> @@ -5228,7 +5241,8 @@ die_containing_type (struct die_info *di
>      {
>        if (type_die)
>  	dump_die (type_die);
> -      error ("Dwarf Error: Problem turning containing type into gdb type.");
> +      error ("Dwarf Error: Problem turning containing type into gdb type [%s]", 
> +		      objfile->name);
>      }
>    return type;
>  }
> @@ -5265,7 +5279,8 @@ tag_type_to_type (struct die_info *die, 
>        if (!die->type)
>  	{
>  	  dump_die (die);
> -	  error ("Dwarf Error: Cannot find type of die.");
> +	  error ("Dwarf Error: Cannot find type of die [%s]", 
> +			  objfile->name);
>  	}
>        return die->type;
>      }
> @@ -6437,8 +6452,8 @@ dwarf2_fundamental_type (struct objfile 
>  {
>    if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
>      {
> -      error ("Dwarf Error: internal error - invalid fundamental type id %d.",
> -	     typeid);
> +      error ("Dwarf Error: internal error - invalid fundamental type id %d [%s]",
> +	     typeid, objfile->name);
>      }
>  
>    /* Look for this particular type in the fundamental type vector.  If


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Added verbosity to dwarf2*
  2002-12-14 13:50 ` [RFA] " Michal Ludvig
@ 2002-12-14 22:18   ` Eli Zaretskii
  2002-12-16  5:58     ` Michal Ludvig
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2002-12-14 22:18 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: GDB Patches


On Sat, 14 Dec 2002, Michal Ludvig wrote:

> -      error ("dwarf cfi error: unsupported target address length.");
> +      error ("dwarf cfi error: unsupported target address length [%s]", 
> +		      bfd_get_filename (abfd));

Wouldn't it be better to say "[in module %s]"?  I'm afraid a BFD file 
name alone won't explain enough to the user.  After all, not everyone who 
uses GDB knows all the module names in their program by heart.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Added verbosity to dwarf2*
  2002-12-14 22:18   ` Eli Zaretskii
@ 2002-12-16  5:58     ` Michal Ludvig
  2002-12-16 10:43       ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Ludvig @ 2002-12-16  5:58 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

Eli Zaretskii wrote:
> On Sat, 14 Dec 2002, Michal Ludvig wrote:
> 
> 
>>-      error ("dwarf cfi error: unsupported target address length.");
>>+      error ("dwarf cfi error: unsupported target address length [%s]", 
>>+		      bfd_get_filename (abfd));
> 
> Wouldn't it be better to say "[in module %s]"?  I'm afraid a BFD file 
> name alone won't explain enough to the user.  After all, not everyone who 
> uses GDB knows all the module names in their program by heart.

Well, why not. Anyway if an error or warning like this happens, it's 
usually a GCC or GDB problem, not a user-level mistake. But it's more 
descriptive, I agree.

So can I commit it in this form?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz

[-- Attachment #2: gdb-verbosestrings-5.3.diff --]
[-- Type: text/plain, Size: 16672 bytes --]

Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.16
diff -u -p -r1.16 dwarf2cfi.c
--- dwarf2cfi.c	19 Jul 2002 09:40:51 -0000	1.16
+++ dwarf2cfi.c	16 Dec 2002 08:54:31 -0000
@@ -228,7 +228,7 @@ static LONGEST read_sleb128 (bfd * abfd,
 static CORE_ADDR read_pointer (bfd * abfd, char **p);
 static CORE_ADDR read_encoded_pointer (bfd * abfd, char **p,
 				       unsigned char encoding);
-static enum ptr_encoding pointer_encoding (unsigned char encoding);
+static enum ptr_encoding pointer_encoding (unsigned char encoding, struct objfile *objfile);
 
 static LONGEST read_initial_length (bfd * abfd, char *buf, int *bytes_read);
 static ULONGEST read_length (bfd * abfd, char *buf, int *bytes_read,
@@ -500,7 +500,8 @@ read_pointer (bfd * abfd, char **p)
     case 8:
       return read_8u (abfd, p);
     default:
-      error ("dwarf cfi error: unsupported target address length.");
+      error ("dwarf cfi error: unsupported target address length [in module %s]", 
+		      bfd_get_filename (abfd));
     }
 }
 
@@ -547,7 +548,8 @@ read_encoded_pointer (bfd * abfd, char *
 
     default:
       internal_error (__FILE__, __LINE__,
-		      "read_encoded_pointer: unknown pointer encoding");
+		      "read_encoded_pointer: unknown pointer encoding [in module %s]",
+		      bfd_get_filename (abfd));
     }
 
   return ret;
@@ -558,12 +560,13 @@ read_encoded_pointer (bfd * abfd, char *
  * - encoding & 0x70 : type (absolute, relative, ...)
  * - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80).  */
 enum ptr_encoding
-pointer_encoding (unsigned char encoding)
+pointer_encoding (unsigned char encoding, struct objfile *objfile)
 {
   int ret;
 
   if (encoding & DW_EH_PE_indirect)
-    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect");
+    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect [in module %s]",
+		    objfile->name);
 
   switch (encoding & 0x70)
     {
@@ -575,7 +578,8 @@ pointer_encoding (unsigned char encoding
       ret = encoding & 0x70;
       break;
     default:
-      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding");
+      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding [in module %s]", 
+		      objfile->name);
     }
   return ret;
 }
@@ -652,8 +656,9 @@ execute_cfa_program (struct objfile *obj
 	    fs->pc = read_encoded_pointer (objfile->obfd, &insn_ptr,
 					   fs->addr_encoding);
 
-	    if (pointer_encoding (fs->addr_encoding) != PE_absptr)
-	      warning ("CFI: DW_CFA_set_loc uses relative addressing");
+	    if (pointer_encoding (fs->addr_encoding, objfile) != PE_absptr)
+	      warning ("CFI: DW_CFA_set_loc uses relative addressing [in module %s]", 
+			      objfile->name);
 
 	    break;
 
@@ -802,7 +807,8 @@ execute_cfa_program (struct objfile *obj
 	    break;
 
 	  default:
-	    error ("dwarf cfi error: unknown cfa instruction %d.", insn);
+	    error ("dwarf cfi error: unknown cfa instruction %d [in module %s]", insn, 
+			    objfile->name);
 	  }
     }
 }
@@ -848,13 +854,13 @@ frame_state_for (struct context *context
   gdb_assert (fde->cie_ptr != NULL);
 
   cie = fde->cie_ptr;
-  
+
   fs->code_align = cie->code_align;
   fs->data_align = cie->data_align;
   fs->retaddr_column = cie->ra;
   fs->addr_encoding = cie->addr_encoding;
   fs->objfile = cie->objfile;
-  
+
   execute_cfa_program (cie->objfile, cie->data,
 		       cie->data + cie->data_length, context, fs);
   execute_cfa_program (cie->objfile, fde->data,
@@ -1065,25 +1071,25 @@ execute_stack_op (struct objfile *objfil
 
 	case DW_OP_dup:
 	  if (stack_elt < 1)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  result = stack[stack_elt - 1];
 	  break;
 
 	case DW_OP_drop:
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  goto no_push;
 
 	case DW_OP_pick:
 	  offset = *op_ptr++;
 	  if (offset >= stack_elt - 1)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  result = stack[stack_elt - 1 - offset];
 	  break;
 
 	case DW_OP_over:
 	  if (stack_elt < 2)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  result = stack[stack_elt - 2];
 	  break;
 
@@ -1092,7 +1098,7 @@ execute_stack_op (struct objfile *objfil
 	    CORE_ADDR t1, t2, t3;
 
 	    if (stack_elt < 3)
-	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	      internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	    t1 = stack[stack_elt - 1];
 	    t2 = stack[stack_elt - 2];
 	    t3 = stack[stack_elt - 3];
@@ -1110,7 +1116,7 @@ execute_stack_op (struct objfile *objfil
 	case DW_OP_plus_uconst:
 	  /* Unary operations.  */
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  result = stack[stack_elt];
 
 	  switch (op)
@@ -1120,7 +1126,7 @@ execute_stack_op (struct objfile *objfil
 		int len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
 		if (len != 4 && len != 8)
 		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error");
+				  "execute_stack_op error [in module %s]", objfile->name);
 		result = read_memory_unsigned_integer (result, len);
 	      }
 	      break;
@@ -1128,9 +1134,9 @@ execute_stack_op (struct objfile *objfil
 	    case DW_OP_deref_size:
 	      {
 		int len = *op_ptr++;
-		if (len != 1 && len != 2 && len != 4 && len !=8)
+		if (len != 1 && len != 2 && len != 4 && len != 8)
 		  internal_error (__FILE__, __LINE__,
-				  "execute_stack_op error");
+				  "execute_stack_op error [in module %s]", objfile->name);
 		result = read_memory_unsigned_integer (result, len);
 	      }
 	      break;
@@ -1170,7 +1176,7 @@ execute_stack_op (struct objfile *objfil
 	    /* Binary operations.  */
 	    CORE_ADDR first, second;
 	    if ((stack_elt -= 2) < 0)
-	      internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	      internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	    second = stack[stack_elt];
 	    first = stack[stack_elt + 1];
 
@@ -1228,7 +1234,7 @@ execute_stack_op (struct objfile *objfil
 		result = (LONGEST) first != (LONGEST) second;
 		break;
 	      default:
-		error ("execute_stack_op: Unknown DW_OP_ value");
+		error ("execute_stack_op: Unknown DW_OP_ value [in module %s]", objfile->name);
 		break;
 	      }
 	  }
@@ -1241,7 +1247,7 @@ execute_stack_op (struct objfile *objfil
 
 	case DW_OP_bra:
 	  if (--stack_elt < 0)
-	    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	  offset = read_2s (objfile->obfd, &op_ptr);
 	  if (stack[stack_elt] != 0)
 	    op_ptr += offset;
@@ -1251,12 +1257,12 @@ execute_stack_op (struct objfile *objfil
 	  goto no_push;
 
 	default:
-	  internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	  internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
 	}
 
       /* Most things push a result value.  */
       if ((size_t) stack_elt >= sizeof (stack) / sizeof (*stack))
-	internal_error (__FILE__, __LINE__, "execute_stack_op error");
+	internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
       stack[++stack_elt] = result;
     no_push:;
     }
@@ -1264,7 +1270,7 @@ execute_stack_op (struct objfile *objfil
   /* We were executing this program to get a value.  It should be
      at top of stack.  */
   if (--stack_elt < 0)
-    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+    internal_error (__FILE__, __LINE__, "execute_stack_op error [in module %s]", objfile->name);
   return stack[stack_elt];
 }
 
@@ -1349,7 +1355,8 @@ update_context (struct context *context,
 	      orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr;
 	    break;
 	  default:
-	    internal_error (__FILE__, __LINE__, "bad switch");
+	    internal_error (__FILE__, __LINE__, "bad switch 0x%02X", 
+			    orig_context->reg[fs->regs.reg[i].loc.reg].how);
 	  }
 	break;
       case REG_SAVED_EXP:
@@ -1366,7 +1373,8 @@ update_context (struct context *context,
 	}
 	break;
       default:
-	internal_error (__FILE__, __LINE__, "bad switch");
+	internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
+			fs->regs.reg[i].how);
       }
   get_reg ((char *) &context->ra, context, fs->retaddr_column);
   unwind_tmp_obstack_free ();
@@ -1576,13 +1584,14 @@ parse_frame_info (struct objfile *objfil
 		      cie = cie->next;
 		    }
 		  if (!cie)
-		    error ("CFI: can't find CIE pointer");
+		    error ("CFI: can't find CIE pointer [in module %s]", 
+				    bfd_get_filename (abfd));
 		}
 
 	      init_loc = read_encoded_pointer (abfd, &start,
 					       cie->addr_encoding);
 
-	      switch (pointer_encoding (cie->addr_encoding))
+	      switch (pointer_encoding (cie->addr_encoding, objfile))
 		{
 		case PE_absptr:
 		  break;
@@ -1592,7 +1601,8 @@ parse_frame_info (struct objfile *objfil
 		  init_loc += curr_section_vma + start - frame_buffer;
 		  break;
 		default:
-		  warning ("CFI: Unsupported pointer encoding\n");
+		  warning ("CFI: Unsupported pointer encoding [in module %s]",
+				  bfd_get_filename (abfd));
 		}
 
 	      /* For relocatable objects we must add an offset telling
@@ -1918,7 +1928,8 @@ cfi_get_saved_register (char *raw_buffer
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "cfi_get_saved_register: unknown register rule");
+			  "cfi_get_saved_register: unknown register rule 0x%02X",
+			  UNWIND_CONTEXT (frame)->reg[regnum].how);
 	}
     }
 }
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.66.2.2
diff -u -p -r1.66.2.2 dwarf2read.c
--- dwarf2read.c	25 Nov 2002 21:46:54 -0000	1.66.2.2
+++ dwarf2read.c	16 Dec 2002 08:54:32 -0000
@@ -1196,22 +1196,24 @@ dwarf2_build_psymtabs_hard (struct objfi
 
       if (cu_header.version != 2)
 	{
-	  error ("Dwarf Error: wrong version in compilation unit header.");
+	  error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [in module %s]", cu_header.version, 2, bfd_get_filename (abfd));
 	  return;
 	}
       if (cu_header.abbrev_offset >= dwarf_abbrev_size)
 	{
-	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6).",
+	  error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6) [in module %s]",
 		 (long) cu_header.abbrev_offset,
-		 (long) (beg_of_comp_unit - dwarf_info_buffer));
+		 (long) (beg_of_comp_unit - dwarf_info_buffer),
+		 bfd_get_filename (abfd));
 	  return;
 	}
       if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size
 	  > dwarf_info_buffer + dwarf_info_size)
 	{
-	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).",
+	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0) [in module %s]",
 		 (long) cu_header.length,
-		 (long) (beg_of_comp_unit - dwarf_info_buffer));
+		 (long) (beg_of_comp_unit - dwarf_info_buffer),
+		 bfd_get_filename (abfd));
 	  return;
 	}
       /* Read the abbrevs for this compilation unit into a table */
@@ -3551,7 +3553,8 @@ read_partial_die (struct partial_die_inf
   abbrev = dwarf2_lookup_abbrev (abbrev_number);
   if (!abbrev)
     {
-      error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: Could not find abbrev number %d [in module %s]", abbrev_number,
+		      bfd_get_filename (abfd));
     }
   part_die->offset = info_ptr - dwarf_info_buffer;
   part_die->tag = abbrev->tag;
@@ -3695,7 +3698,8 @@ read_full_die (struct die_info **diep, b
   abbrev = dwarf2_lookup_abbrev (abbrev_number);
   if (!abbrev)
     {
-      error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: could not find abbrev number %d [in module %s]", abbrev_number, 
+		      bfd_get_filename (abfd));
     }
   die = dwarf_alloc_die ();
   die->offset = offset;
@@ -3831,8 +3835,9 @@ read_attribute_value (struct attribute *
       info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header);
       break;
     default:
-      error ("Dwarf Error: Cannot handle %s in DWARF reader.",
-	     dwarf_form_name (form));
+      error ("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]",
+	     dwarf_form_name (form),
+	     bfd_get_filename (abfd));
     }
   return info_ptr;
 }
@@ -3913,7 +3918,8 @@ read_address (bfd *abfd, char *buf, cons
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "read_address: bad switch, signed");
+			  "read_address: bad switch, signed [in module %s]",
+			  bfd_get_filename (abfd));
 	}
     }
   else
@@ -3931,7 +3937,8 @@ read_address (bfd *abfd, char *buf, cons
 	  break;
 	default:
 	  internal_error (__FILE__, __LINE__,
-			  "read_address: bad switch, unsigned");
+			  "read_address: bad switch, unsigned [in module %s]",
+			  bfd_get_filename (abfd));
 	}
     }
 
@@ -4046,7 +4053,8 @@ read_offset (bfd *abfd, char *buf, const
       break;
     default:
       internal_error (__FILE__, __LINE__,
-		      "read_offset: bad switch");
+		      "read_offset: bad switch [in module %s]",
+		      bfd_get_filename (abfd));
     }
 
  return retval;
@@ -4088,12 +4096,14 @@ read_indirect_string (bfd *abfd, char *b
 
   if (dwarf_str_buffer == NULL)
     {
-      error ("DW_FORM_strp used without .debug_str section");
+      error ("DW_FORM_strp used without .debug_str section [in module %s]",
+		      bfd_get_filename (abfd));
       return NULL;
     }
   if (str_offset >= dwarf_str_size)
     {
-      error ("DW_FORM_strp pointing outside of .debug_str section");
+      error ("DW_FORM_strp pointing outside of .debug_str section [in module %s]",
+		      bfd_get_filename (abfd));
       return NULL;
     }
   gdb_assert (HOST_CHAR_BIT == 8);
@@ -5091,7 +5101,8 @@ die_type (struct die_info *die, struct o
       type_die = follow_die_ref (ref);
       if (!type_die)
 	{
-	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+	  error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", 
+			  ref, objfile->name);
 	  return NULL;
 	}
     }
@@ -5099,7 +5110,8 @@ die_type (struct die_info *die, struct o
   if (!type)
     {
       dump_die (type_die);
-      error ("Dwarf Error: Problem turning type die at offset into gdb type.");
+      error ("Dwarf Error: Problem turning type die at offset into gdb type [in module %s]",
+		      objfile->name);
     }
   return type;
 }
@@ -5123,7 +5135,8 @@ die_containing_type (struct die_info *di
       type_die = follow_die_ref (ref);
       if (!type_die)
 	{
-	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+	  error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", ref, 
+			  objfile->name);
 	  return NULL;
 	}
       type = tag_type_to_type (type_die, objfile, cu_header);
@@ -5132,7 +5145,8 @@ die_containing_type (struct die_info *di
     {
       if (type_die)
 	dump_die (type_die);
-      error ("Dwarf Error: Problem turning containing type into gdb type.");
+      error ("Dwarf Error: Problem turning containing type into gdb type [in module %s]", 
+		      objfile->name);
     }
   return type;
 }
@@ -5169,7 +5183,8 @@ tag_type_to_type (struct die_info *die, 
       if (!die->type)
 	{
 	  dump_die (die);
-	  error ("Dwarf Error: Cannot find type of die.");
+	  error ("Dwarf Error: Cannot find type of die [in module %s]", 
+			  objfile->name);
 	}
       return die->type;
     }
@@ -6329,8 +6344,8 @@ dwarf2_fundamental_type (struct objfile 
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
-      error ("Dwarf Error: internal error - invalid fundamental type id %d.",
-	     typeid);
+      error ("Dwarf Error: internal error - invalid fundamental type id %d [in module %s]",
+	     typeid, objfile->name);
     }
 
   /* Look for this particular type in the fundamental type vector.  If

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Added verbosity to dwarf2*
  2002-12-16  5:58     ` Michal Ludvig
@ 2002-12-16 10:43       ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2002-12-16 10:43 UTC (permalink / raw)
  To: mludvig; +Cc: gdb-patches

> Date: Mon, 16 Dec 2002 09:55:50 +0100
> From: Michal Ludvig <mludvig@suse.cz>
> > 
> > Wouldn't it be better to say "[in module %s]"?  I'm afraid a BFD file 
> > name alone won't explain enough to the user.  After all, not everyone who 
> > uses GDB knows all the module names in their program by heart.
> 
> Well, why not. Anyway if an error or warning like this happens, it's 
> usually a GCC or GDB problem, not a user-level mistake. But it's more 
> descriptive, I agree.
> 
> So can I commit it in this form?

Fine with me, but I don't think I can approve patches to the DWARF2
reader.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Added verbosity to dwarf2*
  2002-12-14 10:34 [PATCH] Added verbosity to dwarf2* Michal Ludvig
  2002-12-14 13:50 ` [RFA] " Michal Ludvig
@ 2003-02-03 14:43 ` Michal Ludvig
  2003-02-03 15:26   ` Andrew Cagney
  1 sibling, 1 reply; 9+ messages in thread
From: Michal Ludvig @ 2003-02-03 14:43 UTC (permalink / raw)
  To: GDB Patches

Michal Ludvig wrote:
> this patch adds some more verbosity to GDB's error messages. I've found 
> it very useful for bugreports, because you can locate the failing 
> testcase much faster when knowing in what objfile it fails.
> It also helps GCC developers hunting their bugs in DWARF2 generator.
> 
> OK to commit to mainline? And to 5.3 branch?

Because noone complained for a long time and it's only about changing 
some strings, not changing a functionality, I've committed the patch to 
both mainline and branch.

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Added verbosity to dwarf2*
  2003-02-03 14:43 ` [PATCH] " Michal Ludvig
@ 2003-02-03 15:26   ` Andrew Cagney
  2003-02-03 15:49     ` Michal Ludvig
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2003-02-03 15:26 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: GDB Patches

> Michal Ludvig wrote:
> this patch adds some more verbosity to GDB's error messages. I've found it very useful for bugreports, because you can locate the failing testcase much faster when knowing in what objfile it fails.
> It also helps GCC developers hunting their bugs in DWARF2 generator.
> 
> OK to commit to mainline? And to 5.3 branch?
> 
> Because noone complained for a long time and it's only about changing some strings, not changing a functionality, I've committed the patch to both mainline and branch.

Michael, just FYI, if a patch goes into limbo (as in has an unclear 
approval status) then the best thing to do is `ping'.

Andrew



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Added verbosity to dwarf2*
  2003-02-03 15:26   ` Andrew Cagney
@ 2003-02-03 15:49     ` Michal Ludvig
  2003-02-03 15:59       ` Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Ludvig @ 2003-02-03 15:49 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: GDB Patches

Andrew Cagney wrote:
>> Michal Ludvig wrote:
>> this patch adds some more verbosity to GDB's error messages. I've 
>> found it very useful for bugreports, because you can locate the 
>> failing testcase much faster when knowing in what objfile it fails.
>> It also helps GCC developers hunting their bugs in DWARF2 generator.
>>
>> OK to commit to mainline? And to 5.3 branch?
>>
>> Because noone complained for a long time and it's only about changing 
>> some strings, not changing a functionality, I've committed the patch 
>> to both mainline and branch.
> 
> 
> Michael, just FYI, if a patch goes into limbo (as in has an unclear 
> approval status) then the best thing to do is `ping'.

If it was something more than changing some strings I'd 'ping' it, for 
sure. But with this simple patch I decided for commit.
I'm sorry if I should ping it. Should I revert the changes?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Added verbosity to dwarf2*
  2003-02-03 15:49     ` Michal Ludvig
@ 2003-02-03 15:59       ` Andrew Cagney
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Cagney @ 2003-02-03 15:59 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: GDB Patches

> Should I revert the changes?

No.

Andrew



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-02-03 15:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-14 10:34 [PATCH] Added verbosity to dwarf2* Michal Ludvig
2002-12-14 13:50 ` [RFA] " Michal Ludvig
2002-12-14 22:18   ` Eli Zaretskii
2002-12-16  5:58     ` Michal Ludvig
2002-12-16 10:43       ` Eli Zaretskii
2003-02-03 14:43 ` [PATCH] " Michal Ludvig
2003-02-03 15:26   ` Andrew Cagney
2003-02-03 15:49     ` Michal Ludvig
2003-02-03 15:59       ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox