From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by sourceware.org (Postfix) with ESMTPS id C27FE3858004 for ; Tue, 21 Mar 2023 15:46:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C27FE3858004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679413600; x=1710949600; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gJ0YQnGmDmtkxOQyM4EjQeXgqrjb2PoNnSEDswSLOq0=; b=VpjP2j1x8mgTk3eupwXofn0nWyCb0s51dPo3kn5hd9cvmb/TlZ3EglOT QHzRyIVj/E8LBPF7tFlByBm11t8xSrnQXHhkgsfZicqYxBnyK7NBUWuea N7V+BEgcUr2PsPPFTzJUtdKQSzq6jQO5vEJ6LJk5Dyf7Z3quAJm/1OxiA zYHuOdmkJ+8W8zw+eIoQRxq8s5jAR3G+RZOEytXrZbU4xU9Ki5YZCZQPs 77AoaHDG2xr1rG+9JzX0z61NcnZIX759RNOHAUfY2vR3/fMJQ774YYmrK wGEy73xW1qGczfNYk8QkSjwSUYTW+tPXRgSy7M45Mi9vsgE9dKV6I6Fy8 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="366709315" X-IronPort-AV: E=Sophos;i="5.98,279,1673942400"; d="scan'208";a="366709315" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 08:46:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="792149344" X-IronPort-AV: E=Sophos;i="5.98,279,1673942400"; d="scan'208";a="792149344" Received: from mulfelix.iul.intel.com (HELO localhost) ([172.28.49.163]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 08:46:39 -0700 From: Felix Willgerodt To: gdb-patches@sourceware.org Cc: Felix Willgerodt Subject: [PATCH v8 01/10] btrace: Introduce auxiliary instructions. Date: Tue, 21 Mar 2023 16:46:17 +0100 Message-Id: <20230321154626.448816-2-felix.willgerodt@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321154626.448816-1-felix.willgerodt@intel.com> References: <20230321154626.448816-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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 38d3882c154..b0afc1735f8 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 0ec84113217..dd80d3e6806 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 information 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 6c811b8be2e..d1690c07a99 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -7639,6 +7639,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.39.2 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