This is the mail archive of the gdb-patches@sourceware.cygnus.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]

(gdb) maintenance internal-error


For review (Stan?):

The attached patch adds the command ``maintenance internal-error'' to
the CLI. It includes additions to the testsuite (which must earn extra
brownie points :-)

	Andrew

Tue Aug 10 13:59:45 1999  Andrew Cagney  <cagney@b1.cygnus.com>

        * maint.c (_initialize_maint_cmds): Add ``maintenance
        internal-error'' command.
        (maintenance_internal_error): New function.

Tue Aug 10 15:25:16 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdb.base/maint.exp: Add test of ``maintenance internal-error''
 	command.
Index: maint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/maint.c,v
retrieving revision 2.29
diff -p -r2.29 maint.c
*** maint.c	1999/07/07 23:51:39	2.29
--- maint.c	1999/08/10 05:22:41
*************** maintenance_dump_me (args, from_tty)
*** 105,110 ****
--- 105,117 ----
  }
  #endif
  
+ static void
+ maintenance_internal_error (char *args,
+ 			    int from_tty)
+ {
+   internal_error ("internal maintenance");
+ }
+ 
  /*  Someday we should allow demangling for things other than just
     explicit strings.  For example, we might want to be able to
     specify the address of a string in either GDB's process space
*************** GDB sets it's handling of SIGQUIT back t
*** 377,382 ****
--- 384,394 ----
  itself a SIGQUIT signal.",
  	   &maintenancelist);
  #endif
+ 
+   add_cmd ("internal-error", class_maintenance, maintenance_internal_error,
+ 	   "Give GDB an internal error.\n\
+ Cause GDB to behave as if an internal error was detected.",
+ 	   &maintenancelist);
  
    add_cmd ("demangle", class_maintenance, maintenance_demangle,
  	   "Demangle a C++ mangled name.\n\
Index: testsuite/gdb.base/maint.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.5
diff -p -r1.5 maint.exp
*** maint.exp	1999/07/30 01:41:43	1.5
--- maint.exp	1999/08/10 05:22:45
***************
*** 31,36 ****
--- 31,37 ----
  #maintenance dump-me -- Get fatal error; make debugger dump its core
  #maintenance print -- Maintenance command for printing GDB internal state
  #maintenance info -- Commands for showing internal info about the program being debugged
+ #maintenance internal-error -- Give GDB an internal error.
  #
  #maintenance print statistics -- Print statistics about internal gdb state
  #maintenance print objfiles -- Print dump of current object file definitions
*************** set timeout $oldtimeout
*** 442,448 ****
  
  send_gdb "help maint\n"
  gdb_expect  {
!         -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C.. demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*maintenance dump-me.*maintenance info.*maintenance print.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
   { pass "help maint" }
          -re ".*$gdb_prompt $"       { fail "help maint" }
          timeout         { fail "(timeout) help maint" }
--- 443,449 ----
  
  send_gdb "help maint\n"
  gdb_expect  {
!         -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C.. demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*maintenance dump-me.*maintenance info.*maintenance internal-error.*maintenance print.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
   { pass "help maint" }
          -re ".*$gdb_prompt $"       { fail "help maint" }
          timeout         { fail "(timeout) help maint" }
*************** gdb_expect  {
*** 489,494 ****
--- 490,503 ----
          timeout         { fail "(timeout) help maint dump-me" }
          }
  
+ send_gdb "help maint internal-error\n"
+ gdb_expect  {
+         -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\
+                         { pass "help maint internal-error" }
+         -re ".*$gdb_prompt $"       { fail "help maint internal-error" }
+         timeout         { fail "(timeout) help maint internal-error" }
+         }
+ 
  send_gdb "help maint print statistics\n"
  gdb_expect  {
          -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\
*************** gdb_expect  {
*** 611,616 ****
--- 620,657 ----
          -re ".*$gdb_prompt $"       { fail "maint dump-me" }
          timeout         { fail "(timeout) maint dump-me" }
          }
+ 
+ send_gdb "maint internal-error\n"
+ gdb_expect  {
+     -re "Continue this debugging session.*\\(y or n\\) $" {
+ 	send_gdb "y\n"
+ 	gdb_expect {
+ 	    -re "Create a core file.*\\(y or n\\) $" {
+ 		send_gdb "n\n"
+ 		gdb_expect {
+ 		    -re ".*$gdb_prompt $" {
+ 			pass "maint internal-error"
+ 		    }
+ 		    timeout {
+ 			fail "(timeout)  maint internal-error"
+ 		    }
+ 		}
+ 	    }
+ 	    -re ".*$gdb_prompt $" {
+ 		fail "maint internal-error"
+ 	    }
+ 	    timeout {
+ 		fail "(timeout)  maint internal-error"
+ 	    }
+ 	}
+     }
+     -re ".*$gdb_prompt $" {
+ 	fail "maint internal-error"
+     }
+     timeout {
+ 	fail "(timeout) maint internal-error"
+     }
+ }
  
  #set timeout $oldtimeout
  


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