]>
Commit | Line | Data |
---|---|---|
51a5ef0f PS |
1 | https://bugzilla.redhat.com/show_bug.cgi?id=610986 |
2 | http://sourceware.org/ml/gdb-cvs/2010-08/msg00112.html | |
3 | ||
4 | ### src/gdb/ChangeLog 2010/08/18 22:57:45 1.12097 | |
5 | ### src/gdb/ChangeLog 2010/08/19 07:34:26 1.12098 | |
6 | ## -1,3 +1,9 @@ | |
7 | +2010-08-19 Jan Kratochvil <jan.kratochvil@redhat.com> | |
8 | + | |
9 | + * varobj.c (varobj_create): Replace variable old_fi with old_id, | |
10 | + initialize it by null_frame_id, wrap its usage by get_frame_id, | |
11 | + frame_id_p and frame_find_by_id. | |
12 | + | |
13 | 2010-08-18 Tom Tromey <tromey@redhat.com> | |
14 | ||
15 | PR python/11900: | |
16 | --- src/gdb/varobj.c 2010/08/06 14:17:56 1.159 | |
17 | +++ src/gdb/varobj.c 2010/08/19 07:34:27 1.160 | |
18 | @@ -524,7 +524,7 @@ varobj_create (char *objname, | |
19 | { | |
20 | struct varobj *var; | |
21 | struct frame_info *fi; | |
22 | - struct frame_info *old_fi = NULL; | |
23 | + struct frame_id old_id = null_frame_id; | |
24 | struct block *block; | |
25 | struct cleanup *old_chain; | |
26 | ||
27 | @@ -611,7 +611,7 @@ | |
28 | ||
29 | var->root->frame = get_frame_id (fi); | |
30 | var->root->thread_id = pid_to_thread_id (inferior_ptid); | |
31 | - old_fi = get_selected_frame (NULL); | |
32 | + old_id = get_frame_id (get_selected_frame (NULL)); | |
33 | select_frame (fi); | |
34 | } | |
35 | ||
36 | @@ -639,8 +639,8 @@ | |
37 | var->root->rootvar = var; | |
38 | ||
39 | /* Reset the selected frame */ | |
40 | - if (old_fi != NULL) | |
41 | - select_frame (old_fi); | |
42 | + if (frame_id_p (old_id)) | |
43 | + select_frame (frame_find_by_id (old_id)); | |
44 | } | |
45 | ||
46 | /* If the variable object name is null, that means this | |
47 | ||
48 | ||
49 | ||
50 | https://bugzilla.redhat.com/show_bug.cgi?id=627506 | |
51 | Re: [patch] Fix nesting of ui_out_redirect | |
52 | http://sourceware.org/ml/gdb-patches/2010-09/msg00122.html | |
53 | http://sourceware.org/ml/gdb-cvs/2010-09/msg00031.html | |
54 | ||
55 | ### src/gdb/ChangeLog 2010/09/03 01:29:09 1.12149 | |
56 | ### src/gdb/ChangeLog 2010/09/03 15:41:59 1.12150 | |
57 | ## -1,3 +1,27 @@ | |
58 | +2010-09-03 Jan Kratochvil <jan.kratochvil@redhat.com> | |
59 | + | |
60 | + * breakpoint.c (save_breakpoints): Use RETURN_MASK_ALL. | |
61 | + * cli-out.c: Include vec.h. | |
62 | + (cli_field_fmt, cli_spaces, cli_text, cli_message, cli_flush): New | |
63 | + variable stream, initialize it, use it. | |
64 | + (cli_redirect): New function comment. Replace the stream and | |
65 | + original_stream fields by the new streams field. Remove the | |
66 | + original_stream != NULL conditional, assert error on NULL instead. | |
67 | + (out_field_fmt, field_separator): New variable stream, initialize it, use it. | |
68 | + (cli_out_data_ctor): Assert non-NULL stream. Replace the stream and | |
69 | + original_stream fields by the new streams field. | |
70 | + (cli_out_set_stream): Replace the stream field by the new streams | |
71 | + field. | |
72 | + * cli-out.h: Include vec.h. | |
73 | + (ui_filep): New typedef, call DEF_VEC_P for it. | |
74 | + (struct cli_ui_out_data): Replace the stream and original_stream | |
75 | + fields by the new streams field. | |
76 | + * cli/cli-logging.c (set_logging_redirect): Call ui_out_redirect with | |
77 | + NULL first. Extend the comment. | |
78 | + (handle_redirections): Call ui_out_redirect with output. | |
79 | + * python/py-breakpoint.c (bppy_get_commands): Move ui_out_redirect | |
80 | + calls outside of the TRY_CATCH block. | |
81 | + | |
82 | ||
83 | [ cli/cli-logging.c removed. ] | |
84 | ||
85 | --- src/gdb/breakpoint.c 2010/08/30 09:49:12 1.511 | |
86 | +++ src/gdb/breakpoint.c 2010/09/03 15:42:02 1.512 | |
87 | @@ -11487,7 +11487,7 @@ | |
88 | fprintf_unfiltered (fp, " commands\n"); | |
89 | ||
90 | ui_out_redirect (uiout, fp); | |
91 | - TRY_CATCH (ex, RETURN_MASK_ERROR) | |
92 | + TRY_CATCH (ex, RETURN_MASK_ALL) | |
93 | { | |
94 | print_command_lines (uiout, tp->commands->commands, 2); | |
95 | } | |
96 | --- src/gdb/cli-out.c 2010/05/13 23:53:32 1.30 | |
97 | +++ src/gdb/cli-out.c 2010/09/03 15:42:02 1.31 | |
98 | @@ -26,6 +26,7 @@ | |
99 | #include "cli-out.h" | |
100 | #include "gdb_string.h" | |
101 | #include "gdb_assert.h" | |
102 | +#include "vec.h" | |
103 | ||
104 | typedef struct cli_ui_out_data cli_out_data; | |
105 | ||
106 | @@ -224,11 +225,13 @@ | |
107 | va_list args) | |
108 | { | |
109 | cli_out_data *data = ui_out_data (uiout); | |
110 | + struct ui_file *stream; | |
111 | ||
112 | if (data->suppress_output) | |
113 | return; | |
114 | ||
115 | - vfprintf_filtered (data->stream, format, args); | |
116 | + stream = VEC_last (ui_filep, data->streams); | |
117 | + vfprintf_filtered (stream, format, args); | |
118 | ||
119 | if (align != ui_noalign) | |
120 | field_separator (); | |
121 | @@ -238,20 +241,26 @@ | |
122 | cli_spaces (struct ui_out *uiout, int numspaces) | |
123 | { | |
124 | cli_out_data *data = ui_out_data (uiout); | |
125 | + struct ui_file *stream; | |
126 | ||
127 | if (data->suppress_output) | |
128 | return; | |
129 | - print_spaces_filtered (numspaces, data->stream); | |
130 | + | |
131 | + stream = VEC_last (ui_filep, data->streams); | |
132 | + print_spaces_filtered (numspaces, stream); | |
133 | } | |
134 | ||
135 | static void | |
136 | cli_text (struct ui_out *uiout, const char *string) | |
137 | { | |
138 | cli_out_data *data = ui_out_data (uiout); | |
139 | + struct ui_file *stream; | |
140 | ||
141 | if (data->suppress_output) | |
142 | return; | |
143 | - fputs_filtered (string, data->stream); | |
144 | + | |
145 | + stream = VEC_last (ui_filep, data->streams); | |
146 | + fputs_filtered (string, stream); | |
147 | } | |
148 | ||
149 | static void ATTRIBUTE_PRINTF (3, 0) | |
150 | @@ -262,8 +271,13 @@ | |
151 | ||
152 | if (data->suppress_output) | |
153 | return; | |
154 | + | |
155 | if (ui_out_get_verblvl (uiout) >= verbosity) | |
156 | - vfprintf_unfiltered (data->stream, format, args); | |
157 | + { | |
158 | + struct ui_file *stream = VEC_last (ui_filep, data->streams); | |
159 | + | |
160 | + vfprintf_unfiltered (stream, format, args); | |
161 | + } | |
162 | } | |
163 | ||
164 | static void | |
165 | @@ -280,25 +294,24 @@ | |
166 | cli_flush (struct ui_out *uiout) | |
167 | { | |
168 | cli_out_data *data = ui_out_data (uiout); | |
169 | + struct ui_file *stream = VEC_last (ui_filep, data->streams); | |
170 | ||
171 | - gdb_flush (data->stream); | |
172 | + gdb_flush (stream); | |
173 | } | |
174 | ||
175 | +/* OUTSTREAM as non-NULL will push OUTSTREAM on the stack of output streams | |
176 | + and make it therefore active. OUTSTREAM as NULL will pop the last pushed | |
177 | + output stream; it is an internal error if it does not exist. */ | |
178 | + | |
179 | static int | |
180 | cli_redirect (struct ui_out *uiout, struct ui_file *outstream) | |
181 | { | |
182 | cli_out_data *data = ui_out_data (uiout); | |
183 | ||
184 | if (outstream != NULL) | |
185 | - { | |
186 | - data->original_stream = data->stream; | |
187 | - data->stream = outstream; | |
188 | - } | |
189 | - else if (data->original_stream != NULL) | |
190 | - { | |
191 | - data->stream = data->original_stream; | |
192 | - data->original_stream = NULL; | |
193 | - } | |
194 | + VEC_safe_push (ui_filep, data->streams, outstream); | |
195 | + else | |
196 | + VEC_pop (ui_filep, data->streams); | |
197 | ||
198 | return 0; | |
199 | } | |
200 | @@ -315,10 +328,11 @@ | |
201 | const char *format,...) | |
202 | { | |
203 | cli_out_data *data = ui_out_data (uiout); | |
204 | + struct ui_file *stream = VEC_last (ui_filep, data->streams); | |
205 | va_list args; | |
206 | ||
207 | va_start (args, format); | |
208 | - vfprintf_filtered (data->stream, format, args); | |
209 | + vfprintf_filtered (stream, format, args); | |
210 | ||
211 | va_end (args); | |
212 | } | |
213 | @@ -329,8 +343,9 @@ | |
214 | field_separator (void) | |
215 | { | |
216 | cli_out_data *data = ui_out_data (uiout); | |
217 | + struct ui_file *stream = VEC_last (ui_filep, data->streams); | |
218 | ||
219 | - fputc_filtered (' ', data->stream); | |
220 | + fputc_filtered (' ', stream); | |
221 | } | |
222 | ||
223 | /* This is the CLI ui-out implementation functions vector */ | |
224 | @@ -364,8 +379,11 @@ | |
225 | void | |
226 | cli_out_data_ctor (cli_out_data *self, struct ui_file *stream) | |
227 | { | |
228 | - self->stream = stream; | |
229 | - self->original_stream = NULL; | |
230 | + gdb_assert (stream != NULL); | |
231 | + | |
232 | + self->streams = NULL; | |
233 | + VEC_safe_push (ui_filep, self->streams, stream); | |
234 | + | |
235 | self->suppress_output = 0; | |
236 | } | |
237 | ||
238 | @@ -385,8 +403,10 @@ | |
239 | cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream) | |
240 | { | |
241 | cli_out_data *data = ui_out_data (uiout); | |
242 | - struct ui_file *old = data->stream; | |
243 | + struct ui_file *old; | |
244 | + | |
245 | + old = VEC_pop (ui_filep, data->streams); | |
246 | + VEC_quick_push (ui_filep, data->streams, stream); | |
247 | ||
248 | - data->stream = stream; | |
249 | return old; | |
250 | } | |
251 | --- src/gdb/cli-out.h 2010/04/18 00:11:55 1.11 | |
252 | +++ src/gdb/cli-out.h 2010/09/03 15:42:02 1.12 | |
253 | @@ -22,14 +22,19 @@ | |
254 | #define CLI_OUT_H | |
255 | ||
256 | #include "ui-out.h" | |
257 | +#include "vec.h" | |
258 | + | |
259 | +/* Used for cli_ui_out_data->streams. */ | |
260 | + | |
261 | +typedef struct ui_file *ui_filep; | |
262 | +DEF_VEC_P (ui_filep); | |
263 | ||
264 | /* These are exported so that they can be extended by other `ui_out' | |
265 | implementations, like TUI's. */ | |
266 | ||
267 | struct cli_ui_out_data | |
268 | { | |
269 | - struct ui_file *stream; | |
270 | - struct ui_file *original_stream; | |
271 | + VEC (ui_filep) *streams; | |
272 | int suppress_output; | |
273 | }; | |
274 | ||
275 | --- src/gdb/python/py-breakpoint.c 2010/07/01 10:36:12 1.4 | |
276 | +++ src/gdb/python/py-breakpoint.c 2010/09/03 15:42:03 1.5 | |
277 | @@ -474,12 +474,12 @@ | |
278 | string_file = mem_fileopen (); | |
279 | chain = make_cleanup_ui_file_delete (string_file); | |
280 | ||
281 | + ui_out_redirect (uiout, string_file); | |
282 | TRY_CATCH (except, RETURN_MASK_ALL) | |
283 | { | |
284 | - ui_out_redirect (uiout, string_file); | |
285 | print_command_lines (uiout, breakpoint_commands (bp), 0); | |
286 | - ui_out_redirect (uiout, NULL); | |
287 | } | |
288 | + ui_out_redirect (uiout, NULL); | |
289 | cmdstr = ui_file_xstrdup (string_file, &length); | |
290 | GDB_PY_HANDLE_EXCEPTION (except); | |
291 | ||
292 | ### src/gdb/testsuite/ChangeLog 2010/09/02 15:19:56 1.2435 | |
293 | ### src/gdb/testsuite/ChangeLog 2010/09/03 15:42:04 1.2436 | |
294 | ## -1,3 +1,7 @@ | |
295 | +2010-09-03 Jan Kratochvil <jan.kratochvil@redhat.com> | |
296 | + | |
297 | + * gdb.base/ui-redirect.exp: New file. | |
298 | + | |
299 | 2010-09-02 Jan Kratochvil <jan.kratochvil@redhat.com> | |
300 | Joel Brobecker <brobecker@adacore.com> | |
301 | ||
302 | --- src/gdb/testsuite/gdb.base/ui-redirect.exp | |
303 | +++ src/gdb/testsuite/gdb.base/ui-redirect.exp 2010-09-11 18:42:40.040910000 +0000 | |
304 | @@ -0,0 +1,41 @@ | |
305 | +# Copyright (C) 2010 Free Software Foundation, Inc. | |
306 | + | |
307 | +# This program is free software; you can redistribute it and/or modify | |
308 | +# it under the terms of the GNU General Public License as published by | |
309 | +# the Free Software Foundation; either version 3 of the License, or | |
310 | +# (at your option) any later version. | |
311 | +# | |
312 | +# This program is distributed in the hope that it will be useful, | |
313 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
314 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
315 | +# GNU General Public License for more details. | |
316 | +# | |
317 | +# You should have received a copy of the GNU General Public License | |
318 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
319 | + | |
320 | +if { [prepare_for_testing ui-redirect.exp ui-redirect start.c] } { | |
321 | + return -1 | |
322 | +} | |
323 | + | |
324 | +gdb_breakpoint main | |
325 | + | |
326 | +set test "commands" | |
327 | +gdb_test_multiple $test $test { | |
328 | + -re "End with a line saying just \"end\"\\.\r\n>$" { | |
329 | + pass $test | |
330 | + } | |
331 | +} | |
332 | + | |
333 | +set test "print 1" | |
334 | +gdb_test_multiple $test $test { | |
335 | + -re "\r\n>$" { | |
336 | + pass $test | |
337 | + } | |
338 | +} | |
339 | +gdb_test_no_output "end" | |
340 | + | |
341 | +gdb_test_no_output "set logging file /dev/null" | |
342 | +gdb_test "set logging on" "Copying output to /dev/null\\." | |
343 | +gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." | |
344 | +gdb_test "set logging off" "Done logging to /dev/null\\." | |
345 | +gdb_test "help" "List of classes of commands:.*" | |
346 | ||
347 | ||
348 | ||
349 | https://bugzilla.redhat.com/show_bug.cgi?id=627506 | |
350 | Re: [patch] Fix uiout for execute_command_to_string | |
351 | http://sourceware.org/ml/gdb-patches/2010-09/msg00235.html | |
352 | http://sourceware.org/ml/gdb-cvs/2010-09/msg00080.html | |
353 | ||
354 | ### src/gdb/ChangeLog 2010/09/10 16:17:11 1.12170 | |
355 | ### src/gdb/ChangeLog 2010/09/11 16:00:20 1.12171 | |
356 | ## -1,3 +1,21 @@ | |
357 | +2010-09-11 Jan Kratochvil <jan.kratochvil@redhat.com> | |
358 | + Paul Bolle <pebolle@tiscali.nl> | |
359 | + | |
360 | + Redirect also uiout and stdtarg{,err} in execute_command_to_string. | |
361 | + * cli-logging.c (struct saved_output_files) <targerr>: New. | |
362 | + (set_logging_redirect, pop_output_files, handle_redirections): | |
363 | + Redirect also gdb_stdtargerr. | |
364 | + * defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New | |
365 | + declarations. | |
366 | + * event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect | |
367 | + also gdb_stdtargerr. | |
368 | + * top.c (execute_command_to_string): Move make_cleanup_ui_file_delete | |
369 | + to the top. Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr. | |
370 | + Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop. | |
371 | + * tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr. | |
372 | + * utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop): | |
373 | + New functions. | |
374 | + | |
375 | ||
376 | ### src/gdb/testsuite/ChangeLog 2010/09/10 20:29:25 1.2444 | |
377 | ### src/gdb/testsuite/ChangeLog 2010/09/11 16:00:26 1.2445 | |
378 | ## -1,3 +1,8 @@ | |
379 | +2010-09-11 Jan Kratochvil <jan.kratochvil@redhat.com> | |
380 | + | |
381 | + * gdb.python/python.exp (set height 0, collect help from uiout) | |
382 | + (verify help to uiout): New tests. | |
383 | + | |
384 | ||
385 | [ gdb_stdtargerr handling dropped. ] | |
386 | ||
387 | --- src/gdb/defs.h 2010/08/31 18:08:43 1.278 | |
388 | +++ src/gdb/defs.h 2010/09/11 16:00:25 1.279 | |
389 | @@ -337,6 +337,10 @@ | |
390 | struct ui_file; | |
391 | extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *); | |
392 | ||
393 | +struct ui_out; | |
394 | +extern struct cleanup * | |
395 | + make_cleanup_ui_out_redirect_pop (struct ui_out *uiout); | |
396 | + | |
397 | struct section_addr_info; | |
398 | extern struct cleanup *(make_cleanup_free_section_addr_info | |
399 | (struct section_addr_info *)); | |
400 | --- src/gdb/top.c 2010/08/07 15:00:37 1.183 | |
401 | +++ src/gdb/top.c 2010/09/11 16:00:25 1.184 | |
402 | @@ -475,12 +475,23 @@ | |
403 | ||
404 | str_file = mem_fileopen (); | |
405 | ||
406 | + make_cleanup_ui_file_delete (str_file); | |
407 | make_cleanup_restore_ui_file (&gdb_stdout); | |
408 | make_cleanup_restore_ui_file (&gdb_stderr); | |
409 | - make_cleanup_ui_file_delete (str_file); | |
410 | + make_cleanup_restore_ui_file (&gdb_stdlog); | |
411 | + make_cleanup_restore_ui_file (&gdb_stdtarg); | |
412 | + make_cleanup_restore_ui_file (&gdb_stdtargerr); | |
413 | + | |
414 | + if (ui_out_redirect (uiout, str_file) < 0) | |
415 | + warning (_("Current output protocol does not support redirection")); | |
416 | + else | |
417 | + make_cleanup_ui_out_redirect_pop (uiout); | |
418 | ||
419 | gdb_stdout = str_file; | |
420 | gdb_stderr = str_file; | |
421 | + gdb_stdlog = str_file; | |
422 | + gdb_stdtarg = str_file; | |
423 | + gdb_stdtargerr = str_file; | |
424 | ||
425 | execute_command (p, from_tty); | |
426 | ||
427 | --- src/gdb/utils.c 2010/08/07 15:00:37 1.239 | |
428 | +++ src/gdb/utils.c 2010/09/11 16:00:25 1.240 | |
429 | @@ -311,6 +311,26 @@ | |
430 | return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg); | |
431 | } | |
432 | ||
433 | +/* Helper function for make_cleanup_ui_out_redirect_pop. */ | |
434 | + | |
435 | +static void | |
436 | +do_ui_out_redirect_pop (void *arg) | |
437 | +{ | |
438 | + struct ui_out *uiout = arg; | |
439 | + | |
440 | + if (ui_out_redirect (uiout, NULL) < 0) | |
441 | + warning (_("Cannot restore redirection of the current output protocol")); | |
442 | +} | |
443 | + | |
444 | +/* Return a new cleanup that pops the last redirection by ui_out_redirect | |
445 | + with NULL parameter. */ | |
446 | + | |
447 | +struct cleanup * | |
448 | +make_cleanup_ui_out_redirect_pop (struct ui_out *uiout) | |
449 | +{ | |
450 | + return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout); | |
451 | +} | |
452 | + | |
453 | static void | |
454 | do_free_section_addr_info (void *arg) | |
455 | { | |
456 | --- gdb-7.2/gdb/testsuite/gdb.python/python.exp-orig 2010-08-09 21:23:00.000000000 +0200 | |
457 | +++ gdb-7.2/gdb/testsuite/gdb.python/python.exp 2010-09-11 20:49:22.000000000 +0200 | |
458 | @@ -110,3 +110,9 @@ gdb_test_multiple "python print \"\\n\" | |
459 | } | |
460 | } | |
461 | gdb_test "q" "Quit" "verify pagination afterwards: q" | |
462 | + | |
463 | +gdb_test_no_output "set height 0" | |
464 | + | |
465 | +gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout" | |
466 | + | |
467 | +gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout" |