public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Felix Willgerodt <felix.willgerodt@intel.com>
To: gdb-patches@sourceware.org, markus.t.metzger@intel.com
Cc: Felix Willgerodt <felix.willgerodt@intel.com>
Subject: [PATCH v7 01/10] btrace: Introduce auxiliary instructions.
Date: Fri, 21 Oct 2022 13:59:38 +0200	[thread overview]
Message-ID: <20221021115947.359223-2-felix.willgerodt@intel.com> (raw)
Message-ID: <20221021115938.DyGqoHDlArdE7JF71NPhb7eFZXn4z8j4EKq06Gb8P1I@z> (raw)
In-Reply-To: <20221021115947.359223-1-felix.willgerodt@intel.com>

Auxiliary instructions are pseudo instructions pointing to auxiliary data.
This auxiliary data can be printed in all commands displaying (record
function-call-history, record instruction-history) or stepping through
(stepi etc.) the execution history, which will be introduced in the next
commits.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.
---
 gdb/btrace.c        |  2 ++
 gdb/btrace.h        | 24 +++++++++++++++++++++---
 gdb/doc/gdb.texinfo |  3 +++
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/gdb/btrace.c b/gdb/btrace.c
index a8e6049265c..4a1b10b7c81 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1823,6 +1823,8 @@ btrace_clear_history (struct btrace_thread_info *btinfo)
   btinfo->insn_history = NULL;
   btinfo->call_history = NULL;
   btinfo->replay = NULL;
+
+  btinfo->aux_data.clear ();
 }
 
 /* Clear the branch trace maintenance histories in BTINFO.  */
diff --git a/gdb/btrace.h b/gdb/btrace.h
index 0fcf669597a..be4ce424ed5 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -52,7 +52,10 @@ enum btrace_insn_class
   BTRACE_INSN_RETURN,
 
   /* The instruction is an unconditional jump.  */
-  BTRACE_INSN_JUMP
+  BTRACE_INSN_JUMP,
+
+  /* The instruction is a pseudo instruction containing auxiliary data.  */
+  BTRACE_INSN_AUX
 };
 
 /* Instruction flags.  */
@@ -68,8 +71,19 @@ DEF_ENUM_FLAGS_TYPE (enum btrace_insn_flag, btrace_insn_flags);
    This represents a single instruction in a branch trace.  */
 struct btrace_insn
 {
-  /* The address of this instruction.  */
-  CORE_ADDR pc;
+  union
+  {
+    /* The address of this instruction.  Applies to btrace_insn with
+       iclass == BTRACE_INSN_OTHER or
+       iclass == BTRACE_INSN_CALL or
+       iclass == BTRACE_INSN_RETURN or
+       iclass == BTRACE_INSN_JUMP.  */
+    CORE_ADDR pc;
+
+    /* Index into btrace_info::aux_data.  Applies to btrace_insn with
+       iclass == BTRACE_INSN_AUX.  */
+    uint64_t aux_data_index;
+  };
 
   /* The size of this instruction in bytes.  */
   gdb_byte size;
@@ -330,6 +344,10 @@ struct btrace_thread_info
      function segment i will be at index (i - 1).  */
   std::vector<btrace_function> functions;
 
+  /* Optional auxiliary information that is printed in all commands
+     displaying or stepping through the execution history.  */
+  std::vector<std::string> aux_data;
+
   /* The function level offset.  When added to each function's LEVEL,
      this normalizes the function levels such that the smallest level
      becomes zero.  */
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ea66f4ee42d..5df67eb6644 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7545,6 +7545,9 @@ Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
 GNU/Linux.  Process record and replay can be used both when native
 debugging, and when remote debugging via @code{gdbserver}.
 
+When recording an inferior, @value{GDBN} may print auxiliary information
+during stepping commands and commands displaying the execution history.
+
 For architecture environments that support process record and replay,
 @value{GDBN} provides the following commands:
 
-- 
2.34.3

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  parent reply	other threads:[~2022-10-21 12:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 11:59 [PATCH v7 00/10] Extensions for PTWRITE Felix Willgerodt
2022-10-21 11:59 ` Felix Willgerodt
2022-10-21 11:59 ` Felix Willgerodt [this message]
2022-10-21 11:59   ` [PATCH v7 01/10] btrace: Introduce auxiliary instructions Felix Willgerodt
2022-10-21 13:19   ` Eli Zaretskii
2022-10-21 11:59 ` [PATCH v7 02/10] btrace: Enable auxiliary instructions in record instruction-history Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 03/10] btrace: Enable auxiliary instructions in record function-call-history Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 04/10] btrace: Handle stepping and goto for auxiliary instructions Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 05/10] python: Introduce gdb.RecordAuxiliary class Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 06/10] python: Add clear() to gdb.Record Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 07/10] btrace, gdbserver: Add ptwrite to btrace_config_pt Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 08/10] btrace, linux: Enable ptwrite packets Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-10-21 11:59 ` [PATCH v7 09/10] btrace, python: Enable ptwrite filter registration Felix Willgerodt
2022-10-21 11:59   ` Felix Willgerodt
2022-11-09 13:16 ` [PING] [PATCH v7 00/10] Extensions for PTWRITE Willgerodt, Felix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221021115947.359223-2-felix.willgerodt@intel.com \
    --to=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).