@@ -71,6 +71,10 @@ maintenance info source-tracking-context BPNUM
Displays the captured source context that GDB uses to track and
adjust a breakpoint when source changes.
+set record btrace pt return-compression on|off
+show record btrace pt return-compression
+ Enable or disable Intel Processor Trace return compression (default: on).
+
* Changed commands
set stop-on-solib-events on|off
@@ -83,6 +87,11 @@ info locals
The new "-shadowed on|off" option overrides the "set print shadowed"
setting for a single invocation of the command.
+* New remote packets
+
+Qbtrace-conf:pt:return-compression
+ Configure Intel Processor Trace return-compression settings.
+
*** Changes in GDB 18
* Support for the Common Trace Format (CTF) has been removed. GDB now
@@ -8422,6 +8422,17 @@ effect on an active recording. The default is off.
@item show record btrace pt event-tracing
Show the current setting of Intel Processor Trace event tracing.
+@item set record btrace pt return-compression on|off
+Enable or disable Intel Processor Trace return compression. This is a
+hardware compression technique that represents a return to the natural
+return address of a preceding call instruction with a single bit. The
+trace decoder maintains a stack of active calls and can determine the
+return address of such a compressed return. This reduces tracing
+overhead and trace size. The default is on.
+
+@item show record btrace pt return-compression
+Show the current setting of Intel Processor Trace return compression.
+
@kindex info record
@item info record
Show various statistics about the recording depending on the recording
@@ -45843,6 +45854,11 @@ These are the currently defined stub features and their properties:
@tab @samp{-}
@tab Yes
+@item @samp{Qbtrace-conf:pt:return-compression}
+@tab Yes
+@tab @samp{-}
+@tab Yes
+
@item @samp{QNonStop}
@tab No
@tab @samp{-}
@@ -46185,6 +46201,10 @@ The remote stub understands the @samp{Qbtrace-conf:pt:ptwrite} packet.
@item Qbtrace-conf:pt:event-tracing
The remote stub understands the @samp{Qbtrace-conf:pt:event-tracing} packet.
+@item Qbtrace-conf:pt:return-compression
+The remote stub understands the @samp{Qbtrace-conf:pt:return-compression}
+packet.
+
@item swbreak
The remote stub reports the @samp{swbreak} stop reason for memory
breakpoints.
@@ -46754,6 +46774,17 @@ The event-tracing config parameter has been set.
A badly formed request or an error was encountered.
@end table
+@item Qbtrace-conf:pt:return-compression=@var{(yes|no)}
+Configure Intel Processor Trace return-compression.
+
+Reply:
+@table @samp
+@item OK
+The return-compression config parameter has been set.
+@item E.errtext
+A badly formed request or an error was encountered.
+@end table
+
@end table
@node Architecture-Specific Protocol Details
@@ -49422,6 +49453,7 @@ The formal DTD for the branch trace configuration format is given below:
<!ATTLIST pt size CDATA #IMPLIED>
<!ATTLIST pt ptwrite (yes | no) #IMPLIED>
<!ATTLIST pt event-tracing (yes | no) #IMPLIED>
+<!ATTLIST pt return-compression (yes | no) #IMPLIED>
@end smallexample
@include agentexpr.texi
@@ -14,3 +14,4 @@
<!ATTLIST pt size CDATA #IMPLIED>
<!ATTLIST pt ptwrite (yes | no) #IMPLIED>
<!ATTLIST pt event-tracing (yes | no) #IMPLIED>
+<!ATTLIST pt return-compression (yes | no) #IMPLIED>
@@ -697,6 +697,10 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
error (_("Event tracing for record btrace pt is not supported."));
}
+ tinfo->conf.pt.return_compression = conf->return_compression;
+ if (!tinfo->conf.pt.return_compression)
+ tinfo->attr.config |= linux_read_pt_config_bitmask ("noretcomp");
+
errno = 0;
scoped_fd fd (syscall (SYS_perf_event_open, &tinfo->attr, pid, -1, -1, 0));
if (fd.get () < 0)
@@ -3146,6 +3146,27 @@ set_record_pt_event_tracing_value (const char *args, int from_tty,
#endif /* defined (LIBIPT_VERSION >= 0x201) */
}
+static bool return_compression = true;
+
+/* The "record pt return-compression show value function. */
+
+static void
+show_record_pt_return_compression_value (ui_file *file, int from_tty,
+ cmd_list_element *c,
+ const char *value)
+{
+ gdb_printf (file, _("record pt return-compression is %s.\n"), value);
+}
+
+/* The "record pt return-compression" set value function. */
+
+static void
+set_record_pt_return_compression_value (const char *args, int from_tty,
+ cmd_list_element *c)
+{
+ record_btrace_conf.pt.return_compression = return_compression;
+}
+
/* Initialize btrace commands. */
INIT_GDB_FILE (record_btrace)
@@ -3276,6 +3297,20 @@ effect on an active recording."),
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist);
+ add_setshow_boolean_cmd ("return-compression", no_class,
+ &return_compression,
+ _("Set return-compression for record pt."),
+ _("Show return-compression for record pt."),
+ _("\
+Use \"on\" to enable Intel Processor Trace return compression and \"off\" to\n\
+disable it.\n\
+Without an argument, return-compression is enabled. Changing this setting\n\
+has no effect on an active recording. The default is \"on\"."),
+ set_record_pt_return_compression_value,
+ show_record_pt_return_compression_value,
+ &set_record_btrace_pt_cmdlist,
+ &show_record_btrace_pt_cmdlist);
+
add_target (record_btrace_target_info, record_btrace_target_open);
record_btrace_conf.bts.size = 64 * 1024;
@@ -3286,4 +3321,5 @@ effect on an active recording."),
record_btrace_conf.pt.ptwrite = false;
#endif
record_btrace_conf.pt.event_tracing = false;
+ record_btrace_conf.pt.return_compression = return_compression;
}
@@ -373,6 +373,9 @@ enum {
/* Support for the Qbtrace-conf:pt:event-tracing packet. */
PACKET_Qbtrace_conf_pt_event_tracing,
+ /* Support for the Qbtrace-conf:pt:return-compression packet. */
+ PACKET_Qbtrace_conf_pt_return_compression,
+
/* Support for exec events. */
PACKET_exec_event_feature,
@@ -6181,6 +6184,8 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_Qbtrace_conf_pt_ptwrite },
{ "Qbtrace-conf:pt:event-tracing", PACKET_DISABLE, remote_supported_packet,
PACKET_Qbtrace_conf_pt_event_tracing },
+ { "Qbtrace-conf:pt:return-compression", PACKET_DISABLE,
+ remote_supported_packet, PACKET_Qbtrace_conf_pt_return_compression },
{ "vContSupported", PACKET_DISABLE, remote_supported_packet, PACKET_vContSupported },
{ "QThreadEvents", PACKET_DISABLE, remote_supported_packet, PACKET_QThreadEvents },
{ "QThreadOptions", PACKET_DISABLE, remote_supported_thread_options,
@@ -15359,8 +15364,8 @@ parse_xml_btrace_conf_pt (struct gdb_xml_parser *parser,
void *user_data,
std::vector<gdb_xml_value> &attributes)
{
- struct btrace_config *conf;
- struct gdb_xml_value *size, *ptwrite, *event_tracing;
+ btrace_config *conf;
+ gdb_xml_value *size, *ptwrite, *event_tracing, *return_compression;
conf = (struct btrace_config *) user_data;
conf->format = BTRACE_FORMAT_PT;
@@ -15377,6 +15382,11 @@ parse_xml_btrace_conf_pt (struct gdb_xml_parser *parser,
event_tracing = xml_find_attribute (attributes, "event-tracing");
if (event_tracing != nullptr)
conf->pt.event_tracing = (bool) *(ULONGEST *) event_tracing->value.get ();
+
+ return_compression = xml_find_attribute (attributes, "return-compression");
+ if (return_compression != nullptr)
+ conf->pt.return_compression
+ = (bool) *(ULONGEST *) return_compression->value.get ();
}
static const struct gdb_xml_attribute btrace_conf_pt_attributes[] = {
@@ -15385,6 +15395,8 @@ static const struct gdb_xml_attribute btrace_conf_pt_attributes[] = {
gdb_xml_enums_boolean },
{ "event-tracing", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_enum,
gdb_xml_enums_boolean },
+ { "return-compression", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_enum,
+ gdb_xml_enums_boolean },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
@@ -15551,6 +15563,44 @@ remote_target::btrace_sync_conf (const btrace_config *conf)
rs->btrace_config.pt.event_tracing = conf->pt.event_tracing;
}
+
+ /* Return compression is a user setting, which is enabled by default on
+ older targets. Warn if it is set but the target doesn't support
+ it. */
+ if ((m_features.packet_support (PACKET_Qbtrace_conf_pt_return_compression)
+ != PACKET_ENABLE)
+ && !conf->pt.return_compression)
+ warning (_("Target does not support disabling return-compression."));
+
+ if (m_features.packet_support (PACKET_Qbtrace_conf_pt_return_compression)
+ == PACKET_ENABLE)
+ {
+ pos = buf;
+ const char *return_compression
+ = conf->pt.return_compression ? "yes" : "no";
+ const char *name
+ = packets_descriptions[PACKET_Qbtrace_conf_pt_return_compression]
+ .name;
+ pos += xsnprintf (pos, endbuf - pos, "%s=\"%s\"", name,
+ return_compression);
+
+ putpkt (buf);
+ getpkt (&rs->buf, 0);
+
+ packet_result result
+ = m_features.packet_ok (buf,
+ PACKET_Qbtrace_conf_pt_return_compression);
+ if (result.status () == PACKET_ERROR)
+ {
+ if (buf[0] == 'E' && buf[1] == '.')
+ error (_("Failed to sync return-compression config: %s"),
+ buf + 2);
+ else
+ error (_("Failed to sync return-compression config."));
+ }
+
+ rs->btrace_config.pt.return_compression = conf->pt.return_compression;
+ }
}
/* Read TP's btrace configuration from the target and store it into CONF. */
@@ -17014,6 +17064,10 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
"Qbtrace-conf:pt:event-tracing",
"btrace-conf-pt-event-tracing", 0);
+ add_packet_config_cmd (PACKET_Qbtrace_conf_pt_return_compression,
+ "Qbtrace-conf:pt:return-compression",
+ "btrace-conf-pt-return-compression", 0);
+
add_packet_config_cmd (PACKET_vContSupported, "vContSupported",
"verbose-resume-supported", 0);
@@ -7025,6 +7025,8 @@ linux_process_target::read_btrace_conf (const btrace_target_info *tinfo,
conf->pt.ptwrite ? "yes" : "no");
string_xml_appendf (*buffer, " event-tracing=\"%s\"",
conf->pt.event_tracing ? "yes" : "no");
+ string_xml_appendf (*buffer, " return-compression=\"%s\"",
+ conf->pt.return_compression ? "yes" : "no");
string_xml_appendf (*buffer, "/>\n");
break;
}
@@ -568,6 +568,20 @@ handle_btrace_conf_general_set (char *own_buf)
return -1;
}
}
+ else if (strncmp (op, "pt:return-compression=",
+ strlen ("pt:return-compression=")) == 0)
+ {
+ op += strlen ("pt:return-compression=");
+ if (strncmp (op, "\"yes\"", strlen ("\"yes\"")) == 0)
+ current_btrace_conf.pt.return_compression = true;
+ else if (strncmp (op, "\"no\"", strlen ("\"no\"")) == 0)
+ current_btrace_conf.pt.return_compression = false;
+ else
+ {
+ strcpy (own_buf, "E.Bad return-compression value.");
+ return -1;
+ }
+ }
else
{
strcpy (own_buf, "E.Bad Qbtrace configuration option.");
@@ -2482,6 +2496,7 @@ supported_btrace_packets (char *buf)
strcat (buf, ";Qbtrace-conf:pt:size+");
strcat (buf, ";Qbtrace-conf:pt:ptwrite+");
strcat (buf, ";Qbtrace-conf:pt:event-tracing+");
+ strcat (buf, ";Qbtrace-conf:pt:return-compression+");
strcat (buf, ";Qbtrace:off+");
strcat (buf, ";qXfer:btrace:read+");
strcat (buf, ";qXfer:btrace-conf:read+");
@@ -126,6 +126,9 @@ struct btrace_config_pt
/* Event tracing setting. */
bool event_tracing;
+
+ /* Return compression setting. */
+ bool return_compression;
};
/* A branch tracing configuration.