[PATCH v5 05/10] python: Introduce gdb.RecordAuxiliary class.

Willgerodt, Felix felix.willgerodt@intel.com
Mon Jul 11 12:48:40 GMT 2022


> -----Original Message-----
> From: Metzger, Markus T <markus.t.metzger@intel.com>
> Sent: Dienstag, 28. Juni 2022 11:11
> To: Willgerodt, Felix <felix.willgerodt@intel.com>; gdb-
> patches@sourceware.org
> Subject: RE: [PATCH v5 05/10] python: Introduce gdb.RecordAuxiliary class.
> 
> Hello Felix,
> 
> >+  if (insn->iclass == BTRACE_INSN_AUX)
> >+    return recpy_aux_new (
> >+	iter.btinfo->aux_data.at (insn->aux_data_index).c_str (), number);
> 
> The formatting looks off.  It should be broken at the 2nd argument.
> 

It can't be broken there as it would be 83 characters long. I moved the "("
to the line below.

> >@@ -64,6 +70,18 @@ struct recpy_gap_object
> >   Py_ssize_t number;
> > };
> >
> >+/* Python RecordAuxiliary object.  */
> >+typedef struct
> >+{
> >+  PyObject_HEAD
> >+
> >+  /* Auxiliary data.  */
> >+  const char *data;
> 
> Should this be a std::string instead of referencing the C string in the
> AUX_DATA?

I don't think this can be a std::string. recpy_aux_object needs to be
passed to the python C-API to create a new PyObject.
I tried it and GDB segfaults when trying to assign anything to data.

Regards,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, 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