This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Cleanup: consolidate "unknown thread id" errors
- From: Keith Seitz <keiths at redhat dot com>
- To: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Tue, 17 Jul 2012 10:11:47 -0700
- Subject: [RFA] Cleanup: consolidate "unknown thread id" errors
Hi,
This is a trivial cleanup to do $SUBJECT. I'm not sure there's a whole
lot to be said about it, other than this sort of thing bothers me, so I
changed this while working on my explicit linespec patchset.
Keith
ChangeLog
2012-07-17 Keith Seitz <keiths@redhat.com>
* breakpoint.c (invalid_thread_id_error): New function.
(find_condition_and_thread): Use invalid_thread_id_error.
(watch_command_1): Likewise.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6b9faf3..1a27fe4 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9231,6 +9231,14 @@ check_fast_tracepoint_sals (struct gdbarch *gdbarch,
}
}
+/* Issue an invalid thread ID error. */
+
+static void ATTRIBUTE_NORETURN
+invalid_thread_id_error (int id)
+{
+ error (_("Unknown thread %d."), id);
+}
+
/* Given TOK, a string specification of condition and thread, as
accepted by the 'break' command, extract the condition
string and thread number and set *COND_STRING and *THREAD.
@@ -9284,7 +9292,7 @@ find_condition_and_thread (char *tok, CORE_ADDR pc,
if (tok == tmptok)
error (_("Junk after thread keyword."));
if (!valid_thread_id (*thread))
- error (_("Unknown thread %d."), *thread);
+ invalid_thread_id_error (*thread);
}
else if (toklen >= 1 && strncmp (tok, "task", toklen) == 0)
{
@@ -10763,7 +10771,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty,
/* Check if the thread actually exists. */
if (!valid_thread_id (thread))
- error (_("Unknown thread %d."), thread);
+ invalid_thread_id_error (thread);
}
else if (toklen == 4 && !strncmp (tok, "mask", 4))
{