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]

RFA: [complaints.c] Use warning_hook


The following patch prevents complaints to confuse the GUI (or any other
stuff which is looking at the GDB output).

Complaints are sent to the warning_hook if one is defined.

OK to commit?


ChangeLog:

        * complaints.c (complain): Call warning_hook if defined, instead of
        writting to gdb_stderr.
        (clear_complaints): Do not write anything to gdb_stderr if warning_hook
        is defined.


-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index: complaints.c
===================================================================
RCS file: /cvs/src/src/gdb/complaints.c,v
retrieving revision 1.3
diff -c -p -r1.3 complaints.c
*** complaints.c        2000/07/30 01:48:24     1.3
--- complaints.c        2000/12/12 21:48:13
*************** complain (struct complaint *complaint,..
*** 83,112 ****
  
        /* Isolated messages, must be self-explanatory.  */
      case 0:
!       begin_line ();
!       fputs_filtered ("During symbol reading, ", gdb_stderr);
!       wrap_here ("");
!       vfprintf_filtered (gdb_stderr, complaint->message, args);
!       fputs_filtered (".\n", gdb_stderr);
        break;
  
        /* First of a series, without `set verbose'.  */
      case 1:
!       begin_line ();
!       fputs_filtered ("During symbol reading...", gdb_stderr);
!       vfprintf_filtered (gdb_stderr, complaint->message, args);
!       fputs_filtered ("...", gdb_stderr);
!       wrap_here ("");
!       complaint_series++;
        break;
  
        /* Subsequent messages of a series, or messages under `set verbose'.
           (We'll already have produced a "Reading in symbols for XXX..."
           message and will clean up at the end with a newline.)  */
      default:
!       vfprintf_filtered (gdb_stderr, complaint->message, args);
!       fputs_filtered ("...", gdb_stderr);
!       wrap_here ("");
      }
    /* If GDB dumps core, we'd like to see the complaints first.  Presumably
       GDB will not be sending so many complaints that this becomes a
--- 83,127 ----
  
        /* Isolated messages, must be self-explanatory.  */
      case 0:
!       if (warning_hook)
!         (*warning_hook) (complaint->message, args);
!       else
!         {
!           begin_line ();
!           fputs_filtered ("During symbol reading, ", gdb_stderr);
!           wrap_here ("");
!           vfprintf_filtered (gdb_stderr, complaint->message, args);
!           fputs_filtered (".\n", gdb_stderr);
!         }
        break;
  
        /* First of a series, without `set verbose'.  */
      case 1:
!       if (warning_hook)
!         (*warning_hook) (complaint->message, args);
!       else
!         {
!           begin_line ();
!           fputs_filtered ("During symbol reading...", gdb_stderr);
!           vfprintf_filtered (gdb_stderr, complaint->message, args);
!           fputs_filtered ("...", gdb_stderr);
!           wrap_here ("");
!           complaint_series++;
!         }
        break;
  
        /* Subsequent messages of a series, or messages under `set verbose'.
           (We'll already have produced a "Reading in symbols for XXX..."
           message and will clean up at the end with a newline.)  */
      default:
!       if (warning_hook)
!         (*warning_hook) (complaint->message, args);
!       else
!         {
!           vfprintf_filtered (gdb_stderr, complaint->message, args);
!           fputs_filtered ("...", gdb_stderr);
!           wrap_here ("");
!         }
      }
    /* If GDB dumps core, we'd like to see the complaints first.  Presumably
       GDB will not be sending so many complaints that this becomes a
*************** clear_complaints (int sym_reading, int n
*** 133,139 ****
        p->counter = 0;
      }
  
!   if (!sym_reading && !noisy && complaint_series > 1)
      {
        /* Terminate previous series, since caller won't.  */
        puts_filtered ("\n");
--- 148,154 ----
        p->counter = 0;
      }
  
!   if (!sym_reading && !noisy && complaint_series > 1 && !warning_hook)
      {
        /* Terminate previous series, since caller won't.  */
        puts_filtered ("\n");

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