btrace: Add support for interrupt events.

Newer Intel CPUs support recording asynchronous events in the PT trace.
Libipt also recently added support for decoding these.

This patch adds support for interrupt events, based on the existing aux
infrastructure.  GDB can now display such events during the record
instruction-history and function-call-history commands.

Subsequent patches will add the rest of the events currently supported.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
This commit is contained in:
Felix Willgerodt
2023-06-26 16:54:25 +02:00
parent 13b3a89bc2
commit cdd65168f3
8 changed files with 364 additions and 25 deletions

View File

@@ -810,7 +810,7 @@ recpy_bt_function_call_history (PyObject *self, void *closure)
/* Helper function that calls PTW_FILTER with PAYLOAD and IP as arguments.
Returns the string that will be printed, if there is a filter to call. */
static std::optional<std::string>
recpy_call_filter (const uint64_t payload, const uint64_t ip,
recpy_call_filter (const uint64_t payload, std::optional<uint64_t> ip,
const void *ptw_filter)
{
std::optional<std::string> result;
@@ -824,10 +824,10 @@ recpy_call_filter (const uint64_t payload, const uint64_t ip,
gdbpy_ref<> py_payload = gdb_py_object_from_ulongest (payload);
gdbpy_ref<> py_ip;
if (ip == 0)
if (!ip.has_value ())
py_ip = gdbpy_ref<>::new_reference (Py_None);
else
py_ip = gdb_py_object_from_ulongest (ip);
py_ip = gdb_py_object_from_ulongest (*ip);
gdbpy_ref<> py_result (PyObject_CallFunctionObjArgs ((PyObject *) ptw_filter,
py_payload.get (),