aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-11 15:02:04 -0600
committerTom Tromey <tom@tromey.com>2017-09-09 13:46:05 -0600
commit76f9c9cfd42eb8df90ce8455a92109c0f71b41e1 (patch)
tree412125e3a8e7f78d909430fbed1cd045e332828a /gdb/stack.c
parentdc9fe180a4437b437015a8b835d05e32d64dff3d (diff)
downloadgdb-76f9c9cfd42eb8df90ce8455a92109c0f71b41e1.zip
gdb-76f9c9cfd42eb8df90ce8455a92109c0f71b41e1.tar.gz
gdb-76f9c9cfd42eb8df90ce8455a92109c0f71b41e1.tar.bz2
Use ui_out_emit_tuple in more places
This changes more places to use ui_out_emit_tuple, removing cleanups. ChangeLog 2017-09-09 Tom Tromey <tom@tromey.com> * target.c (flash_erase_command): Use ui_out_emit_tuple. * stack.c (print_frame): Use ui_out_emit_tuple. * spu-tdep.c (info_spu_event_command): Use ui_out_emit_tuple. (info_spu_mailbox_command, info_spu_dma_command) (info_spu_proxydma_command): Likewise. * mi/mi-main.c (mi_cmd_trace_frame_collected): Use ui_out_emit_tuple, gdb::byte_vector, bin2hex. * mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Use ui_out_emit_tuple. * breakpoint.c (print_it_watchpoint): Use ui_out_emit_tuple.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 06d891d..a3bc9a3 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1139,7 +1139,7 @@ print_frame (struct frame_info *frame, int print_level,
struct ui_out *uiout = current_uiout;
char *funname = NULL;
enum language funlang = language_unknown;
- struct cleanup *old_chain, *list_chain;
+ struct cleanup *old_chain;
struct value_print_options opts;
struct symbol *func;
CORE_ADDR pc = 0;
@@ -1154,107 +1154,107 @@ print_frame (struct frame_info *frame, int print_level,
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
gdbarch, pc);
- list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
+ {
+ ui_out_emit_tuple tuple_emitter (uiout, "frame");
- if (print_level)
- {
- uiout->text ("#");
- uiout->field_fmt_int (2, ui_left, "level",
- frame_relative_level (frame));
- }
- get_user_print_options (&opts);
- if (opts.addressprint)
- if (!sal.symtab
- || frame_show_address (frame, sal)
- || print_what == LOC_AND_ADDRESS)
+ if (print_level)
{
- annotate_frame_address ();
- if (pc_p)
- uiout->field_core_addr ("addr", gdbarch, pc);
- else
- uiout->field_string ("addr", "<unavailable>");
- annotate_frame_address_end ();
- uiout->text (" in ");
+ uiout->text ("#");
+ uiout->field_fmt_int (2, ui_left, "level",
+ frame_relative_level (frame));
}
- annotate_frame_function_name ();
-
- string_file stb;
- fprintf_symbol_filtered (&stb, funname ? funname : "??",
- funlang, DMGL_ANSI);
- uiout->field_stream ("func", stb);
- uiout->wrap_hint (" ");
- annotate_frame_args ();
-
- uiout->text (" (");
- if (print_args)
- {
- struct gdbarch *gdbarch = get_frame_arch (frame);
- int numargs;
-
- if (gdbarch_frame_num_args_p (gdbarch))
+ get_user_print_options (&opts);
+ if (opts.addressprint)
+ if (!sal.symtab
+ || frame_show_address (frame, sal)
+ || print_what == LOC_AND_ADDRESS)
{
- numargs = gdbarch_frame_num_args (gdbarch, frame);
- gdb_assert (numargs >= 0);
+ annotate_frame_address ();
+ if (pc_p)
+ uiout->field_core_addr ("addr", gdbarch, pc);
+ else
+ uiout->field_string ("addr", "<unavailable>");
+ annotate_frame_address_end ();
+ uiout->text (" in ");
}
- else
- numargs = -1;
-
+ annotate_frame_function_name ();
+
+ string_file stb;
+ fprintf_symbol_filtered (&stb, funname ? funname : "??",
+ funlang, DMGL_ANSI);
+ uiout->field_stream ("func", stb);
+ uiout->wrap_hint (" ");
+ annotate_frame_args ();
+
+ uiout->text (" (");
+ if (print_args)
{
- ui_out_emit_list list_emitter (uiout, "args");
- TRY
- {
- print_frame_args (func, frame, numargs, gdb_stdout);
- }
- CATCH (e, RETURN_MASK_ERROR)
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ int numargs;
+
+ if (gdbarch_frame_num_args_p (gdbarch))
{
+ numargs = gdbarch_frame_num_args (gdbarch, frame);
+ gdb_assert (numargs >= 0);
}
- END_CATCH
+ else
+ numargs = -1;
+
+ {
+ ui_out_emit_list list_emitter (uiout, "args");
+ TRY
+ {
+ print_frame_args (func, frame, numargs, gdb_stdout);
+ }
+ CATCH (e, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
- /* FIXME: ARGS must be a list. If one argument is a string it
- will have " that will not be properly escaped. */
+ /* FIXME: ARGS must be a list. If one argument is a string it
+ will have " that will not be properly escaped. */
+ }
+ QUIT;
}
- QUIT;
- }
- uiout->text (")");
- if (sal.symtab)
- {
- const char *filename_display;
+ uiout->text (")");
+ if (sal.symtab)
+ {
+ const char *filename_display;
- filename_display = symtab_to_filename_for_display (sal.symtab);
- annotate_frame_source_begin ();
- uiout->wrap_hint (" ");
- uiout->text (" at ");
- annotate_frame_source_file ();
- uiout->field_string ("file", filename_display);
- if (uiout->is_mi_like_p ())
- {
- const char *fullname = symtab_to_fullname (sal.symtab);
+ filename_display = symtab_to_filename_for_display (sal.symtab);
+ annotate_frame_source_begin ();
+ uiout->wrap_hint (" ");
+ uiout->text (" at ");
+ annotate_frame_source_file ();
+ uiout->field_string ("file", filename_display);
+ if (uiout->is_mi_like_p ())
+ {
+ const char *fullname = symtab_to_fullname (sal.symtab);
- uiout->field_string ("fullname", fullname);
- }
- annotate_frame_source_file_end ();
- uiout->text (":");
- annotate_frame_source_line ();
- uiout->field_int ("line", sal.line);
- annotate_frame_source_end ();
- }
+ uiout->field_string ("fullname", fullname);
+ }
+ annotate_frame_source_file_end ();
+ uiout->text (":");
+ annotate_frame_source_line ();
+ uiout->field_int ("line", sal.line);
+ annotate_frame_source_end ();
+ }
- if (pc_p && (funname == NULL || sal.symtab == NULL))
- {
- char *lib = solib_name_from_address (get_frame_program_space (frame),
- get_frame_pc (frame));
+ if (pc_p && (funname == NULL || sal.symtab == NULL))
+ {
+ char *lib = solib_name_from_address (get_frame_program_space (frame),
+ get_frame_pc (frame));
- if (lib)
- {
- annotate_frame_where ();
- uiout->wrap_hint (" ");
- uiout->text (" from ");
- uiout->field_string ("from", lib);
- }
- }
+ if (lib)
+ {
+ annotate_frame_where ();
+ uiout->wrap_hint (" ");
+ uiout->text (" from ");
+ uiout->field_string ("from", lib);
+ }
+ }
+ }
- /* do_cleanups will call ui_out_tuple_end() for us. */
- do_cleanups (list_chain);
uiout->text ("\n");
do_cleanups (old_chain);
}