This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] dwarf2read.c: complain() -> complaint()


In a recently submitted patch, I added a new complaint to dwarf2read.c
using the old (deprecated) interface.  Andrew asked me to use the new
interface.  I've generated a patch for dwarf2read.c which converts all
calls to complain() to complaint().

I've written a script to do this transformation.  It finds all of the
deprecated_complaint structs and counts the uses of these structs. 
(Surprisingly, some were unused!)  For cases where there's more than
one occurrence, it creates a new function as suggested in
complaints.h.  For the rest, it performs the obvious transformation.

The script also uses GNU indent to perform localized reindentations of
the affected text.

If this patch is accepted (and this approach is deemed acceptable), I'll
generate patches for the other files which still use complain().

Okay to commit?

	* dwarf2read.c (dwarf2_const_ignored, dwarf2_volatile_ignored)
	(dwarf2_non_const_array_bound_ignored)
	(dwarf2_missing_line_number_section)
	(dwarf2_statement_list_fits_in_line_number_section)
	(dwarf2_mangled_line_number_section, dwarf2_unsupported_die_ref_attr)
	(dwarf2_unsupported_stack_op, dwarf2_complex_location_expr)
	(dwarf2_unsupported_tag, dwarf2_unsupported_at_encoding)
	(dwarf2_unsupported_at_frame_base, dwarf2_unexpected_tag)
	(dwarf2_missing_at_frame_base, dwarf2_bad_static_member_name)
	(dwarf2_unsupported_accessibility, dwarf2_bad_member_name_complaint)
	(dwarf2_missing_member_fn_type_complaint)
	(dwarf2_vtbl_not_found_complaint, dwarf2_absolute_sibling_complaint)
	(dwarf2_const_value_length_mismatch)
	(dwarf2_unsupported_const_value_attr, dwarf2_misplaced_line_number)
	(dwarf2_line_header_too_long, dwarf2_missing_macinfo_section)
	(dwarf2_macros_too_long, dwarf2_macros_not_terminated)
	(dwarf2_macro_outside_file, dwarf2_macro_unmatched_end_file)
	(dwarf2_macro_malformed_definition, dwarf2_macro_spaces_in_definition)
	(dwarf2_invalid_attrib_class, dwarf2_invalid_pointer_size): Delete
	complaints using deprecated struct..
	(dwarf2_non_const_array_bound_ignored_complaint)
	(dwarf2_complex_location_expr_complaint)
	(dwarf2_unsupported_at_frame_base_complaint)
	(dwarf2_const_value_length_mismatch_complaint)
	(dwarf2_macros_too_long_complaint)
	(dwarf2_macro_malformed_definition_complaint)
	(dwarf2_invalid_attrib_class_complaint): New functions.
	(read_func_scope, dwarf2_attach_fields_to_type, dwarf2_add_member_fn)
	(read_structure_scope, read_array_type, read_common_block)
	(read_tag_pointer_type, read_base_type, read_partial_die)
	(dwarf_decode_line_header, check_cu_functions, dwarf_decode_lines)
	(new_symbol, dwarf2_const_value, read_type_die)
	(dwarf2_get_ref_die_offset, decode_locdesc, consume_improper_spaces)
	(parse_macro_definition, dwarf_decode_macros): Replace calls to
	complain() with, possibly indirect, calls to complaint().

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.77
diff -u -p -r1.77 dwarf2read.c
--- dwarf2read.c	5 Dec 2002 23:13:47 -0000	1.77
+++ dwarf2read.c	9 Dec 2002 23:07:58 -0000
@@ -561,138 +561,63 @@ struct field_info
 
 /* Various complaints about symbol reading that don't abort the process */
 
