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]

[patch] print all problems with architecture


Hello,

The attached tweeks gdbarch.sh:verify_gdbarch() so that it prints all 
the problems found in an architecture vis:

/home/scratch/GDB/src/gdb/gdbarch.c:762: gdb-internal-error: 
verify_gdbarch: the following are invalid ...
         use_generic_dummy_frames
         call_dummy_breakpoint_offset_p
         call_dummy_p
         call_dummy_stack_adjust_p
         get_saved_register
         push_arguments
         push_return_address
         frame_chain_valid
An internal GDB error was detected ...

Previously it would just print the first and exit :-(

I've checked it in as obvious.

Andrew
2001-11-05  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh (verify_gdbarch): Use a mem_file to accumulate all
	error messages.  Print in a single batch.

Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.84
diff -p -r1.84 gdbarch.sh
*** gdbarch.sh	2001/10/31 23:21:33	1.84
--- gdbarch.sh	2001/11/05 21:17:06
*************** cat <<EOF
*** 1366,1381 ****
  static void
  verify_gdbarch (struct gdbarch *gdbarch)
  {
    /* Only perform sanity checks on a multi-arch target. */
    if (!GDB_MULTI_ARCH)
      return;
    /* fundamental */
    if (gdbarch->byte_order == 0)
!     internal_error (__FILE__, __LINE__,
!                     "verify_gdbarch: byte-order unset");
    if (gdbarch->bfd_arch_info == NULL)
!     internal_error (__FILE__, __LINE__,
!                     "verify_gdbarch: bfd_arch_info unset");
    /* Check those that need to be defined for the given multi-arch level. */
  EOF
  function_list | while do_read
--- 1366,1385 ----
  static void
  verify_gdbarch (struct gdbarch *gdbarch)
  {
+   struct ui_file *log;
+   struct cleanup *cleanups;
+   long dummy;
+   char *buf;
    /* Only perform sanity checks on a multi-arch target. */
    if (!GDB_MULTI_ARCH)
      return;
+   log = mem_fileopen ();
+   cleanups = make_cleanup_ui_file_delete (log);
    /* fundamental */
    if (gdbarch->byte_order == 0)
!     fprintf_unfiltered (log, "\n\tbyte-order");
    if (gdbarch->bfd_arch_info == NULL)
!     fprintf_unfiltered (log, "\n\tbfd_arch_info");
    /* Check those that need to be defined for the given multi-arch level. */
  EOF
  function_list | while do_read
*************** do
*** 1405,1422 ****
  	then
  	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
  	    printf "      && (${invalid_p}))\n"
! 	    printf "    internal_error (__FILE__, __LINE__,\n"
! 	    printf "                    \"gdbarch: verify_gdbarch: ${function} invalid\");\n"
  	elif [ -n "${predefault}" ]
  	then
  	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
  	    printf "      && (gdbarch->${function} == ${predefault}))\n"
! 	    printf "    internal_error (__FILE__, __LINE__,\n"
! 	    printf "                    \"gdbarch: verify_gdbarch: ${function} invalid\");\n"
  	fi
      fi
  done
  cat <<EOF
  }
  EOF
  
--- 1409,1431 ----
  	then
  	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
  	    printf "      && (${invalid_p}))\n"
! 	    printf "    fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
  	elif [ -n "${predefault}" ]
  	then
  	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
  	    printf "      && (gdbarch->${function} == ${predefault}))\n"
! 	    printf "    fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
  	fi
      fi
  done
  cat <<EOF
+   buf = ui_file_xstrdup (log, &dummy);
+   make_cleanup (xfree, buf);
+   if (strlen (buf) > 0)
+     internal_error (__FILE__, __LINE__,
+                     "verify_gdbarch: the following are invalid ...%s",
+                     buf);
+   do_cleanups (cleanups);
  }
  EOF
  

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