aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Willgerodt <felix.willgerodt@intel.com>2019-02-18 13:49:25 +0100
committerFelix Willgerodt <felix.willgerodt@intel.com>2024-08-14 11:20:55 +0200
commitd894edfcc40e63be9b6efa0950c1752f249f16e5 (patch)
tree9a04a58948e8b06b216e77a18359d82d688d49ba
parenta4c88987f0795d9fd0a2bafc3d5ee1484b5d168b (diff)
downloadbinutils-d894edfcc40e63be9b6efa0950c1752f249f16e5.zip
binutils-d894edfcc40e63be9b6efa0950c1752f249f16e5.tar.gz
binutils-d894edfcc40e63be9b6efa0950c1752f249f16e5.tar.bz2
btrace: Introduce auxiliary instructions.
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. Approved-By: Markus Metzger <markus.t.metzger@intel.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
-rw-r--r--gdb/btrace.c2
-rw-r--r--gdb/btrace.h24
-rw-r--r--gdb/doc/gdb.texinfo3
3 files changed, 26 insertions, 3 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 5544c62..da219da 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1819,6 +1819,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 f05ec2b..0086759 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 9998785..9bbaffe 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7784,6 +7784,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: