OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [complaints.c] - Diff between revs 105 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 105 Rev 1765
/* Support for complaint handling during symbol reading in GDB.
/* Support for complaint handling during symbol reading in GDB.
   Copyright (C) 1990, 1991, 1992  Free Software Foundation, Inc.
   Copyright (C) 1990, 1991, 1992  Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */
   Boston, MA 02111-1307, USA.  */
 
 
#include "defs.h"
#include "defs.h"
#include "complaints.h"
#include "complaints.h"
#include "gdbcmd.h"
#include "gdbcmd.h"
 
 
extern void _initialize_complaints PARAMS ((void));
extern void _initialize_complaints PARAMS ((void));
 
 
/* Structure to manage complaints about symbol file contents.  */
/* Structure to manage complaints about symbol file contents.  */
 
 
struct complaint complaint_root[1] =
struct complaint complaint_root[1] =
{
{
  {
  {
    (char *) NULL,              /* Complaint message */
    (char *) NULL,              /* Complaint message */
    0,                           /* Complaint counter */
    0,                           /* Complaint counter */
    complaint_root              /* Next complaint. */
    complaint_root              /* Next complaint. */
  }
  }
};
};
 
 
/* How many complaints about a particular thing should be printed before
/* How many complaints about a particular thing should be printed before
   we stop whining about it?  Default is no whining at all, since so many
   we stop whining about it?  Default is no whining at all, since so many
   systems have ill-constructed symbol files.  */
   systems have ill-constructed symbol files.  */
 
 
static unsigned int stop_whining = 0;
static unsigned int stop_whining = 0;
 
 
/* Should each complaint be self explanatory, or should we assume that
/* Should each complaint be self explanatory, or should we assume that
   a series of complaints is being produced?
   a series of complaints is being produced?
   case 0:  self explanatory message.
   case 0:  self explanatory message.
   case 1:  First message of a series that must start off with explanation.
   case 1:  First message of a series that must start off with explanation.
   case 2:  Subsequent message, when user already knows we are reading
   case 2:  Subsequent message, when user already knows we are reading
   symbols and we can just state our piece.  */
   symbols and we can just state our piece.  */
 
 
static int complaint_series = 0;
static int complaint_series = 0;
 
 
/* External variables and functions referenced. */
/* External variables and functions referenced. */
 
 
extern int info_verbose;
extern int info_verbose;


 
 
/* Functions to handle complaints during symbol reading.  */
/* Functions to handle complaints during symbol reading.  */
 
 
/* Print a complaint about the input symbols, and link the complaint block
/* Print a complaint about the input symbols, and link the complaint block
   into a chain for later handling.  */
   into a chain for later handling.  */
 
 
