* [RFA] [3/4] Remove libgdb API (gdb_thread_select)
@ 2012-01-13 19:59 Keith Seitz
2012-01-16 17:25 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Keith Seitz @ 2012-01-13 19:59 UTC (permalink / raw)
To: gp >> "gdb-patches@sourceware.org ml"
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
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.
[-- Attachment #2: remove-gdb_thread_select.patch --]
[-- Type: text/x-patch, Size: 4002 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] [3/4] Remove libgdb API (gdb_thread_select)
2012-01-13 19:59 [RFA] [3/4] Remove libgdb API (gdb_thread_select) Keith Seitz
@ 2012-01-16 17:25 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2012-01-16 17:25 UTC (permalink / raw)
To: Keith Seitz; +Cc: gp >> "gdb-patches@sourceware.org ml"
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> (gdb)
Keith> -thread-select 12345678
Keith> &"error: Thread ID 12345678 not known."
Keith> ^error,msg="Thread ID 12345678 not known."
Keith> (gdb)
Keith> Unlike most other MI commands, the error is echoed to the error
Keith> stream. I don't know if this is intentional or not, but I've "fixed"
Keith> that so that only the error response from MI is seen:
I think it is better for us to try to be conservative regarding MI
output changes. I doubt anybody relies on this, but still...
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-16 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 19:59 [RFA] [3/4] Remove libgdb API (gdb_thread_select) Keith Seitz
2012-01-16 17:25 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).