[PATCH v2 4/6] btrace: Add support for interrupt events.
Metzger, Markus T
markus.t.metzger@intel.com
Tue Sep 24 12:10:48 GMT 2024
Hello Felix,
>On second thought, the ptwrite changes aren't actually that big. I wrongly
>thought I would need to touch the extension interface.
>This is the diff based on the previous diff I posted:
>
>diff --git a/gdb/btrace.c b/gdb/btrace.c
>index 2665547d8d4..152f6f2ec47 100644
>--- a/gdb/btrace.c
>+++ b/gdb/btrace.c
>@@ -1382,15 +1382,13 @@ handle_pt_insn_events (struct
>btrace_thread_info *btinfo,
> }
>
> if (!pc.has_value ())
>- {
>- warning (_("Failed to determine the PC for ptwrite."));
>- pc = 0;
>- }
>+ warning (_("Failed to determine the PC for ptwrite."));
>+
>
> if (btinfo->ptw_callback_fun != nullptr)
> ptw_string
> = btinfo->ptw_callback_fun (event.variant.ptwrite.payload,
>- *pc, btinfo->ptw_context);
>+ pc, btinfo->ptw_context);
>
> if (ptw_string.has_value () && (*ptw_string).empty ())
> continue;
>diff --git a/gdb/btrace.h b/gdb/btrace.h
>index 3d8aee767c3..a4960f31063 100644
>--- a/gdb/btrace.h
>+++ b/gdb/btrace.h
>@@ -360,7 +360,7 @@ struct btrace_thread_info
> /* Function pointer to the ptwrite callback. Returns the string returned
> by the ptwrite filter function. */
> std::optional<std::string> (*ptw_callback_fun) (const uint64_t payload,
>- const uint64_t ip,
>+ std::optional<uint64_t> ip,
> const void *ptw_context)
> = nullptr;
>
>diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
>index 55ee67efd81..ded1be93cd8 100644
>--- a/gdb/python/py-record-btrace.c
>+++ b/gdb/python/py-record-btrace.c
>@@ -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 (),
LGTM,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list