From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by sourceware.org (Postfix) with ESMTPS id 4296C393A404 for ; Wed, 16 Jun 2021 07:46:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4296C393A404 IronPort-SDR: eBXHRt322PmB1HKgawaGfNRoPBAlnnUQJRKmk2sW1/zmDL/ckti4Q49XvKbax6CSjYhGFMLqtb AmsP8s0eQksg== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="206090729" X-IronPort-AV: E=Sophos;i="5.83,277,1616482800"; d="scan'208";a="206090729" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 00:46:06 -0700 IronPort-SDR: tsT8UN1APohsYs3yxCkZ5TkabVuicEry+rZF77BAH0OpbR7nZ66OEwn5iIVNbZD3Z9vUhySJTD ykPKhRNrl8vA== X-IronPort-AV: E=Sophos;i="5.83,277,1616482800"; d="scan'208";a="404221083" Received: from mulvlfelix.iul.intel.com (HELO localhost) ([172.28.48.31]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 00:46:05 -0700 From: Felix Willgerodt To: markus.t.metzger@intel.com, gdb-patches@sourceware.org Subject: [PATCH v3 01/12] btrace: Introduce auxiliary instructions. Date: Wed, 16 Jun 2021 09:41:54 +0200 Message-Id: <20210616074205.1129553-2-felix.willgerodt@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210616074205.1129553-1-felix.willgerodt@intel.com> References: <20210616074205.1129553-1-felix.willgerodt@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2021 07:46:09 -0000 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/ChangeLog: 2021-06-14 Felix Willgerodt * btrace.c (btrace_clear_history): Clear aux_data. * btrace.h (btrace_insn_class): Add BTRACE_INSN_AUX. (btrace_insn): New union. (btrace_thread_info): New member aux_data. gdb/doc/ChangeLog: 2021-06-14 Felix Willgerodt * gdb.texinfo (Process Record and Replay): Document printing of auxiliary information. --- gdb/btrace.c | 2 ++ gdb/btrace.h | 24 +++++++++++++++++++++--- gdb/doc/gdb.texinfo | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index 5e689c11d4b..9f117a5e90d 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1811,6 +1811,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 8f6ce32103d..670c182505d 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 functions; + /* Optional auxiliary data that is printed in all commands displaying or + stepping through the execution history. */ + std::vector 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 d09b86cda95..ff4f41941d3 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -7467,6 +7467,10 @@ 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 additional 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.25.4 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, 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