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/ob] add attr_format(printf) to error()


Hello,

This adds the attrib (printf) stuff to error().  Fixes a few bugs in the 
process.

Committed.

Andrew
2002-03-23  Andrew Cagney  <cagney@redhat.com>

	* defs.h (error): Add printf format attribute.
	* thread-db.c (thread_from_lwp): Fix error format string.
	* stack.c (parse_frame_specification): Ditto.
	* cli/cli-decode.c (undef_cmd_error): Ditto.
	* scm-lang.c (scm_lookup_name): Ditto.
	* tracepoint.c (trace_error): Ditto.
	* remote-utils.c (usage): Ditto.
	* remote.c (compare_sections_command): Ditto.
	Fix PR gdb/328.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.84
diff -u -r1.84 defs.h
--- defs.h	2002/03/19 19:00:04	1.84
+++ defs.h	2002/03/23 17:27:41
@@ -866,7 +866,7 @@
 
 extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN;
 
-extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN;
+extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
 
 extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
 
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-utils.c,v
retrieving revision 1.12
diff -u -r1.12 remote-utils.c
--- remote-utils.c	2001/07/15 20:34:14	1.12
+++ remote-utils.c	2002/03/23 17:27:50
@@ -86,7 +86,7 @@
     fprintf_unfiltered (gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
 
   error ("Usage: target %s [DEVICE [SPEED [DEBUG]]]\n\
-where DEVICE is the name of a device or HOST:PORT", proto, proto);
+where DEVICE is the name of a device or HOST:PORT", proto);
 
   return;
 }
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.77
diff -u -r1.77 remote.c
--- remote.c	2002/02/27 01:18:39	1.77
+++ remote.c	2002/03/23 17:28:28
@@ -5013,8 +5013,8 @@
 
       getpkt (buf, (rs->remote_packet_size), 0);
       if (buf[0] == 'E')
-	error ("target memory fault, section %s, range 0x%08x -- 0x%08x",
-	       sectname, lma, lma + size);
+	error ("target memory fault, section %s, range 0x%s -- 0x%s",
+	       sectname, paddr (lma), paddr (lma + size));
       if (buf[0] != 'C')
 	error ("remote target does not support this operation");
 
Index: scm-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/scm-lang.c,v
retrieving revision 1.8
diff -u -r1.8 scm-lang.c
--- scm-lang.c	2002/02/13 18:49:30	1.8
+++ scm-lang.c	2002/03/23 17:28:28
@@ -180,7 +180,7 @@
 		       (struct symtab **) NULL);
   if (sym)
     return value_of_variable (sym, NULL);
-  error ("No symbol \"%s\" in current context.");
+  error ("No symbol \"%s\" in current context.", str);
 }
 
 struct value *
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.29
diff -u -r1.29 stack.c
--- stack.c	2002/02/14 07:24:54	1.29
+++ stack.c	2002/03/23 17:28:33
@@ -704,7 +704,7 @@
 	   really should be used instead of spaces to delimit; using spaces
 	   normally works in an expression).  */
 #ifdef SETUP_ARBITRARY_FRAME
-	error ("No frame %d", args[0]);
+	error ("No frame %s", paddr_d (args[0]));
 #endif
 
 	/* If (s)he specifies the frame with an address, he deserves what
Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/thread-db.c,v
retrieving revision 1.21
diff -u -r1.21 thread-db.c
--- thread-db.c	2002/02/24 21:53:02	1.21
+++ thread-db.c	2002/03/23 17:28:37
@@ -239,7 +239,7 @@
 
   err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (ptid), &th);
   if (err != TD_OK)
-    error ("Cannot find user-level thread for LWP %d: %s",
+    error ("Cannot find user-level thread for LWP %ld: %s",
 	   GET_LWP (ptid), thread_db_err_str (err));
 
   err = td_thr_get_info_p (&th, &ti);
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.34
diff -u -r1.34 tracepoint.c
--- tracepoint.c	2002/03/06 06:28:34	1.34
+++ tracepoint.c	2002/03/23 17:29:02
@@ -190,7 +190,7 @@
       if (*++buf == '0')	/*   general case: */
 	error ("tracepoint.c: error in outgoing packet.");
       else
-	error ("tracepoint.c: error in outgoing packet at field #%d.",
+	error ("tracepoint.c: error in outgoing packet at field #%ld.",
 	       strtol (buf, NULL, 16));
     case '2':
       error ("trace API error 0x%s.", ++buf);
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.17
diff -u -r1.17 cli-decode.c
--- cli-decode.c	2002/03/19 02:19:17	1.17
+++ cli-decode.c	2002/03/23 17:29:12
@@ -975,7 +975,7 @@
 	 cmdtype,
 	 q,
 	 *cmdtype ? " " : "",
-	 strlen (cmdtype) - 1,
+	 (int) strlen (cmdtype) - 1,
 	 cmdtype);
 }
 

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