[02/10] btrace: Enable auxiliary instructions in record instruction-history.

Message ID 1559119673-30516-3-git-send-email-felix.willgerodt@intel.com
State New, archived
Headers

Commit Message

Willgerodt, Felix May 29, 2019, 8:47 a.m. UTC
  From: Felix Willgerodt <felix.willgerodt@intel.com>

Print the auxiliary data when a btrace_insn of type BTRACE_INSN_AUX
is encountered in the instruction-history.

This patch is in preparation for the ptwrite feature, which is based on
auxiliary instructions.

2019-05-29  Felix Willgerodt  <felix.willgerodt@intel.com>

gdb/ChangeLog:
	* record-btrace.c (btrace_insn_history): Handle BTRACE_INSN_AUX.

---
 gdb/record-btrace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

Metzger, Markus T June 4, 2019, 12:35 p.m. UTC | #1
Hello Felix,

> Print the auxiliary data when a btrace_insn of type BTRACE_INSN_AUX
> is encountered in the instruction-history.
> 
> This patch is in preparation for the ptwrite feature, which is based on
> auxiliary instructions.
> 
> 2019-05-29  Felix Willgerodt  <felix.willgerodt@intel.com>
> 
> gdb/ChangeLog:
> 	* record-btrace.c (btrace_insn_history): Handle BTRACE_INSN_AUX.
> 
> ---
>  gdb/record-btrace.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

LGTM with one tiny nit below.

> @@ -811,6 +811,16 @@ btrace_insn_history (struct ui_out *uiout,
>  	  btrace_ui_out_decode_error (uiout, btrace_insn_get_error (&it),
>  				      conf->format);
>  	}
> +      else if (insn->iclass == BTRACE_INSN_AUX)
> +	{
> +	  uiout->field_fmt ("insn-number", "%u", btrace_insn_number (&it));
> +	  uiout->text ("\t");
> +	  uiout->spaces (3);
> +	  uiout->text ("[");
> +	  uiout->field_fmt ("aux-insn", "%s",

The field is called aux_data.   Should they be aligned?

> +			    it.btinfo->aux_data[insn->aux_data_index].c_str ());
> +	  uiout->text ("]\n");
> +	}
>        else
>  	{
>  	  struct disasm_insn dinsn;
> --
> 2.20.1

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, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  

Patch

diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 21085d5c62c..5fb967c40f0 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -811,6 +811,16 @@  btrace_insn_history (struct ui_out *uiout,
 	  btrace_ui_out_decode_error (uiout, btrace_insn_get_error (&it),
 				      conf->format);
 	}
+      else if (insn->iclass == BTRACE_INSN_AUX)
+	{
+	  uiout->field_fmt ("insn-number", "%u", btrace_insn_number (&it));
+	  uiout->text ("\t");
+	  uiout->spaces (3);
+	  uiout->text ("[");
+	  uiout->field_fmt ("aux-insn", "%s",
+			    it.btinfo->aux_data[insn->aux_data_index].c_str ());
+	  uiout->text ("]\n");
+	}
       else
 	{
 	  struct disasm_insn dinsn;