[PATCH v2 4/6] btrace: Add support for interrupt events.

Metzger, Markus T markus.t.metzger@intel.com
Tue Sep 24 09:26:27 GMT 2024


Hello Felix,

> #if defined (HAVE_STRUCT_PT_EVENT_VARIANT_PTWRITE)
> 	case ptev_ptwrite:
> 	  {
>-	    uint64_t pc = 0;
> 	    std::optional<std::string> ptw_string;
>
> 	    /* Lookup the PC if available.  The event often doesn't provide
>@@ -1314,13 +1381,16 @@ handle_pt_insn_events (struct
>btrace_thread_info *btinfo,
> 		  }
> 	      }
>
>-	    if (pc == 0)
>-	      warning (_("Failed to determine the PC for ptwrite."));
>+	    if (!pc.has_value ())
>+	      {
>+		warning (_("Failed to determine the PC for ptwrite."));
>+		pc = 0;
>+	      }

Why do we assign to pc?


> 	    if (btinfo->ptw_callback_fun != nullptr)
> 	      ptw_string
> 		= btinfo->ptw_callback_fun (event.variant.ptwrite.payload,
>-					    pc, btinfo->ptw_context);
>+					    *pc, btinfo->ptw_context);

We need to pass 0 here, if pc is not available, but later (not shown here), we
call handle_pt_aux_insn(), which calls ftrace_update_function().


>Please let me know if this is ok. I can also send a v3.

This looks good with the above fixed.

Thanks,
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