GNU Binutils with patches for OS216
Revisión | 2a015c47e1a4a9b117d54f357dc3540326811748 (tree) |
---|---|
Tiempo | 2017-09-28 07:37:48 |
Autor | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
zap catch_exceptions
@@ -44,7 +44,6 @@ | ||
44 | 44 | #include "source.h" |
45 | 45 | #include "linespec.h" |
46 | 46 | #include "completer.h" |
47 | -#include "gdb.h" | |
48 | 47 | #include "ui-out.h" |
49 | 48 | #include "cli/cli-script.h" |
50 | 49 | #include "block.h" |
@@ -6596,39 +6595,11 @@ breakpoint_address_bits (struct breakpoint *b) | ||
6596 | 6595 | return print_address_bits; |
6597 | 6596 | } |
6598 | 6597 | |
6599 | -static int | |
6600 | -do_captured_breakpoint_query (int bnum) | |
6598 | +void | |
6599 | +print_breakpoint (breakpoint *b) | |
6601 | 6600 | { |
6602 | - struct breakpoint *b; | |
6603 | 6601 | 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); | |
6632 | 6603 | } |
6633 | 6604 | |
6634 | 6605 | /* Return true if this breakpoint was set by the user, false if it is |
@@ -1644,4 +1644,7 @@ extern const char *ep_parse_optional_if_clause (const char **arg); | ||
1644 | 1644 | UIOUT iff debugging multiple threads. */ |
1645 | 1645 | extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout); |
1646 | 1646 | |
1647 | +/* Print the specified breakpoint. */ | |
1648 | +extern void print_breakpoint (breakpoint *bp); | |
1649 | + | |
1647 | 1650 | #endif /* !defined (BREAKPOINT_H) */ |
@@ -134,87 +134,6 @@ exception_fprintf (struct ui_file *file, struct gdb_exception e, | ||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
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 | - | |
218 | 137 | /* See exceptions.h. */ |
219 | 138 | |
220 | 139 | int |
@@ -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 |
@@ -679,6 +679,8 @@ extern int show_thread_that_caused_stop (void); | ||
679 | 679 | extern void print_selected_thread_frame (struct ui_out *uiout, |
680 | 680 | user_selected_what selection); |
681 | 681 | |
682 | +extern void thread_select (const char *tidstr, thread_info *thr); | |
683 | + | |
682 | 684 | extern struct thread_info *thread_list; |
683 | 685 | |
684 | 686 | #endif /* GDBTHREAD_H */ |
@@ -24,7 +24,6 @@ | ||
24 | 24 | #include "mi-out.h" |
25 | 25 | #include "breakpoint.h" |
26 | 26 | #include "mi-getopt.h" |
27 | -#include "gdb.h" | |
28 | 27 | #include "observer.h" |
29 | 28 | #include "mi-main.h" |
30 | 29 | #include "mi-cmd-break.h" |
@@ -53,7 +52,17 @@ static void | ||
53 | 52 | breakpoint_notify (struct breakpoint *b) |
54 | 53 | { |
55 | 54 | 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 | + } | |
57 | 66 | } |
58 | 67 | |
59 | 68 | enum bp_type |
@@ -21,7 +21,6 @@ | ||
21 | 21 | #include "defs.h" |
22 | 22 | #include "arch-utils.h" |
23 | 23 | #include "breakpoint.h" |
24 | -#include "gdb.h" | |
25 | 24 | #include "ada-lang.h" |
26 | 25 | #include "mi-cmds.h" |
27 | 26 | #include "mi-getopt.h" |
@@ -33,7 +33,6 @@ | ||
33 | 33 | #include "observer.h" |
34 | 34 | #include "gdbthread.h" |
35 | 35 | #include "solist.h" |
36 | -#include "gdb.h" | |
37 | 36 | #include "objfiles.h" |
38 | 37 | #include "tracepoint.h" |
39 | 38 | #include "cli-out.h" |
@@ -828,6 +827,36 @@ mi_tsv_modified (const struct trace_state_variable *tsv) | ||
828 | 827 | } |
829 | 828 | } |
830 | 829 | |
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 (¤t_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 | + | |
831 | 860 | /* Emit notification about a created breakpoint. */ |
832 | 861 | |
833 | 862 | static void |
@@ -842,36 +871,16 @@ mi_breakpoint_created (struct breakpoint *b) | ||
842 | 871 | SWITCH_THRU_ALL_UIS () |
843 | 872 | { |
844 | 873 | struct mi_interp *mi = as_mi_interp (top_level_interpreter ()); |
845 | - struct ui_out *mi_uiout; | |
846 | 874 | |
847 | 875 | if (mi == NULL) |
848 | 876 | continue; |
849 | 877 | |
850 | - mi_uiout = interp_ui_out (top_level_interpreter ()); | |
851 | - | |
852 | 878 | target_terminal::scoped_restore_terminal_state term_state; |
853 | 879 | target_terminal::ours_for_output (); |
854 | 880 | |
855 | 881 | fprintf_unfiltered (mi->event_channel, |
856 | 882 | "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); | |
875 | 884 | |
876 | 885 | gdb_flush (mi->event_channel); |
877 | 886 | } |
@@ -927,24 +936,7 @@ mi_breakpoint_modified (struct breakpoint *b) | ||
927 | 936 | target_terminal::ours_for_output (); |
928 | 937 | fprintf_unfiltered (mi->event_channel, |
929 | 938 | "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); | |
948 | 940 | |
949 | 941 | gdb_flush (mi->event_channel); |
950 | 942 | } |
@@ -38,7 +38,6 @@ | ||
38 | 38 | #include "gdbcore.h" /* For write_memory(). */ |
39 | 39 | #include "value.h" |
40 | 40 | #include "regcache.h" |
41 | -#include "gdb.h" | |
42 | 41 | #include "frame.h" |
43 | 42 | #include "mi-main.h" |
44 | 43 | #include "mi-common.h" |
@@ -553,21 +552,17 @@ mi_cmd_target_flash_erase (const char *command, char **argv, int argc) | ||
553 | 552 | void |
554 | 553 | mi_cmd_thread_select (const char *command, char **argv, int argc) |
555 | 554 | { |
556 | - enum gdb_rc rc; | |
557 | - char *mi_error_message; | |
558 | - ptid_t previous_ptid = inferior_ptid; | |
559 | - | |
560 | 555 | if (argc != 1) |
561 | 556 | error (_("-thread-select: USAGE: threadnum.")); |
562 | 557 | |
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); | |
564 | 562 | |
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); | |
571 | 566 | |
572 | 567 | print_selected_thread_frame (current_uiout, |
573 | 568 | USER_SELECTED_THREAD | USER_SELECTED_FRAME); |
@@ -583,19 +578,31 @@ mi_cmd_thread_select (const char *command, char **argv, int argc) | ||
583 | 578 | void |
584 | 579 | mi_cmd_thread_list_ids (const char *command, char **argv, int argc) |
585 | 580 | { |
586 | - enum gdb_rc rc; | |
587 | - char *mi_error_message; | |
588 | - | |
589 | 581 | if (argc != 0) |
590 | 582 | error (_("-thread-list-ids: No arguments required.")); |
591 | 583 | |
592 | - rc = gdb_list_thread_ids (current_uiout, &mi_error_message); | |
584 | + int num = 0; | |
585 | + int current_thread = -1; | |
593 | 586 | |
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); | |
599 | 606 | } |
600 | 607 | |
601 | 608 | void |
@@ -1118,10 +1118,9 @@ static struct { | ||
1118 | 1118 | { NULL, NULL } |
1119 | 1119 | }; |
1120 | 1120 | |
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) | |
1123 | 1123 | { |
1124 | - char *buf = (char *) buf_arg; | |
1125 | 1124 | char *c; |
1126 | 1125 | int idx; |
1127 | 1126 |
@@ -1135,10 +1134,10 @@ do_remote_fileio_request (struct ui_out *uiout, void *buf_arg) | ||
1135 | 1134 | for (idx = 0; remote_fio_func_map[idx].name; ++idx) |
1136 | 1135 | if (!strcmp (remote_fio_func_map[idx].name, buf)) |
1137 | 1136 | 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); | |
1142 | 1141 | } |
1143 | 1142 | |
1144 | 1143 | /* Close any open descriptors, and reinitialize the file mapping. */ |
@@ -1188,22 +1187,16 @@ remote_fileio_request (char *buf, int ctrlc_pending_p) | ||
1188 | 1187 | } |
1189 | 1188 | else |
1190 | 1189 | { |
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 | |
1198 | 1191 | { |
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); | |
1207 | 1200 | } |
1208 | 1201 | } |
1209 | 1202 |
@@ -167,31 +167,6 @@ add_symbol_file_from_memory_command (const char *args, int from_tty) | ||
167 | 167 | symbol_file_add_from_memory (templ, addr, 0, NULL, from_tty); |
168 | 168 | } |
169 | 169 | |
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 | - | |
195 | 170 | /* Try to add the symbols for the vsyscall page, if there is one. |
196 | 171 | This function is called via the inferior_created observer. */ |
197 | 172 |
@@ -203,7 +178,6 @@ add_vsyscall_page (struct target_ops *target, int from_tty) | ||
203 | 178 | if (gdbarch_vsyscall_range (target_gdbarch (), &vsyscall_range)) |
204 | 179 | { |
205 | 180 | struct bfd *bfd; |
206 | - struct symbol_file_add_from_memory_args args; | |
207 | 181 | |
208 | 182 | if (core_bfd != NULL) |
209 | 183 | bfd = core_bfd; |
@@ -221,23 +195,24 @@ add_vsyscall_page (struct target_ops *target, int from_tty) | ||
221 | 195 | "because no executable was specified")); |
222 | 196 | return; |
223 | 197 | } |
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 | + } | |
241 | 216 | } |
242 | 217 | } |
243 | 218 |
@@ -30,7 +30,6 @@ | ||
30 | 30 | #include "command.h" |
31 | 31 | #include "gdbcmd.h" |
32 | 32 | #include "regcache.h" |
33 | -#include "gdb.h" | |
34 | 33 | #include "btrace.h" |
35 | 34 | |
36 | 35 | #include <ctype.h> |
@@ -720,50 +719,6 @@ any_live_thread_of_process (int pid) | ||
720 | 719 | return tp_executing; |
721 | 720 | } |
722 | 721 | |
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 | - | |
767 | 722 | /* Return true if TP is an active thread. */ |
768 | 723 | static int |
769 | 724 | thread_alive (struct thread_info *tp) |
@@ -1885,13 +1840,8 @@ thread_command (char *tidstr, int from_tty) | ||
1885 | 1840 | else |
1886 | 1841 | { |
1887 | 1842 | ptid_t previous_ptid = inferior_ptid; |
1888 | - enum gdb_rc result; | |
1889 | - | |
1890 | - result = gdb_thread_select (current_uiout, tidstr, NULL); | |
1891 | 1843 | |
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)); | |
1895 | 1845 | |
1896 | 1846 | /* Print if the thread has not changed, otherwise an event will |
1897 | 1847 | be sent. */ |
@@ -1991,25 +1941,9 @@ show_print_thread_events (struct ui_file *file, int from_tty, | ||
1991 | 1941 | value); |
1992 | 1942 | } |
1993 | 1943 | |
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) | |
1996 | 1946 | { |
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 | - | |
2013 | 1947 | if (!thread_alive (tp)) |
2014 | 1948 | error (_("Thread ID %s has terminated."), tidstr); |
2015 | 1949 |
@@ -2020,8 +1954,6 @@ do_captured_thread_select (struct ui_out *uiout, const char *tidstr) | ||
2020 | 1954 | /* Since the current thread may have changed, see if there is any |
2021 | 1955 | exited thread we can now delete. */ |
2022 | 1956 | prune_threads (); |
2023 | - | |
2024 | - return GDB_RC_OK; | |
2025 | 1957 | } |
2026 | 1958 | |
2027 | 1959 | /* Print thread and frame switch command response. */ |
@@ -2066,20 +1998,6 @@ print_selected_thread_frame (struct ui_out *uiout, | ||
2066 | 1998 | } |
2067 | 1999 | } |
2068 | 2000 | |
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 | - | |
2083 | 2001 | /* Update the 'threads_executing' global based on the threads we know |
2084 | 2002 | about right now. */ |
2085 | 2003 |