public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Felix Willgerodt <felix.willgerodt@intel.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v8 05/10] python: Introduce gdb.RecordAuxiliary class.
Date: Fri, 24 Mar 2023 10:27:38 -0400	[thread overview]
Message-ID: <eb1ee9ae-bc2b-b190-766c-da5218fb814f@simark.ca> (raw)
In-Reply-To: <20230321154626.448816-6-felix.willgerodt@intel.com>

On 3/21/23 11:46, Felix Willgerodt via Gdb-patches wrote:
> @@ -163,6 +165,14 @@ btpy_insn_or_gap_new (thread_info *tinfo, Py_ssize_t number)
>        return recpy_gap_new (err_code, err_string, number);
>      }
>  
> +  const struct btrace_insn *insn = btrace_insn_get (&iter);
> +  gdb_assert (insn != nullptr);
> +
> +  if (insn->iclass == BTRACE_INSN_AUX)
> +    return recpy_aux_new
> +      (iter.btinfo->aux_data.at (insn->aux_data_index).c_str (), number);

Not really important, but recpy_aux_new could take a
`const std::string &`, it would simplify callers a bit.

> +
> +

Remove one newline.

> +/* Implementation of Auxiliary.data [str].  */
> +
> +static PyObject *
> +recpy_aux_data (PyObject *self, void *closure)
> +{
> +  const recpy_aux_object * const obj = (const recpy_aux_object *) self;
> +
> +  return PyUnicode_FromString (obj->data);
> +}

Nothing new with this patch, since this is the same pattern used for
other object, but just wondering: obj->data seems to be borrowed from
the btrace backend.  Are there some lifetime issues if you do:

1. Create a gdb.RecordAuxiliary object "b"
2. Issue a gdb command to clear the btrace data
3. Access "b.data"

?  It seems to me like obj->data might point to freed data.

Simon

  reply	other threads:[~2023-03-24 14:27 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 15:46 [PATCH v8 00/10] Extensions for PTWRITE Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 01/10] btrace: Introduce auxiliary instructions Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 02/10] btrace: Enable auxiliary instructions in record instruction-history Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 03/10] btrace: Enable auxiliary instructions in record function-call-history Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 04/10] btrace: Handle stepping and goto for auxiliary instructions Felix Willgerodt
2023-03-24 14:09   ` Simon Marchi
2023-03-31 10:58     ` Willgerodt, Felix
2023-03-21 15:46 ` [PATCH v8 05/10] python: Introduce gdb.RecordAuxiliary class Felix Willgerodt
2023-03-24 14:27   ` Simon Marchi [this message]
2023-03-31 10:58     ` Willgerodt, Felix
2023-04-03 19:06       ` Simon Marchi
2023-04-04  6:57         ` Metzger, Markus T
2023-04-04 14:17           ` Simon Marchi
2023-04-04 14:26             ` Willgerodt, Felix
2023-03-21 15:46 ` [PATCH v8 06/10] python: Add clear() to gdb.Record Felix Willgerodt
2023-03-24 14:36   ` Simon Marchi
2023-03-31 10:58     ` Willgerodt, Felix
2023-03-21 15:46 ` [PATCH v8 07/10] btrace, gdbserver: Add ptwrite to btrace_config_pt Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 08/10] btrace, linux: Enable ptwrite packets Felix Willgerodt
2023-03-21 15:46 ` [PATCH v8 09/10] btrace, python: Enable ptwrite filter registration Felix Willgerodt
2023-03-24 15:23   ` Simon Marchi
2023-03-31 10:58     ` Willgerodt, Felix
2023-04-03 20:44       ` Simon Marchi
2023-04-04 14:42         ` Willgerodt, Felix
2023-04-04 15:06           ` Simon Marchi
2023-04-05 10:20             ` Willgerodt, Felix
2023-04-05 20:27               ` Simon Marchi
2023-04-06  9:44                 ` Willgerodt, Felix
2023-03-21 15:46 ` [PATCH v8 10/10] btrace: Extend ptwrite event decoding Felix Willgerodt
2023-03-24 15:40   ` Simon Marchi
2023-03-31 10:58     ` Willgerodt, Felix
2023-04-04 14:23       ` Simon Marchi
2023-03-24 13:56 ` [PATCH v8 00/10] Extensions for PTWRITE Simon Marchi
2023-03-24 18:23   ` Tom Tromey
2023-03-24 18:28     ` Simon Marchi
2023-03-24 22:29       ` Tom Tromey
2023-03-31 10:57   ` Willgerodt, Felix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb1ee9ae-bc2b-b190-766c-da5218fb814f@simark.ca \
    --to=simark@simark.ca \
    --cc=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).