-static struct deprecated_complaint dwarf2_const_ignored =
+static void
+dwarf2_non_const_array_bound_ignored_complaint (const char *arg1)
+{
+  complaint (&symfile_complaints, "non-constant array bounds form '%s' ignored",
+	     arg1);
+}
+
+static void
+dwarf2_statement_list_fits_in_line_number_section_complaint (void)
 {
-  "type qualifier 'const' ignored", 0, 0
-};
-static struct deprecated_complaint dwarf2_volatile_ignored =
-{
-  "type qualifier 'volatile' ignored", 0, 0
-};
-static struct deprecated_complaint dwarf2_non_const_array_bound_ignored =
-{
-  "non-constant array bounds form '%s' ignored", 0, 0
-};
-static struct deprecated_complaint dwarf2_missing_line_number_section =
-{
-  "missing .debug_line section", 0, 0
-};
-static struct deprecated_complaint dwarf2_statement_list_fits_in_line_number_section =
-{
-  "statement list doesn't fit in .debug_line section", 0, 0
-};
-static struct deprecated_complaint dwarf2_mangled_line_number_section =
-{
-  "mangled .debug_line section", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_die_ref_attr =
-{
-  "unsupported die ref attribute form: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_stack_op =
-{
-  "unsupported stack op: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_complex_location_expr =
-{
-  "location expression too complex", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_tag =
-{
-  "unsupported tag: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_at_encoding =
-{
-  "unsupported DW_AT_encoding: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_at_frame_base =
-{
-  "unsupported DW_AT_frame_base for function '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_unexpected_tag =
-{
-  "unexepected tag in read_type_die: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_missing_at_frame_base =
-{
-  "DW_AT_frame_base missing for DW_OP_fbreg", 0, 0
-};
-static struct deprecated_complaint dwarf2_bad_static_member_name =
-{
-  "unrecognized static data member name '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_accessibility =
-{
-  "unsupported accessibility %d", 0, 0
-};
-static struct deprecated_complaint dwarf2_bad_member_name_complaint =
-{
-  "cannot extract member name from '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_missing_member_fn_type_complaint =
-{
-  "member function type missing for '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_vtbl_not_found_complaint =
-{
-  "virtual function table pointer not found when defining class '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_absolute_sibling_complaint =
-{
-  "ignoring absolute DW_AT_sibling", 0, 0
-};
-static struct deprecated_complaint dwarf2_const_value_length_mismatch =
-{
-  "const value length mismatch for '%s', got %d, expected %d", 0, 0
-};
-static struct deprecated_complaint dwarf2_unsupported_const_value_attr =
-{
-  "unsupported const value attribute form: '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_misplaced_line_number =
-{
-  "misplaced first line number at 0x%lx for '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_line_header_too_long =
-{
-  "line number info header doesn't fit in `.debug_line' section", 0, 0
-};
-static struct deprecated_complaint dwarf2_missing_macinfo_section =
-{
-  "missing .debug_macinfo section", 0, 0
-};
-static struct deprecated_complaint dwarf2_macros_too_long =
-{
-  "macro info runs off end of `.debug_macinfo' section", 0, 0
-};
-static struct deprecated_complaint dwarf2_macros_not_terminated =
-{
-  "no terminating 0-type entry for macros in `.debug_macinfo' section", 0, 0
-};
-static struct deprecated_complaint dwarf2_macro_outside_file =
-{
-  "debug info gives macro %s outside of any file: %s", 0, 0
-};
-static struct deprecated_complaint dwarf2_macro_unmatched_end_file =
-{
-  "macro debug info has an unmatched `close_file' directive", 0, 0
-};
-static struct deprecated_complaint dwarf2_macro_malformed_definition =
-{
-  "macro debug info contains a malformed macro definition:\n`%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_macro_spaces_in_definition =
-{
-  "macro definition contains spaces in formal argument list:\n`%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_invalid_attrib_class =
-{
-  "invalid attribute class or form for '%s' in '%s'", 0, 0
-};
-static struct deprecated_complaint dwarf2_invalid_pointer_size = 
+  complaint (&symfile_complaints,
+	     "statement list doesn't fit in .debug_line section");
+}
+
+static void
+dwarf2_complex_location_expr_complaint (void)
 {
-  "invalid pointer size %d", 0, 0
-};
+  complaint (&symfile_complaints, "location expression too complex");
+}
+
+static void
+dwarf2_unsupported_at_frame_base_complaint (const char *arg1)
+{
+  complaint (&symfile_complaints,
+	     "unsupported DW_AT_frame_base for function '%s'", arg1);
+}
+
+static void
+dwarf2_const_value_length_mismatch_complaint (const char *arg1, int arg2,
+					      int arg3)
+{
+  complaint (&symfile_complaints,
+	     "const value length mismatch for '%s', got %d, expected %d", arg1,
+	     arg2, arg3);
+}
+
+static void
+dwarf2_macros_too_long_complaint (void)
+{
+  complaint (&symfile_complaints,
+	     "macro info runs off end of `.debug_macinfo' section");
+}
+
+static void
+dwarf2_macro_malformed_definition_complaint (const char *arg1)
+{
+  complaint (&symfile_complaints,
+	     "macro debug info contains a malformed macro definition:\n`%s'",
+	     arg1);
+}
+
+static void
+dwarf2_invalid_attrib_class_complaint (const char *arg1, const char *arg2)
+{
+  complaint (&symfile_complaints,
+	     "invalid attribute class or form for '%s' in '%s'", arg1, arg2);
+}
 
 /* local function prototypes */
 
@@ -1975,17 +1900,17 @@ read_func_scope (struct die_info *die, s
         }
       else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
         {
-          complain (&dwarf2_complex_location_expr);
+	  dwarf2_complex_location_expr_complaint ();
           addr = 0;
         }
       else
         {
-          complain (&dwarf2_invalid_attrib_class, "DW_AT_frame_base", name);
+	  dwarf2_invalid_attrib_class_complaint ("DW_AT_frame_base", name);
           addr = 0;
         }
     
       if (isderef)
-	complain (&dwarf2_unsupported_at_frame_base, name);
+	dwarf2_unsupported_at_frame_base_complaint (name);
       else if (isreg)
 	frame_base_reg = addr;
       else if (offreg)
@@ -1994,7 +1919,7 @@ read_func_scope (struct die_info *die, s
 	  frame_base_offset = addr;
 	}
       else
-	complain (&dwarf2_unsupported_at_frame_base, name);
+	dwarf2_unsupported_at_frame_base_complaint (name);
     }
 
   new = push_context (0, lowpc);
@@ -2345,8 +2270,8 @@ dwarf2_attach_fields_to_type (struct fie
 	default:
 	  /* Unknown accessibility.  Complain and treat it as public.  */
 	  {
-	    complain (&dwarf2_unsupported_accessibility,
-		      fip->fields->accessibility);
+	    complaint (&symfile_complaints, "unsupported accessibility %d",
+		       fip->fields->accessibility);
 	  }
 	  break;
 	}
@@ -2454,7 +2379,8 @@ dwarf2_add_member_fn (struct field_info 
 	fnp->voffset = VOFFSET_STATIC;
     }
   else
-    complain (&dwarf2_missing_member_fn_type_complaint, physname);
+    complaint (&symfile_complaints, "member function type missing for '%s'",
+	       physname);
 
   /* Get fcontext from DW_AT_containing_type if present.  */
   if (dwarf_attr (die, DW_AT_containing_type) != NULL)
@@ -2494,12 +2420,12 @@ dwarf2_add_member_fn (struct field_info 
         }
       else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
         {
-          complain (&dwarf2_complex_location_expr);
+	  dwarf2_complex_location_expr_complaint ();
         }
       else
         {
-          complain (&dwarf2_invalid_attrib_class, "DW_AT_vtable_elem_location",
-                    fieldname);
+	  dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location",
+						 fieldname);
         }
    }
 }
@@ -2681,8 +2607,10 @@ read_structure_scope (struct die_info *d
 
 		  /* Complain if virtual function table field not found.  */
 		  if (i < TYPE_N_BASECLASSES (t))
-		    complain (&dwarf2_vtbl_not_found_complaint,
-			  TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) : "");
+		    complaint (&symfile_complaints,
+			       "virtual function table pointer not found when defining class '%s'",
+			       TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) :
+			       "");
 		}
 	      else
 		{
@@ -2870,8 +2798,8 @@ read_array_type (struct die_info *die, s
 		}
 	      else
 		{
-		  complain (&dwarf2_non_const_array_bound_ignored,
-			    dwarf_form_name (attr->form));
+		  dwarf2_non_const_array_bound_ignored_complaint
+		    (dwarf_form_name (attr->form));
 #ifdef FORTRAN_HACK
 		  die->type = lookup_pointer_type (element_type);
 		  return;
@@ -2906,8 +2834,8 @@ read_array_type (struct die_info *die, s
 		}
 	      else
 		{
-		  complain (&dwarf2_non_const_array_bound_ignored,
-			    dwarf_form_name (attr->form));
+		  dwarf2_non_const_array_bound_ignored_complaint
+		    (dwarf_form_name (attr->form));
 #ifdef FORTRAN_HACK
 		  die->type = lookup_pointer_type (element_type);
 		  return;
@@ -2974,12 +2902,12 @@ read_common_block (struct die_info *die,
         }
       else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
         {
-          complain (&dwarf2_complex_location_expr);
+	  dwarf2_complex_location_expr_complaint ();
         }
       else
         {
-          complain (&dwarf2_invalid_attrib_class, "DW_AT_location",
-                    "common block member");
+	  dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
+						 "common block member");
         }
     }
   if (die->has_children)
@@ -3067,7 +2995,7 @@ read_tag_pointer_type (struct die_info *
 	}
       else if (TYPE_LENGTH (type) != byte_size)
 	{
-	  complain (&dwarf2_invalid_pointer_size, byte_size);
+	  complaint (&symfile_complaints, "invalid pointer size %d", byte_size);
 	}
       else {
 	/* Should we also complain about unhandled address classes?  */
@@ -3370,8 +3298,8 @@ read_base_type (struct die_info *die, st
 	  type_flags |= TYPE_FLAG_UNSIGNED;
 	  break;
 	default:
-	  complain (&dwarf2_unsupported_at_encoding,
-		    dwarf_type_encoding_name (encoding));
+	  complaint (&symfile_complaints, "unsupported DW_AT_encoding: '%s'",
+		     dwarf_type_encoding_name (encoding));
 	  break;
 	}
       type = init_type (code, size, type_flags, DW_STRING (attr), objfile);
@@ -3687,12 +3615,12 @@ read_partial_die (struct partial_die_inf
             }
           else if (attr.form == DW_FORM_data4 || attr.form == DW_FORM_data8)
             {
-              complain (&dwarf2_complex_location_expr);
+	      dwarf2_complex_location_expr_complaint ();
             }
           else
             {
-              complain (&dwarf2_invalid_attrib_class, "DW_AT_location",
-                        "partial symbol information");
+	      dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
+						     "partial symbol information");
             }
 	  break;
 	case DW_AT_language:
@@ -3716,7 +3644,7 @@ read_partial_die (struct partial_die_inf
 	  /* Ignore absolute siblings, they might point outside of
 	     the current compile unit.  */
 	  if (attr.form == DW_FORM_ref_addr)
-	    complain (&dwarf2_absolute_sibling_complaint);
+	    complaint (&symfile_complaints, "ignoring absolute DW_AT_sibling");
 	  else
 	    part_die->sibling =
 	      dwarf_info_buffer + dwarf2_get_ref_die_offset (&attr);
@@ -4428,7 +4356,7 @@ dwarf_decode_line_header (unsigned int o
 
   if (dwarf_line_buffer == NULL)
     {
-      complain (&dwarf2_missing_line_number_section);
+      complaint (&symfile_complaints, "missing .debug_line section");
       return 0;
     }
 
@@ -4436,7 +4364,7 @@ dwarf_decode_line_header (unsigned int o
      could be 12 bytes long, but we're just going to fudge that.  */
   if (offset + 4 >= dwarf_line_size)
     {
-      complain (&dwarf2_statement_list_fits_in_line_number_section);
+      dwarf2_statement_list_fits_in_line_number_section_complaint ();
       return 0;
     }
 
@@ -4452,7 +4380,7 @@ dwarf_decode_line_header (unsigned int o
   line_ptr += bytes_read;
   if (line_ptr + lh->total_length > dwarf_line_buffer + dwarf_line_size)
     {
-      complain (&dwarf2_statement_list_fits_in_line_number_section);
+      dwarf2_statement_list_fits_in_line_number_section_complaint ();
       return 0;
     }
   lh->statement_program_end = line_ptr + lh->total_length;
@@ -4507,7 +4435,8 @@ dwarf_decode_line_header (unsigned int o
   lh->statement_program_start = line_ptr; 
 
   if (line_ptr > dwarf_line_buffer + dwarf_line_size)
-    complain (&dwarf2_line_header_too_long);
+    complaint (&symfile_complaints,
+	       "line number info header doesn't fit in `.debug_line' section");
 
   discard_cleanups (back_to);
   return lh;
@@ -4552,8 +4481,9 @@ check_cu_functions (CORE_ADDR address)
   if (fn->seen_line)
     return address;
   if (address != fn->lowpc)
-    complain (&dwarf2_misplaced_line_number,
-	      (unsigned long) address, fn->name);
+    complaint (&symfile_complaints,
+	       "misplaced first line number at 0x%lx for '%s'",
+	       (unsigned long) address, fn->name);
   fn->seen_line = 1;
   return fn->lowpc;
 }
@@ -4656,7 +4586,8 @@ dwarf_decode_lines (struct line_header *
                   }
 		  break;
 		default:
-		  complain (&dwarf2_mangled_line_number_section);
+		  complaint (&symfile_complaints,
+			     "mangled .debug_line section");
 		  return;
 		}
 	      break;
@@ -4880,12 +4811,12 @@ new_symbol (struct die_info *die, struct
                   else if (attr->form == DW_FORM_data4
                            || attr->form == DW_FORM_data8)
                     {
-                      complain (&dwarf2_complex_location_expr);
+		      dwarf2_complex_location_expr_complaint ();
                     }
                   else
                     {
-                      complain (&dwarf2_invalid_attrib_class, "DW_AT_location",
-                                "external variable");
+		      dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
+							     "external variable");
                     }
 		  add_symbol_to_list (sym, &global_symbols);
                   if (is_thread_local)
@@ -4926,12 +4857,12 @@ new_symbol (struct die_info *die, struct
                   else if (attr->form == DW_FORM_data4
                            || attr->form == DW_FORM_data8)
                     {
-                      complain (&dwarf2_complex_location_expr);
+		      dwarf2_complex_location_expr_complaint ();
                     }
                   else
                     {
-                      complain (&dwarf2_invalid_attrib_class, "DW_AT_location",
-                                "external variable");
+		      dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
+							     "external variable");
                       addr = 0;
                     }
 		  add_symbol_to_list (sym, list_in_scope);
@@ -5003,7 +4934,7 @@ new_symbol (struct die_info *die, struct
 		  if (isderef)
 		    {
 		      if (basereg != frame_base_reg)
-			complain (&dwarf2_complex_location_expr);
+			dwarf2_complex_location_expr_complaint ();
 		      SYMBOL_CLASS (sym) = LOC_REF_ARG;
 		    }
 		  else
@@ -5074,7 +5005,8 @@ new_symbol (struct die_info *die, struct
 	     trash data, but since we must specifically ignore things
 	     we don't recognize, there is nothing else we should do at
 	     this point. */
-	  complain (&dwarf2_unsupported_tag, dwarf_tag_name (die->tag));
+	  complaint (&symfile_complaints, "unsupported tag: '%s'",
+		     dwarf_tag_name (die->tag));
 	  break;
 	}
     }
@@ -5094,8 +5026,10 @@ dwarf2_const_value (struct attribute *at
     {
     case DW_FORM_addr:
       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != cu_header->addr_size)
-	complain (&dwarf2_const_value_length_mismatch, SYMBOL_NAME (sym),
-		  cu_header->addr_size, TYPE_LENGTH (SYMBOL_TYPE (sym)));
+	dwarf2_const_value_length_mismatch_complaint (SYMBOL_NAME (sym),
+						      cu_header->addr_size,
+						      TYPE_LENGTH (SYMBOL_TYPE
+								   (sym)));
       SYMBOL_VALUE_BYTES (sym) = (char *)
 	obstack_alloc (&objfile->symbol_obstack, cu_header->addr_size);
       store_address (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size,
@@ -5108,8 +5042,10 @@ dwarf2_const_value (struct attribute *at
     case DW_FORM_block:
       blk = DW_BLOCK (attr);
       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size)
-	complain (&dwarf2_const_value_length_mismatch, SYMBOL_NAME (sym),
-		  blk->size, TYPE_LENGTH (SYMBOL_TYPE (sym)));
+	dwarf2_const_value_length_mismatch_complaint (SYMBOL_NAME (sym),
+						      blk->size,
+						      TYPE_LENGTH (SYMBOL_TYPE
+								   (sym)));
       SYMBOL_VALUE_BYTES (sym) = (char *)
 	obstack_alloc (&objfile->symbol_obstack, blk->size);
       memcpy (SYMBOL_VALUE_BYTES (sym), blk->data, blk->size);
@@ -5145,8 +5081,9 @@ dwarf2_const_value (struct attribute *at
       break;
 
     default:
-      complain (&dwarf2_unsupported_const_value_attr,
-		dwarf_form_name (attr->form));
+      complaint (&symfile_complaints,
+		 "unsupported const value attribute form: '%s'",
+		 dwarf_form_name (attr->form));
       SYMBOL_VALUE (sym) = 0;
       SYMBOL_CLASS (sym) = LOC_CONST;
       break;
@@ -5329,7 +5266,8 @@ read_type_die (struct die_info *die, str
       read_base_type (die, objfile);
       break;
     default:
-      complain (&dwarf2_unexpected_tag, dwarf_tag_name (die->tag));
+      complaint (&symfile_complaints, "unexepected tag in read_type_die: '%s'",
+		 dwarf_tag_name (die->tag));
       break;
     }
 }
@@ -6420,7 +6358,9 @@ dwarf2_get_ref_die_offset (struct attrib
       result = cu_header_offset + DW_UNSND (attr);
       break;
     default:
-      complain (&dwarf2_unsupported_die_ref_attr, dwarf_form_name (attr->form));
+      complaint (&symfile_complaints,
+		 "unsupported die ref attribute form: '%s'",
+		 dwarf_form_name (attr->form));
     }
   return result;
 }
@@ -6656,7 +6596,8 @@ decode_locdesc (struct dwarf_block *blk,
 	    }
 	  else
 	    {
-	      complain (&dwarf2_missing_at_frame_base);
+	      complaint (&symfile_complaints,
+			 "DW_AT_frame_base missing for DW_OP_fbreg");
 	      islocal = 1;
 	    }
 	  break;
@@ -6733,7 +6674,7 @@ decode_locdesc (struct dwarf_block *blk,
 	  /* If we're not the last op, then we definitely can't encode
 	     this using GDB's address_class enum.  */
 	  if (i < size)
-	    complain (&dwarf2_complex_location_expr);
+	    dwarf2_complex_location_expr_complaint ();
 	  break;
 
         case DW_OP_GNU_push_tls_address:
@@ -6743,11 +6684,12 @@ decode_locdesc (struct dwarf_block *blk,
 	  /* Nothing should follow this operator, so the top of stack would
 	     be returned.  */
 	  if (i < size)
-	    complain (&dwarf2_complex_location_expr);
+	    dwarf2_complex_location_expr_complaint ();
           break;
 
 	default:
-	  complain (&dwarf2_unsupported_stack_op, dwarf_stack_op_name (op));
+	  complaint (&symfile_complaints, "unsupported stack op: '%s'",
+		     dwarf_stack_op_name (op));
 	  return (stack[stacki]);
 	}
     }
@@ -6880,7 +6822,9 @@ consume_improper_spaces (const char *p, 
 {
   if (*p == ' ')
     {
-      complain (&dwarf2_macro_spaces_in_definition, body);
+      complaint (&symfile_complaints,
+		 "macro definition contains spaces in formal argument list:\n`%s'",
+		 body);
 
       while (*p == ' ')
         p++;
@@ -6938,7 +6882,7 @@ parse_macro_definition (struct macro_sou
         replacement = body + name_len + 1;
       else
         {
-          complain (&dwarf2_macro_malformed_definition, body);
+	  dwarf2_macro_malformed_definition_complaint (body);
           replacement = body + name_len;
         }
       
@@ -6968,8 +6912,7 @@ parse_macro_definition (struct macro_sou
             p++;
 
           if (! *p || p == arg_start)
-            complain (&dwarf2_macro_malformed_definition,
-                      body);
+	    dwarf2_macro_malformed_definition_complaint (body);
           else
             {
               /* Make sure argv has room for the new argument.  */
@@ -7005,18 +6948,18 @@ parse_macro_definition (struct macro_sou
           else if (*p == '\0')
             {
               /* Complain, but do define it.  */
-              complain (&dwarf2_macro_malformed_definition, body);
+	      dwarf2_macro_malformed_definition_complaint (body);
               macro_define_function (file, line, name,
                                      argc, (const char **) argv, 
                                      p);
             }
           else
             /* Just complain.  */
-            complain (&dwarf2_macro_malformed_definition, body);
+	    dwarf2_macro_malformed_definition_complaint (body);
         }
       else
         /* Just complain.  */
-        complain (&dwarf2_macro_malformed_definition, body);
+	dwarf2_macro_malformed_definition_complaint (body);
 
       xfree (name);
       {
@@ -7028,7 +6971,7 @@ parse_macro_definition (struct macro_sou
       xfree (argv);
     }
   else
-    complain (&dwarf2_macro_malformed_definition, body);
+    dwarf2_macro_malformed_definition_complaint (body);
 }
 
 
@@ -7043,7 +6986,7 @@ dwarf_decode_macros (struct line_header 
 
   if (dwarf_macinfo_buffer == NULL)
     {
-      complain (&dwarf2_missing_macinfo_section);
+      complaint (&symfile_complaints, "missing .debug_macinfo section");
       return;
     }
 
@@ -7057,7 +7000,7 @@ dwarf_decode_macros (struct line_header 
       /* Do we at least have room for a macinfo type byte?  */
       if (mac_ptr >= mac_end)
         {
-          complain (&dwarf2_macros_too_long);
+	  dwarf2_macros_too_long_complaint ();
           return;
         }
 
@@ -7084,11 +7027,12 @@ dwarf_decode_macros (struct line_header 
             mac_ptr += bytes_read;
 
             if (! current_file)
-              complain (&dwarf2_macro_outside_file,
-                        macinfo_type == DW_MACINFO_define ? "definition" :
-                        macinfo_type == DW_MACINFO_undef ? "undefinition" :
-                        "something-or-other",
-                        body);
+	      complaint (&symfile_complaints,
+			 "debug info gives macro %s outside of any file: %s",
+			 macinfo_type ==
+			 DW_MACINFO_define ? "definition" : macinfo_type ==
+			 DW_MACINFO_undef ? "undefinition" :
+			 "something-or-other", body);
             else
               {
                 if (macinfo_type == DW_MACINFO_define)
@@ -7117,7 +7061,8 @@ dwarf_decode_macros (struct line_header 
 
         case DW_MACINFO_end_file:
           if (! current_file)
-            complain (&dwarf2_macro_unmatched_end_file);
+	    complaint (&symfile_complaints,
+		       "macro debug info has an unmatched `close_file' directive");
           else
             {
               current_file = current_file->included_by;
@@ -7133,7 +7078,7 @@ dwarf_decode_macros (struct line_header 
                   /* Do we at least have room for a macinfo type byte?  */
                   if (mac_ptr >= mac_end)
                     {
-                      complain (&dwarf2_macros_too_long);
+		      dwarf2_macros_too_long_complaint ();
                       return;
                     }
 
@@ -7141,7 +7086,8 @@ dwarf_decode_macros (struct line_header 
                      a look-ahead.  */
                   next_type = read_1_byte (abfd, mac_ptr);
                   if (next_type != 0)
-                    complain (&dwarf2_macros_not_terminated);
+		    complaint (&symfile_complaints,
+			       "no terminating 0-type entry for macros in `.debug_macinfo' section");
 
                   return;
                 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]