void
void
complain (struct complaint *complaint,...)
complain (struct complaint *complaint,...)
{
{
  va_list args;
  va_list args;
  va_start (args, complaint);
  va_start (args, complaint);
 
 
  complaint->counter++;
  complaint->counter++;
  if (complaint->next == NULL)
  if (complaint->next == NULL)
    {
    {
      complaint->next = complaint_root->next;
      complaint->next = complaint_root->next;
      complaint_root->next = complaint;
      complaint_root->next = complaint;
    }
    }
  if (complaint->counter > stop_whining)
  if (complaint->counter > stop_whining)
    {
    {
      return;
      return;
    }
    }
  wrap_here ("");
  wrap_here ("");
 
 
  switch (complaint_series + (info_verbose << 1))
  switch (complaint_series + (info_verbose << 1))
    {
    {
 
 
      /* Isolated messages, must be self-explanatory.  */
      /* Isolated messages, must be self-explanatory.  */
    case 0:
    case 0:
      begin_line ();
      begin_line ();
      fputs_filtered ("During symbol reading, ", gdb_stderr);
      fputs_filtered ("During symbol reading, ", gdb_stderr);
      wrap_here ("");
      wrap_here ("");
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      fputs_filtered (".\n", gdb_stderr);
      fputs_filtered (".\n", gdb_stderr);
      break;
      break;
 
 
      /* First of a series, without `set verbose'.  */
      /* First of a series, without `set verbose'.  */
    case 1:
    case 1:
      begin_line ();
      begin_line ();
      fputs_filtered ("During symbol reading...", gdb_stderr);
      fputs_filtered ("During symbol reading...", gdb_stderr);
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      fputs_filtered ("...", gdb_stderr);
      fputs_filtered ("...", gdb_stderr);
      wrap_here ("");
      wrap_here ("");
      complaint_series++;
      complaint_series++;
      break;
      break;
 
 
      /* Subsequent messages of a series, or messages under `set verbose'.
      /* Subsequent messages of a series, or messages under `set verbose'.
         (We'll already have produced a "Reading in symbols for XXX..."
         (We'll already have produced a "Reading in symbols for XXX..."
         message and will clean up at the end with a newline.)  */
         message and will clean up at the end with a newline.)  */
    default:
    default:
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      vfprintf_filtered (gdb_stderr, complaint->message, args);
      fputs_filtered ("...", gdb_stderr);
      fputs_filtered ("...", gdb_stderr);
      wrap_here ("");
      wrap_here ("");
    }
    }
  /* If GDB dumps core, we'd like to see the complaints first.  Presumably
  /* 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
     GDB will not be sending so many complaints that this becomes a
     performance hog.  */
     performance hog.  */
  gdb_flush (gdb_stderr);
  gdb_flush (gdb_stderr);
  va_end (args);
  va_end (args);
}
}
 
 
/* Clear out all complaint counters that have ever been incremented.
/* Clear out all complaint counters that have ever been incremented.
   If sym_reading is 1, be less verbose about successive complaints,
   If sym_reading is 1, be less verbose about successive complaints,
   since the messages are appearing all together during a command that
   since the messages are appearing all together during a command that
   reads symbols (rather than scattered around as psymtabs get fleshed
   reads symbols (rather than scattered around as psymtabs get fleshed
   out into symtabs at random times).  If noisy is 1, we are in a
   out into symtabs at random times).  If noisy is 1, we are in a
   noisy symbol reading command, and our caller will print enough
   noisy symbol reading command, and our caller will print enough
   context for the user to figure it out.  */
   context for the user to figure it out.  */
 
 
void
void
clear_complaints (sym_reading, noisy)
clear_complaints (sym_reading, noisy)
     int sym_reading;
     int sym_reading;
     int noisy;
     int noisy;
{
{
  struct complaint *p;
  struct complaint *p;
 
 
  for (p = complaint_root->next; p != complaint_root; p = p->next)
  for (p = complaint_root->next; p != complaint_root; p = p->next)
    {
    {
      p->counter = 0;
      p->counter = 0;
    }
    }
 
 
  if (!sym_reading && !noisy && complaint_series > 1)
  if (!sym_reading && !noisy && complaint_series > 1)
    {
    {
      /* Terminate previous series, since caller won't.  */
      /* Terminate previous series, since caller won't.  */
      puts_filtered ("\n");
      puts_filtered ("\n");
    }
    }
 
 
  complaint_series = sym_reading ? 1 + noisy : 0;
  complaint_series = sym_reading ? 1 + noisy : 0;
}
}
 
 
void
void
_initialize_complaints ()
_initialize_complaints ()
{
{
  add_show_from_set
  add_show_from_set
    (add_set_cmd ("complaints", class_support, var_zinteger,
    (add_set_cmd ("complaints", class_support, var_zinteger,
                  (char *) &stop_whining,
                  (char *) &stop_whining,
                  "Set max number of complaints about incorrect symbols.",
                  "Set max number of complaints about incorrect symbols.",
                  &setlist),
                  &setlist),
     &showlist);
     &showlist);
 
 
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.