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]

[patch/rfc] internal-error quit by default ..


Hello,

This patch follows up a proposed change from long ago.  Update things so 
that when in batch mode (i.e. no tty) an internal-error will:

	quit
	dump core

this adjusts things accordingly.  For the user, the resultant behavour is:

(gdb) maint internal-error
gdb/maint.c:119: gdb-internal-error: internal maintenance
An internal GDB error was detected.  This may make further
debugging unreliable.  Quit this debugging session? (y or n) y

Create a core file containing the current state of GDB? (y or n) y
Abort trap (core dumped)
ac131313@nettle$

Unless someone raises a problem.  I'll commit it in a few days.

enjoy,
Andrew
2002-01-13  Andrew Cagney  <ac131313@redhat.com>

	* utils.c (internal_verror): Fix comments, default is yes not no.
	Update queries to match.  Default to quit and dump core.

Index: testsuite/ChangeLog
2002-01-13  Andrew Cagney  <ac131313@redhat.com>

	* gdb.base/maint.exp: Update ``maint internal-error'' to match
	continue/quit query.

Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.54
diff -p -r1.54 utils.c
*** utils.c	2002/01/05 05:54:30	1.54
--- utils.c	2002/01/13 20:42:06
*************** internal_verror (const char *file, int l
*** 694,700 ****
  {
    static char msg[] = "Internal GDB error: recursive internal error.\n";
    static int dejavu = 0;
!   int continue_p;
    int dump_core_p;
  
    /* don't allow infinite error recursion. */
--- 694,700 ----
  {
    static char msg[] = "Internal GDB error: recursive internal error.\n";
    static int dejavu = 0;
!   int quit_p;
    int dump_core_p;
  
    /* don't allow infinite error recursion. */
*************** internal_verror (const char *file, int l
*** 719,749 ****
    vfprintf_unfiltered (gdb_stderr, fmt, ap);
    fputs_unfiltered ("\n", gdb_stderr);
  
!   /* Default (no case) is to quit GDB.  When in batch mode this
       lessens the likelhood of GDB going into an infinate loop. */
!   continue_p = query ("\
  An internal GDB error was detected.  This may make further\n\
! debugging unreliable.  Continue this debugging session? ");
  
!   /* Default (no case) is to not dump core.  Lessen the chance of GDB
!      leaving random core files around. */
    dump_core_p = query ("\
  Create a core file containing the current state of GDB? ");
  
!   if (continue_p)
      {
        if (dump_core_p)
! 	{
! 	  if (fork () == 0)
! 	    abort (); /* NOTE: GDB has only three calls to abort().  */
! 	}
      }
    else
      {
        if (dump_core_p)
! 	abort (); /* NOTE: GDB has only three calls to abort().  */
!       else
! 	exit (1);
      }
  
    dejavu = 0;
--- 719,750 ----
    vfprintf_unfiltered (gdb_stderr, fmt, ap);
    fputs_unfiltered ("\n", gdb_stderr);
  
!   /* Default (yes/batch case) is to quit GDB.  When in batch mode this
       lessens the likelhood of GDB going into an infinate loop. */
!   quit_p = query ("\
  An internal GDB error was detected.  This may make further\n\
! debugging unreliable.  Quit this debugging session? ");
  
!   /* Default (yes/batch case) is to dump core.  This leaves a GDB
!      dropping so that it is easier to see that something went wrong to
!      GDB. */
    dump_core_p = query ("\
  Create a core file containing the current state of GDB? ");
  
!   if (quit_p)
      {
        if (dump_core_p)
! 	abort (); /* NOTE: GDB has only three calls to abort().  */
!       else
! 	exit (1);
      }
    else
      {
        if (dump_core_p)
! 	{
! 	  if (fork () == 0)
! 	    abort (); /* NOTE: GDB has only three calls to abort().  */
! 	}
      }
  
    dejavu = 0;
Index: testsuite/gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.9
diff -p -r1.9 maint.exp
*** maint.exp	2002/01/05 02:40:47	1.9
--- maint.exp	2002/01/13 20:44:01
*************** gdb_expect  {
*** 660,667 ****
  
  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"
--- 660,667 ----
  
  send_gdb "maint internal-error\n"
  gdb_expect  {
!     -re "Quit this debugging session.*\\(y or n\\) $" {
! 	send_gdb "n\n"
  	gdb_expect {
  	    -re "Create a core file.*\\(y or n\\) $" {
  		send_gdb "n\n"

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