• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión2a015c47e1a4a9b117d54f357dc3540326811748 (tree)
Tiempo2017-09-28 07:37:48
AutorPedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

zap catch_exceptions

Cambiar Resumen

Diferencia incremental

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -44,7 +44,6 @@
4444 #include "source.h"
4545 #include "linespec.h"
4646 #include "completer.h"
47-#include "gdb.h"
4847 #include "ui-out.h"
4948 #include "cli/cli-script.h"
5049 #include "block.h"
@@ -6596,39 +6595,11 @@ breakpoint_address_bits (struct breakpoint *b)
65966595 return print_address_bits;
65976596 }
65986597
6599-static int
6600-do_captured_breakpoint_query (int bnum)
6598+void
6599+print_breakpoint (breakpoint *b)
66016600 {
6602- struct breakpoint *b;
66036601 struct bp_location *dummy_loc = NULL;
6604-
6605- ALL_BREAKPOINTS (b)
6606- {
6607- if (bnum == b->number)
6608- {
6609- print_one_breakpoint (b, &dummy_loc, 0);
6610- return GDB_RC_OK;
6611- }
6612- }
6613- return GDB_RC_NONE;
6614-}
6615-
6616-enum gdb_rc
6617-gdb_breakpoint_query (struct ui_out *uiout, int bnum,
6618- char **error_message)
6619-{
6620- /* For the moment we don't trust print_one_breakpoint() to not throw
6621- an error. */
6622- if (catch_exceptions_with_msg
6623- (uiout,
6624- [&] (struct ui_out *)
6625- {
6626- return do_captured_breakpoint_query (bnum);
6627- },
6628- error_message, RETURN_MASK_ALL) < 0)
6629- return GDB_RC_FAIL;
6630- else
6631- return GDB_RC_OK;
6602+ print_one_breakpoint (b, &dummy_loc, 0);
66326603 }
66336604
66346605 /* Return true if this breakpoint was set by the user, false if it is
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1644,4 +1644,7 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
16441644 UIOUT iff debugging multiple threads. */
16451645 extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
16461646
1647+/* Print the specified breakpoint. */
1648+extern void print_breakpoint (breakpoint *bp);
1649+
16471650 #endif /* !defined (BREAKPOINT_H) */
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -134,87 +134,6 @@ exception_fprintf (struct ui_file *file, struct gdb_exception e,
134134 }
135135 }
136136
137-/* Call FUNC(UIOUT, FUNC_ARGS) but wrapped within an exception
138- handler. If an exception (enum return_reason) is thrown using
139- throw_exception() than all cleanups installed since
140- catch_exceptions() was entered are invoked, the (-ve) exception
141- value is then returned by catch_exceptions. If FUNC() returns
142- normally (with a positive or zero return value) then that value is
143- returned by catch_exceptions(). It is an internal_error() for
144- FUNC() to return a negative value.
145-
146- See exceptions.h for further usage details. */
147-
148-/* MAYBE: cagney/1999-11-05: catch_errors() in conjunction with
149- error() et al. could maintain a set of flags that indicate the
150- current state of each of the longjmp buffers. This would give the
151- longjmp code the chance to detect a longjmp botch (before it gets
152- to longjmperror()). Prior to 1999-11-05 this wasn't possible as
153- code also randomly used a SET_TOP_LEVEL macro that directly
154- initialized the longjmp buffers. */
155-
156-int
157-catch_exceptions (struct ui_out *uiout,
158- gdb::function_view<catch_exceptions_ftype> func,
159- return_mask mask)
160-{
161- return catch_exceptions_with_msg (uiout, func, NULL, mask);
162-}
163-
164-int
165-catch_exceptions_with_msg (struct ui_out *func_uiout,
166- gdb::function_view<catch_exceptions_ftype> func,
167- char **gdberrmsg,
168- return_mask mask)
169-{
170- struct gdb_exception exception = exception_none;
171- volatile int val = 0;
172- struct ui_out *saved_uiout;
173-
174- /* Save and override the global ``struct ui_out'' builder. */
175- saved_uiout = current_uiout;
176- current_uiout = func_uiout;
177-
178- TRY
179- {
180- val = func (current_uiout);
181- }
182- CATCH (ex, RETURN_MASK_ALL)
183- {
184- exception = ex;
185- }
186- END_CATCH
187-
188- /* Restore the global builder. */
189- current_uiout = saved_uiout;
190-
191- if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0)
192- {
193- /* The caller didn't request that the event be caught.
194- Rethrow. */
195- throw_exception (exception);
196- }
197-
198- exception_print (gdb_stderr, exception);
199- gdb_assert (val >= 0);
200- gdb_assert (exception.reason <= 0);
201- if (exception.reason < 0)
202- {
203- /* If caller wants a copy of the low-level error message, make
204- one. This is used in the case of a silent error whereby the
205- caller may optionally want to issue the message. */
206- if (gdberrmsg != NULL)
207- {
208- if (exception.message != NULL)
209- *gdberrmsg = xstrdup (exception.message);
210- else
211- *gdberrmsg = NULL;
212- }
213- return exception.reason;
214- }
215- return val;
216-}
217-
218137 /* See exceptions.h. */
219138
220139 int
--- a/gdb/gdb.h
+++ /dev/null
@@ -1,58 +0,0 @@
1-/* Library interface into GDB.
2- Copyright (C) 1999-2017 Free Software Foundation, Inc.
3-
4- This file is part of GDB.
5-
6- This program is free software; you can redistribute it and/or modify
7- it under the terms of the GNU General Public License as published by
8- the Free Software Foundation; either version 3 of the License, or
9- (at your option) any later version.
10-
11- This program is distributed in the hope that it will be useful,
12- but WITHOUT ANY WARRANTY; without even the implied warranty of
13- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14- GNU General Public License for more details.
15-
16- You should have received a copy of the GNU General Public License
17- along with this program. If not, see <http://www.gnu.org/licenses/>. */
18-
19-#ifndef GDB_H
20-#define GDB_H
21-
22-struct ui_out;
23-
24-/* Return-code (RC) from a gdb library call. (The abreviation RC is
25- taken from the sim/common directory.) */
26-
27-enum gdb_rc {
28- /* The operation failed. The failure message can be fetched by
29- calling ``char *error_last_message(void)''. The value is
30- determined by the catch_errors() interface. The MSG parameter is
31- set to a freshly allocated copy of the error message. */
32- /* NOTE: Since ``defs.h:catch_errors()'' does not return an error /
33- internal / quit indication it is not possible to return that
34- here. */
35- GDB_RC_FAIL = 0,
36- /* No error occured but nothing happened. Due to the catch_errors()
37- interface, this must be non-zero. */
38- GDB_RC_NONE = 1,
39- /* The operation was successful. Due to the catch_errors()
40- interface, this must be non-zero. */
41- GDB_RC_OK = 2
42-};
43-
44-
45-/* Print the specified breakpoint on GDB_STDOUT. (Eventually this
46- function will ``print'' the object on ``output''). */
47-enum gdb_rc gdb_breakpoint_query (struct ui_out *uiout, int bnum,
48- char **error_message);
49-
50-/* Switch thread and print notification. */
51-enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr,
52- char **error_message);
53-
54-/* Print a list of known thread ids. */
55-enum gdb_rc gdb_list_thread_ids (struct ui_out *uiout,
56- char **error_message);
57-
58-#endif
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -679,6 +679,8 @@ extern int show_thread_that_caused_stop (void);
679679 extern void print_selected_thread_frame (struct ui_out *uiout,
680680 user_selected_what selection);
681681
682+extern void thread_select (const char *tidstr, thread_info *thr);
683+
682684 extern struct thread_info *thread_list;
683685
684686 #endif /* GDBTHREAD_H */
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -24,7 +24,6 @@
2424 #include "mi-out.h"
2525 #include "breakpoint.h"
2626 #include "mi-getopt.h"
27-#include "gdb.h"
2827 #include "observer.h"
2928 #include "mi-main.h"
3029 #include "mi-cmd-break.h"
@@ -53,7 +52,17 @@ static void
5352 breakpoint_notify (struct breakpoint *b)
5453 {
5554 if (mi_can_breakpoint_notify)
56- gdb_breakpoint_query (current_uiout, b->number, NULL);
55+ {
56+ TRY
57+ {
58+ print_breakpoint (b);
59+ }
60+ CATCH (ex, RETURN_MASK_ALL)
61+ {
62+ exception_print (gdb_stdout, ex);
63+ }
64+ END_CATCH
65+ }
5766 }
5867
5968 enum bp_type
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -21,7 +21,6 @@
2121 #include "defs.h"
2222 #include "arch-utils.h"
2323 #include "breakpoint.h"
24-#include "gdb.h"
2524 #include "ada-lang.h"
2625 #include "mi-cmds.h"
2726 #include "mi-getopt.h"
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -33,7 +33,6 @@
3333 #include "observer.h"
3434 #include "gdbthread.h"
3535 #include "solist.h"
36-#include "gdb.h"
3736 #include "objfiles.h"
3837 #include "tracepoint.h"
3938 #include "cli-out.h"
@@ -828,6 +827,36 @@ mi_tsv_modified (const struct trace_state_variable *tsv)
828827 }
829828 }
830829
830+static void
831+mi_print_breakpoint (struct mi_interp *mi, breakpoint *bp)
832+{
833+ ui_out *mi_uiout = interp_ui_out (mi);
834+
835+ /* We want the output from print_breakpoint to go to
836+ mi->event_channel. One approach would be to just call
837+ print_breakpoint, and then use mi_out_put to send the current
838+ content of mi_uiout into mi->event_channel. However, that will
839+ break if anything is output to mi_uiout prior to calling the
840+ breakpoint_created notifications. So, we use
841+ ui_out_redirect. */
842+ mi_uiout->redirect (mi->event_channel);
843+
844+ TRY
845+ {
846+ scoped_restore restore_uiout
847+ = make_scoped_restore (&current_uiout, mi_uiout);
848+
849+ print_breakpoint (bp);
850+ }
851+ CATCH (ex, RETURN_MASK_ALL)
852+ {
853+ exception_print (gdb_stderr, ex);
854+ }
855+ END_CATCH
856+
857+ mi_uiout->redirect (NULL);
858+}
859+
831860 /* Emit notification about a created breakpoint. */
832861
833862 static void
@@ -842,36 +871,16 @@ mi_breakpoint_created (struct breakpoint *b)
842871 SWITCH_THRU_ALL_UIS ()
843872 {
844873 struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
845- struct ui_out *mi_uiout;
846874
847875 if (mi == NULL)
848876 continue;
849877
850- mi_uiout = interp_ui_out (top_level_interpreter ());
851-
852878 target_terminal::scoped_restore_terminal_state term_state;
853879 target_terminal::ours_for_output ();
854880
855881 fprintf_unfiltered (mi->event_channel,
856882 "breakpoint-created");
857- /* We want the output from gdb_breakpoint_query to go to
858- mi->event_channel. One approach would be to just call
859- gdb_breakpoint_query, and then use mi_out_put to send the current
860- content of mi_uiout into mi->event_channel. However, that will
861- break if anything is output to mi_uiout prior to calling the
862- breakpoint_created notifications. So, we use
863- ui_out_redirect. */
864- mi_uiout->redirect (mi->event_channel);
865- TRY
866- {
867- gdb_breakpoint_query (mi_uiout, b->number, NULL);
868- }
869- CATCH (e, RETURN_MASK_ERROR)
870- {
871- }
872- END_CATCH
873-
874- mi_uiout->redirect (NULL);
883+ mi_print_breakpoint (mi, b);
875884
876885 gdb_flush (mi->event_channel);
877886 }
@@ -927,24 +936,7 @@ mi_breakpoint_modified (struct breakpoint *b)
927936 target_terminal::ours_for_output ();
928937 fprintf_unfiltered (mi->event_channel,
929938 "breakpoint-modified");
930- /* We want the output from gdb_breakpoint_query to go to
931- mi->event_channel. One approach would be to just call
932- gdb_breakpoint_query, and then use mi_out_put to send the current
933- content of mi_uiout into mi->event_channel. However, that will
934- break if anything is output to mi_uiout prior to calling the
935- breakpoint_created notifications. So, we use
936- ui_out_redirect. */
937- mi->mi_uiout->redirect (mi->event_channel);
938- TRY
939- {
940- gdb_breakpoint_query (mi->mi_uiout, b->number, NULL);
941- }
942- CATCH (e, RETURN_MASK_ERROR)
943- {
944- }
945- END_CATCH
946-
947- mi->mi_uiout->redirect (NULL);
939+ mi_print_breakpoint (mi, b);
948940
949941 gdb_flush (mi->event_channel);
950942 }
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -38,7 +38,6 @@
3838 #include "gdbcore.h" /* For write_memory(). */
3939 #include "value.h"
4040 #include "regcache.h"
41-#include "gdb.h"
4241 #include "frame.h"
4342 #include "mi-main.h"
4443 #include "mi-common.h"
@@ -553,21 +552,17 @@ mi_cmd_target_flash_erase (const char *command, char **argv, int argc)
553552 void
554553 mi_cmd_thread_select (const char *command, char **argv, int argc)
555554 {
556- enum gdb_rc rc;
557- char *mi_error_message;
558- ptid_t previous_ptid = inferior_ptid;
559-
560555 if (argc != 1)
561556 error (_("-thread-select: USAGE: threadnum."));
562557
563- rc = gdb_thread_select (current_uiout, argv[0], &mi_error_message);
558+ int num = value_as_long (parse_and_eval (argv[0]));
559+ thread_info *thr = find_thread_global_id (num);
560+ if (thr == NULL)
561+ error (_("Thread ID %d not known."), num);
564562
565- /* If thread switch did not succeed don't notify or print. */
566- if (rc == GDB_RC_FAIL)
567- {
568- make_cleanup (xfree, mi_error_message);
569- error ("%s", mi_error_message);
570- }
563+ ptid_t previous_ptid = inferior_ptid;
564+
565+ thread_select (argv[0], thr);
571566
572567 print_selected_thread_frame (current_uiout,
573568 USER_SELECTED_THREAD | USER_SELECTED_FRAME);
@@ -583,19 +578,31 @@ mi_cmd_thread_select (const char *command, char **argv, int argc)
583578 void
584579 mi_cmd_thread_list_ids (const char *command, char **argv, int argc)
585580 {
586- enum gdb_rc rc;
587- char *mi_error_message;
588-
589581 if (argc != 0)
590582 error (_("-thread-list-ids: No arguments required."));
591583
592- rc = gdb_list_thread_ids (current_uiout, &mi_error_message);
584+ int num = 0;
585+ int current_thread = -1;
593586
594- if (rc == GDB_RC_FAIL)
595- {
596- make_cleanup (xfree, mi_error_message);
597- error ("%s", mi_error_message);
598- }
587+ update_thread_list ();
588+
589+ {
590+ ui_out_emit_tuple tuple_emitter (current_uiout, "thread-ids");
591+
592+ struct thread_info *tp;
593+ ALL_NON_EXITED_THREADS (tp)
594+ {
595+ if (tp->ptid == inferior_ptid)
596+ current_thread = tp->global_num;
597+
598+ num++;
599+ current_uiout->field_int ("thread-id", tp->global_num);
600+ }
601+ }
602+
603+ if (current_thread != -1)
604+ current_uiout->field_int ("current-thread-id", current_thread);
605+ current_uiout->field_int ("number-of-threads", num);
599606 }
600607
601608 void
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -1118,10 +1118,9 @@ static struct {
11181118 { NULL, NULL }
11191119 };
11201120
1121-static int
1122-do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
1121+static void
1122+do_remote_fileio_request (char *buf)
11231123 {
1124- char *buf = (char *) buf_arg;
11251124 char *c;
11261125 int idx;
11271126
@@ -1135,10 +1134,10 @@ do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
11351134 for (idx = 0; remote_fio_func_map[idx].name; ++idx)
11361135 if (!strcmp (remote_fio_func_map[idx].name, buf))
11371136 break;
1138- if (!remote_fio_func_map[idx].name) /* ERROR: No such function. */
1139- return RETURN_ERROR;
1140- remote_fio_func_map[idx].func (c);
1141- return 0;
1137+ if (!remote_fio_func_map[idx].name)
1138+ remote_fileio_reply (-1, FILEIO_ENOSYS);
1139+ else
1140+ remote_fio_func_map[idx].func (c);
11421141 }
11431142
11441143 /* Close any open descriptors, and reinitialize the file mapping. */
@@ -1188,22 +1187,16 @@ remote_fileio_request (char *buf, int ctrlc_pending_p)
11881187 }
11891188 else
11901189 {
1191- ex = catch_exceptions (current_uiout,
1192- [&] (ui_out *uiout)
1193- {
1194- return do_remote_fileio_request (uiout, buf);
1195- },
1196- RETURN_MASK_ALL);
1197- switch (ex)
1190+ TRY
11981191 {
1199- case RETURN_ERROR:
1200- remote_fileio_reply (-1, FILEIO_ENOSYS);
1201- break;
1202- case RETURN_QUIT:
1203- remote_fileio_reply (-1, FILEIO_EINTR);
1204- break;
1205- default:
1206- break;
1192+ do_remote_fileio_request (buf);
1193+ }
1194+ CATCH (ex, RETURN_MASK_ALL)
1195+ {
1196+ if (ex.reason == RETURN_QUIT)
1197+ remote_fileio_reply (-1, FILEIO_EINTR);
1198+ else
1199+ remote_fileio_reply (-1, FILEIO_EIO);
12071200 }
12081201 }
12091202
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -167,31 +167,6 @@ add_symbol_file_from_memory_command (const char *args, int from_tty)
167167 symbol_file_add_from_memory (templ, addr, 0, NULL, from_tty);
168168 }
169169
170-/* Arguments for symbol_file_add_from_memory_wrapper. */
171-
172-struct symbol_file_add_from_memory_args
173-{
174- struct bfd *bfd;
175- CORE_ADDR sysinfo_ehdr;
176- size_t size;
177- char *name;
178- int from_tty;
179-};
180-
181-/* Wrapper function for symbol_file_add_from_memory, for
182- catch_exceptions. */
183-
184-static int
185-symbol_file_add_from_memory_wrapper (struct ui_out *uiout, void *data)
186-{
187- struct symbol_file_add_from_memory_args *args
188- = (struct symbol_file_add_from_memory_args *) data;
189-
190- symbol_file_add_from_memory (args->bfd, args->sysinfo_ehdr, args->size,
191- args->name, args->from_tty);
192- return 0;
193-}
194-
195170 /* Try to add the symbols for the vsyscall page, if there is one.
196171 This function is called via the inferior_created observer. */
197172
@@ -203,7 +178,6 @@ add_vsyscall_page (struct target_ops *target, int from_tty)
203178 if (gdbarch_vsyscall_range (target_gdbarch (), &vsyscall_range))
204179 {
205180 struct bfd *bfd;
206- struct symbol_file_add_from_memory_args args;
207181
208182 if (core_bfd != NULL)
209183 bfd = core_bfd;
@@ -221,23 +195,24 @@ add_vsyscall_page (struct target_ops *target, int from_tty)
221195 "because no executable was specified"));
222196 return;
223197 }
224- args.bfd = bfd;
225- args.sysinfo_ehdr = vsyscall_range.start;
226- args.size = vsyscall_range.length;
227-
228- args.name = xstrprintf ("system-supplied DSO at %s",
229- paddress (target_gdbarch (), vsyscall_range.start));
230- /* Pass zero for FROM_TTY, because the action of loading the
231- vsyscall DSO was not triggered by the user, even if the user
232- typed "run" at the TTY. */
233- args.from_tty = 0;
234- catch_exceptions (current_uiout,
235- [&] (ui_out *uiout)
236- {
237- return symbol_file_add_from_memory_wrapper (uiout,
238- &args);
239- },
240- RETURN_MASK_ALL);
198+
199+ char *name = xstrprintf ("system-supplied DSO at %s",
200+ paddress (target_gdbarch (), vsyscall_range.start));
201+ TRY
202+ {
203+ /* Pass zero for FROM_TTY, because the action of loading the
204+ vsyscall DSO was not triggered by the user, even if the
205+ user typed "run" at the TTY. */
206+ symbol_file_add_from_memory (bfd,
207+ vsyscall_range.start,
208+ vsyscall_range.length,
209+ name,
210+ 0 /* from_tty */);
211+ }
212+ CATCH (ex, RETURN_MASK_ALL)
213+ {
214+ exception_print (gdb_stderr, ex);
215+ }
241216 }
242217 }
243218
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -30,7 +30,6 @@
3030 #include "command.h"
3131 #include "gdbcmd.h"
3232 #include "regcache.h"
33-#include "gdb.h"
3433 #include "btrace.h"
3534
3635 #include <ctype.h>
@@ -720,50 +719,6 @@ any_live_thread_of_process (int pid)
720719 return tp_executing;
721720 }
722721
723-/* Print a list of thread ids currently known, and the total number of
724- threads. To be used from within catch_errors. */
725-static int
726-do_captured_list_thread_ids (struct ui_out *uiout)
727-{
728- struct thread_info *tp;
729- int num = 0;
730- int current_thread = -1;
731-
732- update_thread_list ();
733-
734- {
735- ui_out_emit_tuple tuple_emitter (uiout, "thread-ids");
736-
737- for (tp = thread_list; tp; tp = tp->next)
738- {
739- if (tp->state == THREAD_EXITED)
740- continue;
741-
742- if (tp->ptid == inferior_ptid)
743- current_thread = tp->global_num;
744-
745- num++;
746- uiout->field_int ("thread-id", tp->global_num);
747- }
748- }
749-
750- if (current_thread != -1)
751- uiout->field_int ("current-thread-id", current_thread);
752- uiout->field_int ("number-of-threads", num);
753- return GDB_RC_OK;
754-}
755-
756-/* Official gdblib interface function to get a list of thread ids and
757- the total number. */
758-enum gdb_rc
759-gdb_list_thread_ids (struct ui_out *uiout, char **error_message)
760-{
761- if (catch_exceptions_with_msg (uiout, do_captured_list_thread_ids,
762- error_message, RETURN_MASK_ALL) < 0)
763- return GDB_RC_FAIL;
764- return GDB_RC_OK;
765-}
766-
767722 /* Return true if TP is an active thread. */
768723 static int
769724 thread_alive (struct thread_info *tp)
@@ -1885,13 +1840,8 @@ thread_command (char *tidstr, int from_tty)
18851840 else
18861841 {
18871842 ptid_t previous_ptid = inferior_ptid;
1888- enum gdb_rc result;
1889-
1890- result = gdb_thread_select (current_uiout, tidstr, NULL);
18911843
1892- /* If thread switch did not succeed don't notify or print. */
1893- if (result == GDB_RC_FAIL)
1894- return;
1844+ thread_select (tidstr, parse_thread_id (tidstr, NULL));
18951845
18961846 /* Print if the thread has not changed, otherwise an event will
18971847 be sent. */
@@ -1991,25 +1941,9 @@ show_print_thread_events (struct ui_file *file, int from_tty,
19911941 value);
19921942 }
19931943
1994-static int
1995-do_captured_thread_select (struct ui_out *uiout, const char *tidstr)
1944+void
1945+thread_select (const char *tidstr, thread_info *tp)
19961946 {
1997- struct thread_info *tp;
1998-
1999- if (uiout->is_mi_like_p ())
2000- {
2001- int num = value_as_long (parse_and_eval (tidstr));
2002-
2003- tp = find_thread_global_id (num);
2004- if (tp == NULL)
2005- error (_("Thread ID %d not known."), num);
2006- }
2007- else
2008- {
2009- tp = parse_thread_id (tidstr, NULL);
2010- gdb_assert (tp != NULL);
2011- }
2012-
20131947 if (!thread_alive (tp))
20141948 error (_("Thread ID %s has terminated."), tidstr);
20151949
@@ -2020,8 +1954,6 @@ do_captured_thread_select (struct ui_out *uiout, const char *tidstr)
20201954 /* Since the current thread may have changed, see if there is any
20211955 exited thread we can now delete. */
20221956 prune_threads ();
2023-
2024- return GDB_RC_OK;
20251957 }
20261958
20271959 /* Print thread and frame switch command response. */
@@ -2066,20 +1998,6 @@ print_selected_thread_frame (struct ui_out *uiout,
20661998 }
20671999 }
20682000
2069-enum gdb_rc
2070-gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message)
2071-{
2072- if (catch_exceptions_with_msg
2073- (uiout,
2074- [&] (struct ui_out *inner_uiout)
2075- {
2076- return do_captured_thread_select (inner_uiout, tidstr);
2077- },
2078- error_message, RETURN_MASK_ALL) < 0)
2079- return GDB_RC_FAIL;
2080- return GDB_RC_OK;
2081-}
2082-
20832001 /* Update the 'threads_executing' global based on the threads we know
20842002 about right now. */
20852003