From: Kevin Buettner Date: Sun, 8 Apr 2001 17:55:13 +0000 (+0000) Subject: Use cleanup machinery to invoke ui_out_list_end(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d493eb331e42b99fd3a9cea536f4dda6d5e8e961;p=binutils-gdb.git Use cleanup machinery to invoke ui_out_list_end(). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 95a30ef77cd..8085d06caba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2001-04-08 Kevin Buettner + + * 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 * dcache.c (dcache_write_line): Fixed bugs where cache line was diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 92e06efc804..c49f51b7c90 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -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), diff --git a/gdb/stack.c b/gdb/stack.c index 8dca5e0d184..07bea73a54f 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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