Use cleanup machinery to invoke ui_out_list_end().

This commit is contained in:
Kevin Buettner 2001-04-08 17:55:13 +00:00
parent fdec3cfc83
commit d493eb331e
3 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2001-04-08 Kevin Buettner <kevinb@redhat.com>
* printcmd.c (print_frame_args): Use a cleanup to invoke
ui_out_list_end() so that the list count nesting flag will
be decremented properly when an error occurs.
* stack.c (print_frame): Likewise.
2001-04-06 J.T. Conklin <jtc@redback.com>
* dcache.c (dcache_write_line): Fixed bugs where cache line was

View File

@ -1790,7 +1790,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
/* Number of ints of arguments that we have printed so far. */
int args_printed = 0;
#ifdef UI_OUT
struct cleanup *old_chain;
struct cleanup *old_chain, *list_chain;
struct ui_stream *stb;
stb = ui_out_stream_new (uiout);
@ -1909,6 +1909,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
annotate_arg_begin ();
ui_out_list_begin (uiout, NULL);
list_chain = make_cleanup_ui_out_list_end (uiout);
fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym),
SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
ui_out_field_stream (uiout, "name", stb);
@ -1951,7 +1952,8 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
else
ui_out_text (uiout, "???");
ui_out_list_end (uiout);
/* Invoke ui_out_list_end. */
do_cleanups (list_chain);
#else
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
VALUE_ADDRESS (val),

View File

@ -580,15 +580,20 @@ print_frame (struct frame_info *fi,
if (args)
{
struct print_args_args args;
#ifdef UI_OUT
struct cleanup *args_list_chain;
#endif
args.fi = fi;
args.func = func;
args.stream = gdb_stdout;
#ifdef UI_OUT
ui_out_list_begin (uiout, "args");
args_list_chain = make_cleanup_ui_out_list_end (uiout);
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
/* FIXME: args must be a list. If one argument is a string it will
have " that will not be properly escaped. */
ui_out_list_end (uiout);
/* Invoke ui_out_list_end. */
do_cleanups (args_list_chain);
#else
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
#endif