From: felix.willgerodt@intel.com
To: gdb-patches@sourceware.org
Cc: markus.t.metzger@intel.com,
Felix Willgerodt <felix.willgerodt@intel.com>
Subject: [PATCH 03/10] btrace: Enable auxiliary instructions in record function-call-history.
Date: Wed, 29 May 2019 08:48:00 -0000 [thread overview]
Message-ID: <1559119673-30516-4-git-send-email-felix.willgerodt@intel.com> (raw)
In-Reply-To: <1559119673-30516-1-git-send-email-felix.willgerodt@intel.com>
From: Felix Willgerodt <felix.willgerodt@intel.com>
Print the auxiliary data when a btrace_insn of type BTRACE_INSN_AUX
is encountered in the function-call-history. Printing is
active by default, it can be silenced with the /s modifier.
This patch is in preparation for the ptwrite feature, which is based on
auxiliary instructions.
2019-05-29 Felix Willgerodt <felix.willgerodt@intel.com>
gdb/ChangeLog:
* btrace.h (btrace_function_flag): Add BFUN_AUX_DECODED.
* record-btrace.c (btrace_print_aux_insn): New function.
(btrace_call_history): Handle BTRACE_INSN_AUX.
* record.c: (get_call_history_modifiers): Add /s modifier.
* record.h (record_print_flag): New value RECORD_DONT_PRINT_AUX.
gdb/doc/ChangeLog:
* gdb.texinfo (record function-call-history): Document /s modifier.
---
gdb/btrace.h | 6 +++++-
gdb/doc/gdb.texinfo | 5 +++--
gdb/record-btrace.c | 21 +++++++++++++++++++++
gdb/record.c | 5 +++++
gdb/record.h | 5 ++++-
5 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/gdb/btrace.h b/gdb/btrace.h
index 2a0e8664bf8..d29a1633ecf 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -104,7 +104,11 @@ enum btrace_function_flag
/* The 'up' link points to a tail call. This obviously only makes sense
if bfun_up_links_to_ret is clear. */
- BFUN_UP_LINKS_TO_TAILCALL = (1 << 1)
+ BFUN_UP_LINKS_TO_TAILCALL = (1 << 1),
+
+ /* Indicates that at least one auxiliary instruction is in the current
+ function segment. */
+ BFUN_AUX_DECODED = (1 << 2)
};
DEF_ENUM_FLAGS_TYPE (enum btrace_function_flag, btrace_function_flags);
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c31ed39b251..20056e33a88 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7300,8 +7300,9 @@ for this instruction sequence (if the @code{/l} modifier is
specified), and the instructions numbers that form the sequence (if
the @code{/i} modifier is specified). The function names are indented
to reflect the call stack depth if the @code{/c} modifier is
-specified. The @code{/l}, @code{/i}, and @code{/c} modifiers can be
-given together.
+specified. Printing auxiliary information is enabled by default and can be
+omitted with the @code{/s} modifier. The @code{/l}, @code{/i}, @code{/s} and
+@code{/c} modifiers can be given together.
@smallexample
(@value{GDBP}) @b{list 1, 10}
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 5fb967c40f0..5f70c4838a9 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1139,6 +1139,23 @@ btrace_get_bfun_name (const struct btrace_function *bfun)
return "??";
}
+static void
+btrace_print_aux_insn (struct ui_out *uiout,
+ const struct btrace_function *bfun,
+ const struct btrace_thread_info *btinfo)
+{
+ for (const auto &i : bfun->insn)
+ {
+ if (i.iclass == BTRACE_INSN_AUX)
+ {
+ uiout->text ("\t\t[");
+ uiout->field_fmt ("aux-insn", "%s",
+ btinfo->aux_data[i.aux_data_index].c_str ());
+ uiout->text ("]\n");
+ }
+ }
+}
+
/* Disassemble a section of the recorded function trace. */
static void
@@ -1214,6 +1231,10 @@ btrace_call_history (struct ui_out *uiout,
}
uiout->text ("\n");
+
+ if (((flags & RECORD_DONT_PRINT_AUX) == 0)
+ && ((bfun->flags & BFUN_AUX_DECODED) != 0))
+ btrace_print_aux_insn(uiout, bfun, btinfo);
}
}
diff --git a/gdb/record.c b/gdb/record.c
index 828c19968a3..de02ca60513 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -650,6 +650,9 @@ get_call_history_modifiers (const char **arg)
case 'c':
modifiers |= RECORD_PRINT_INDENT_CALLS;
break;
+ case 's':
+ modifiers |= RECORD_DONT_PRINT_AUX;
+ break;
default:
error (_("Invalid modifier: %c."), *args);
}
@@ -880,6 +883,8 @@ Without modifiers, it prints the function name.\n\
With a /l modifier, the source file and line number range is included.\n\
With a /i modifier, the instruction number range is included.\n\
With a /c modifier, the output is indented based on the call stack depth.\n\
+With a /s modifier, omits output of auxiliary data, which is enabled \
+by default.\n\
With no argument, prints ten more lines after the previous ten-line print.\n\
\"record function-call-history -\" prints ten lines before a previous ten-line \
print.\n\
diff --git a/gdb/record.h b/gdb/record.h
index 03f96e8ab78..7c4449480a3 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -61,7 +61,10 @@ enum record_print_flag
RECORD_PRINT_INSN_RANGE = (1 << 1),
/* Indent based on call stack depth (if applicable). */
- RECORD_PRINT_INDENT_CALLS = (1 << 2)
+ RECORD_PRINT_INDENT_CALLS = (1 << 2),
+
+ /* Deactivate printing auxiliary data (if applicable). */
+ RECORD_DONT_PRINT_AUX = (1 << 3)
};
DEF_ENUM_FLAGS_TYPE (enum record_print_flag, record_print_flags);
--
2.20.1
next prev parent reply other threads:[~2019-05-29 8:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 8:48 [PATCH 00/10] Extensions for PTWRITE felix.willgerodt
2019-05-29 8:48 ` [PATCH 06/10] python: Add clear_trace() to gdb.Record felix.willgerodt
2019-05-29 14:41 ` Eli Zaretskii
2019-06-04 12:36 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 07/10] btrace, linux: Enable ptwrite packets felix.willgerodt
2019-06-04 12:36 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 08/10] btrace, python: Enable ptwrite listener registration felix.willgerodt
2019-06-04 12:36 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 09/10] btrace, python: Enable calling the ptwrite listener felix.willgerodt
2019-06-04 12:37 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` felix.willgerodt [this message]
2019-05-29 14:40 ` [PATCH 03/10] btrace: Enable auxiliary instructions in record function-call-history Eli Zaretskii
2019-06-04 12:35 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2021-06-16 9:13 ` Metzger, Markus T
2021-06-16 10:03 ` Willgerodt, Felix
2021-06-16 10:16 ` Metzger, Markus T
2019-05-29 8:48 ` [PATCH 02/10] btrace: Enable auxiliary instructions in record instruction-history felix.willgerodt
2019-06-04 12:35 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 05/10] python: Introduce gdb.RecordAuxiliary class felix.willgerodt
2019-05-29 14:42 ` Eli Zaretskii
2019-06-04 12:36 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 10/10] btrace: Extend event decoding for ptwrite felix.willgerodt
2019-05-29 14:53 ` Eli Zaretskii
2019-06-04 12:37 ` Metzger, Markus T
2021-06-14 14:53 ` Willgerodt, Felix
2019-05-29 8:48 ` [PATCH 01/10] btrace: Introduce auxiliary instructions felix.willgerodt
2019-05-29 14:39 ` Eli Zaretskii
2019-06-04 12:35 ` Metzger, Markus T
2019-05-29 8:48 ` [PATCH 04/10] btrace: Handle stepping and goto for " felix.willgerodt
2019-06-04 12:35 ` Metzger, Markus T
2021-06-14 14:53 ` 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=1559119673-30516-4-git-send-email-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).