Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/5] Move internal_{,v}warning to common/errors.[ch]
Date: Mon, 18 Aug 2014 08:47:00 -0000	[thread overview]
Message-ID: <1408351618-21013-2-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <1408351618-21013-1-git-send-email-gbenson@redhat.com>

This commit moves internal_warning and internal_vwarning into
common/errors.[ch].

gdb/
2014-08-18  Gary Benson  <gbenson@redhat.com>

	* common/errors.h (internal_warning): New declaration.
	(internal_vwarning): Likewise.
	* common/errors.c (internal_warning): New function.
	* utils.h (internal_warning): Don't declare.
	(internal_vwarning): Likewise.
	* utils.c (internal_warning): Removed.

gdb/gdbserver/
2014-08-18  Gary Benson  <gbenson@redhat.com>

	* utils.c (internal_vwarning): New function.
---
 gdb/ChangeLog           |    9 +++++++++
 gdb/common/errors.c     |   12 ++++++++++++
 gdb/common/errors.h     |   15 +++++++++++++++
 gdb/gdbserver/ChangeLog |    4 ++++
 gdb/gdbserver/utils.c   |   11 +++++++++++
 gdb/utils.c             |   10 ----------
 gdb/utils.h             |    7 -------
 7 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/gdb/common/errors.c b/gdb/common/errors.c
index 6da2666..089c64b 100644
--- a/gdb/common/errors.c
+++ b/gdb/common/errors.c
@@ -55,3 +55,15 @@ internal_error (const char *file, int line, const char *fmt, ...)
   internal_verror (file, line, fmt, ap);
   va_end (ap);
 }
+
+/* See common/errors.h.  */
+
+void
+internal_warning (const char *file, int line, const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start (ap, fmt);
+  internal_vwarning (file, line, fmt, ap);
+  va_end (ap);
+}
diff --git a/gdb/common/errors.h b/gdb/common/errors.h
index 4e6c2b3..88d77e5 100644
--- a/gdb/common/errors.h
+++ b/gdb/common/errors.h
@@ -58,6 +58,21 @@ extern void internal_error (const char *file, int line,
 extern void internal_verror (const char *file, int line,
 			     const char *fmt, va_list args)
      ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0);
+
+/* An internal problem was detected, but the requested operation can
+   still proceed.  Internal warnings indicate programming errors as
+   opposed to more general issues beyond the application's control.
+   A warning message is constructed using a printf- or vprintf-style
+   argument list.  The function "internal_vwarning" must be provided
+   by the client.  */
+
+extern void internal_warning (const char *file, int line,
+			      const char *fmt, ...)
+     ATTRIBUTE_PRINTF (3, 4);
+
+extern void internal_vwarning (const char *file, int line,
+			       const char *fmt, va_list args)
+     ATTRIBUTE_PRINTF (3, 0);
 \f
 
 /* Like "error", but the error message is constructed by combining
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 3aac3cd..3ec4add 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -129,6 +129,17 @@ internal_verror (const char *file, int line, const char *fmt, va_list args)
   exit (1);
 }
 
+/* Report a problem internal to GDBserver.  */
+
+void
+internal_vwarning (const char *file, int line, const char *fmt, va_list args)
+{
+  fprintf (stderr,  "\
+%s:%d: A problem internal to " TOOLNAME " has been detected.\n", file, line);
+  vfprintf (stderr, fmt, args);
+  fprintf (stderr, "\n");
+}
+
 /* Convert a CORE_ADDR into a HEX string, like %lx.
    The result is stored in a circular static buffer, NUMCELLS deep.  */
 
diff --git a/gdb/utils.c b/gdb/utils.c
index 2b64023..759ec84 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -797,16 +797,6 @@ internal_vwarning (const char *file, int line, const char *fmt, va_list ap)
   internal_vproblem (&internal_warning_problem, file, line, fmt, ap);
 }
 
-void
-internal_warning (const char *file, int line, const char *string, ...)
-{
-  va_list ap;
-
-  va_start (ap, string);
-  internal_vwarning (file, line, string, ap);
-  va_end (ap);
-}
-
 static struct internal_problem demangler_warning_problem = {
   "demangler-warning", 1, internal_problem_ask, 0, internal_problem_no
 };
diff --git a/gdb/utils.h b/gdb/utils.h
index 57a1c0f..2ec3fda 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -283,13 +283,6 @@ extern char *warning_pre_print;
 
 extern void error_stream (struct ui_file *) ATTRIBUTE_NORETURN;
 
-extern void internal_vwarning (const char *file, int line,
-			       const char *, va_list ap)
-     ATTRIBUTE_PRINTF (3, 0);
-
-extern void internal_warning (const char *file, int line,
-			      const char *, ...) ATTRIBUTE_PRINTF (3, 4);
-
 extern void demangler_vwarning (const char *file, int line,
 			       const char *, va_list ap)
      ATTRIBUTE_PRINTF (3, 0);
-- 
1.7.1


  parent reply	other threads:[~2014-08-18  8:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18  8:47 [PATCH 0/5] Make gdbserver use exceptions and cleanups Gary Benson
2014-08-18  8:47 ` [PATCH 3/5] Introduce common/gdb_setjmp.h Gary Benson
2014-08-20 16:54   ` Pedro Alves
2014-08-18  8:47 ` Gary Benson [this message]
2014-08-18  8:47 ` [PATCH 2/5] Move cleanups.[ch] to common Gary Benson
2014-08-20 16:47   ` Pedro Alves
2014-08-20 19:05     ` Gary Benson
2014-08-28 15:35   ` Pedro Alves
2014-08-28 15:36   ` Pedro Alves
2014-08-18  8:52 ` [PATCH 4/5] Introduce common/common-exceptions.[ch] Gary Benson
2014-08-18  9:25 ` [PATCH 5/5] Use exceptions and cleanups in gdbserver Gary Benson
2014-08-28 15:35   ` Pedro Alves
2014-08-28 15:39 ` [PATCH 0/5] Make gdbserver use exceptions and cleanups Pedro Alves
2014-08-29 10:07   ` Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408351618-21013-2-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox