From patchwork Wed May 29 08:47:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Willgerodt, Felix" X-Patchwork-Id: 32882 Received: (qmail 10978 invoked by alias); 29 May 2019 08:48:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10867 invoked by uid 89); 29 May 2019 08:48:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*r:LOCAL, recording, history X-HELO: mga06.intel.com Received: from mga06.intel.com (HELO mga06.intel.com) (134.134.136.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 May 2019 08:48:13 +0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 01:48:12 -0700 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga005.fm.intel.com with ESMTP; 29 May 2019 01:48:11 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x4T8mAwL007649; Wed, 29 May 2019 09:48:10 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id x4T8mA24030770; Wed, 29 May 2019 10:48:10 +0200 Received: (from fwillger@localhost) by ulvlx001.iul.intel.com with LOCAL id x4T8mAn7030766; Wed, 29 May 2019 10:48:10 +0200 From: felix.willgerodt@intel.com To: gdb-patches@sourceware.org Cc: markus.t.metzger@intel.com, Felix Willgerodt Subject: [PATCH 01/10] btrace: Introduce auxiliary instructions. Date: Wed, 29 May 2019 10:47:44 +0200 Message-Id: <1559119673-30516-2-git-send-email-felix.willgerodt@intel.com> In-Reply-To: <1559119673-30516-1-git-send-email-felix.willgerodt@intel.com> References: <1559119673-30516-1-git-send-email-felix.willgerodt@intel.com> X-IsSubscribed: yes From: Felix Willgerodt 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 ptwrite feature, which is based on auxiliary instructions. 2019-05-29 Felix Willgerodt gdb/ChangeLog: * 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: * gdb.texinfo (Process Record and Replay): Document printing of auxiliary information. --- gdb/btrace.c | 2 ++ gdb/btrace.h | 25 +++++++++++++++++++++---- gdb/doc/gdb.texinfo | 3 +++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index c6d564e7062..d3e2f46c678 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1810,6 +1810,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 7b38b14ac01..2a0e8664bf8 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,9 +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; @@ -333,6 +346,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 3c4535ec506..c31ed39b251 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -6831,6 +6831,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, GDB 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: