This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] [3/4] Remove libgdb API (gdb_thread_select)
- From: Keith Seitz <keiths at redhat dot com>
- To: "gp >> \"gdb-patches at sourceware dot org ml\"" <gdb-patches at sourceware dot org>
- Date: Fri, 13 Jan 2012 11:59:23 -0800
- Subject: [RFA] [3/4] Remove libgdb API (gdb_thread_select)
Hi,
This patch removes/renames gdb_thread_select. This patch involves one
(questionable?) test suite change. Currently:
(gdb)
-thread-select 12345678
&"error: Thread ID 12345678 not known."
^error,msg="Thread ID 12345678 not known."
(gdb)
Unlike most other MI commands, the error is echoed to the error stream.
I don't know if this is intentional or not, but I've "fixed" that so
that only the error response from MI is seen:
(gdb)
-thread-select 12345678
^error,msg="Thread ID 12345678 not known."
(gdb)
Keith
ChangeLog
2012-01-12 Keith Seitz <keiths@redhat.com>
* gdb.h (gdb_thread_select): Remove declaration.
* gdbthread.h (thread_select): Add declaration.
* mi/mi-main.c: Do not include gdb.h.
(mi_cmd_thread_select): Use thread_select instead of
gdb_thread_select.
* thread.c (thread_command): Likewise.
(do_captured_thread_select): Rename to ...
(thread_select): ... this. Make return type void.
testsuite/ChangeLog
2012-01-12 Keith Seitz <keiths@redhat.com>
* mi/mi-pthreads.exp: Do not require a message to err stream
for -thread-select.
* mi/mi2-pthreads.exp: Likewise.
diff --git a/gdb/gdb.h b/gdb/gdb.h
index 1611cbe..97b787d 100644
--- a/gdb/gdb.h
+++ b/gdb/gdb.h
@@ -41,9 +41,4 @@ enum gdb_rc {
GDB_RC_OK = 2
};
-
-/* Switch thread and print notification. */
-enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr,
- char **error_message);
-
#endif
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 7854cee..87b509d 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -391,4 +391,6 @@ extern void update_thread_list (void);
extern void list_thread_ids (struct ui_out *uiout);
+extern void thread_select (struct ui_out *uiout, char *tidstr);
+
#endif /* GDBTHREAD_H */
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 2ae688b..bbbe1bf 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -41,7 +41,6 @@
#include "gdbcore.h" /* For write_memory(). */
#include "value.h"
#include "regcache.h"
-#include "gdb.h"
#include "frame.h"
#include "mi-main.h"
#include "mi-common.h"
@@ -465,19 +464,10 @@ mi_cmd_target_detach (char *command, char **argv, int argc)
void
mi_cmd_thread_select (char *command, char **argv, int argc)
{
- enum gdb_rc rc;
- char *mi_error_message;
-
if (argc != 1)
error (_("-thread-select: USAGE: threadnum."));
- rc = gdb_thread_select (current_uiout, argv[0], &mi_error_message);
-
- if (rc == GDB_RC_FAIL)
- {
- make_cleanup (xfree, mi_error_message);
- error ("%s", mi_error_message);
- }
+ thread_select (current_uiout, argv[0]);
}
void
diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp
index 458d3fb..d34e080 100644
--- a/gdb/testsuite/gdb.mi/mi-pthreads.exp
+++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp
@@ -39,7 +39,7 @@ proc check_mi_thread_command_set {} {
"check_mi_thread_command_set: -thread-select"
mi_gdb_test "-thread-select 123456789" \
- {&.*\^error,msg="Thread ID 123456789 not known\."} \
+ {\^error,msg="Thread ID 123456789 not known\."} \
"check_mi_thread_command_set: -thread-select 123456789"
foreach thread $thread_list {
diff --git a/gdb/testsuite/gdb.mi/mi2-pthreads.exp b/gdb/testsuite/gdb.mi/mi2-pthreads.exp
index 8acc7ce..dc6e27a 100644
--- a/gdb/testsuite/gdb.mi/mi2-pthreads.exp
+++ b/gdb/testsuite/gdb.mi/mi2-pthreads.exp
@@ -39,7 +39,7 @@ proc check_mi_thread_command_set {} {
"check_mi_thread_command_set: -thread-select"
mi_gdb_test "-thread-select 123456789" \
- {&.*\^error,msg="Thread ID 123456789 not known\."} \
+ {\^error,msg="Thread ID 123456789 not known\."} \
"check_mi_thread_command_set: -thread-select 123456789"
foreach thread $thread_list {
diff --git a/gdb/thread.c b/gdb/thread.c
index 1f59a83..fc551dd 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -32,7 +32,6 @@
#include "command.h"
#include "gdbcmd.h"
#include "regcache.h"
-#include "gdb.h"
#include "gdb_string.h"
#include <ctype.h>
@@ -1270,7 +1269,7 @@ thread_command (char *tidstr, int from_tty)
return;
}
- gdb_thread_select (current_uiout, tidstr, NULL);
+ thread_select (current_uiout, tidstr);
}
/* Implementation of `thread name'. */
@@ -1356,8 +1355,10 @@ show_print_thread_events (struct ui_file *file, int from_tty,
value);
}
-static int
-do_captured_thread_select (struct ui_out *uiout, void *tidstr)
+/* Switch to the thread in TIDSTR using UIOUT for any notifications. */
+
+void
+thread_select (struct ui_out *uiout, char *tidstr)
{
int num;
struct thread_info *tp;
@@ -1395,17 +1396,6 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
/* Since the current thread may have changed, see if there is any
exited thread we can now delete. */
prune_threads ();
-
- return GDB_RC_OK;
-}
-
-enum gdb_rc
-gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message)
-{
- if (catch_exceptions_with_msg (uiout, do_captured_thread_select, tidstr,
- error_message, RETURN_MASK_ALL) < 0)
- return GDB_RC_FAIL;
- return GDB_RC_OK;
}
void