[PATCH 3/3] btrace: Remove ui_out cleanups

Metzger, Markus T markus.t.metzger@intel.com
Mon Mar 5 12:39:00 GMT 2018


Hello Simon,


> This patch replaces the cleanups that close the list and tuple of the
> btrace instruction history output with ui_out_emit_tuple and
> ui_out_emit_list.
> 
> This allows removing make_cleanup_ui_out_tuple_begin_end and
> make_cleanup_ui_out_list_begin_end.
> 
> This patch (along with the previous ones in the series) was regtested on
> the buildbot.


> diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
> index 15ce760f5a..ddd15c4781 100644
> --- a/gdb/record-btrace.c
> +++ b/gdb/record-btrace.c
> @@ -620,26 +620,25 @@ btrace_find_line_range (CORE_ADDR pc)
> 
>  static void
>  btrace_print_lines (struct btrace_line_range lines, struct ui_out *uiout,
> -		    struct cleanup **ui_item_chain, int flags)
> +		    gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
> +		    gdb::optional<ui_out_emit_list> *asm_list,

Reference instead of pointer?

 
> -  for (line = lines.begin; line < lines.end; ++line)
> +  for (int line = lines.begin; line < lines.end; ++line)
>      {
> -      if (*ui_item_chain != NULL)
> -	do_cleanups (*ui_item_chain);
> +      asm_list->reset ();
> +      src_and_asm_tuple->reset ();

The SRC_AND_ASM_TUPLE reset () shouldn't be necessary; it is reset () in emplace ().


> -      *ui_item_chain
> -	= make_cleanup_ui_out_tuple_begin_end (uiout, "src_and_asm_line");
> +      src_and_asm_tuple->emplace (uiout, "src_and_asm_line");
> 
>        print_source_lines (lines.symtab, line, line + 1, psl_flags);
> 
> -      make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn");
> +      asm_list->emplace (uiout, "line_asm_insn");
>      }
>  }

Looks good to me, otherwise.

I have not tested it, though.  Did you run the gdb.btrace test suite?  You said
you ran buildbot but that might skip gdb.btrace when run on VMs or on old
hardware.

Please let me know if you want me to run the gdb.btrace tests for you.  A user
branch would be nice in that case.

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928



More information about the Gdb-patches mailing list