public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Willgerodt, Felix" <felix.willgerodt@intel.com>
To: "Metzger, Markus T" <markus.t.metzger@intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 05/10] python: Introduce gdb.RecordAuxiliary class.
Date: Mon, 14 Jun 2021 14:53:05 +0000	[thread overview]
Message-ID: <b3820730b70e41dca4b430605310c546@intel.com> (raw)
In-Reply-To: <A78C989F6D9628469189715575E55B236B43FCFF@IRSMSX104.ger.corp.intel.com>

On 6/4/19 2:35 PM, Metzger, Markus T wrote:
> Hello Felix,
>
>> Auxiliary instructions are no real instructions and get their own object
>> class, similar to gaps. gdb.Record.instruction_history is now possibly a
>> list of gdb.RecordInstruction, gdb.RecordGap or gdb.RecordAuxiliary
>> objects.
>>
>> This patch is in preparation for the new ptwrite feature, which is based on
>> auxiliary instructions.
>>
>> 2019-05-29  Felix Willgerodt  <felix.willgerodt@intel.com>
>>
>> gdb/ChangeLog:
>> * py-record-btrace.c (btpy_insn_or_gap_new): Removed.
>> (btpy_item_new): New function.
>> (btpy_list_item): Call btpy_item_new instead of recpy_insn_new.
>> (recpy_bt_replay_position): Call btpy_item_new instead of
>> btpy_insn_or_gap_new.
>> (recpy_bt_begin): Call btpy_item_new instead of btpy_insn_or_gap_new.
>> (recpy_bt_end): Call btpy_item_new instead of btpy_insn_or_gap_new.
>> * py-record.c (recpy_aux_type): New static object.
>> (recpy_aux_object): New typedef.
>> (recpy_aux_new, recpy_aux_number, recpy_aux_data): New function.
>> (recpy_aux_getset): New static object.
>> (gdbpy_initialize_record): Initialize gdb.RecordAuxiliary type.
>>
>> gdb/doc/ChangeLog:
>> * python.texi (gdb.RecordAuxiliary): New documentation.
>>
>> ---
>>   gdb/doc/python.texi           | 13 +++++++
>>   gdb/python/py-record-btrace.c | 22 +++++++----
>>   gdb/python/py-record.c        | 73 ++++++++++++++++++++++++++++++++++-
>>   gdb/python/py-record.h        |  3 ++
>>   4 files changed, 103 insertions(+), 8 deletions(-)
>
> Looks good to me but I can't approve it.
>
>> @@ -172,6 +173,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);

Markus> This must be true because we checked btrace_insn_get_error () before.  To make it
Markus> more obvious, we could rewrite the function to call btrace_insn_get () first and check
Markus> the returned btrace_insn pointer.  There's no need to check the error code, I think.
Markus> In the worst case, we'll end up with a gap that says 'success'.

You are right, removed it.

>> @@ -470,7 +479,7 @@ btpy_list_item (PyObject *self, Py_ssize_t index)
>>     number = obj->first + (obj->step * index);
>>
>>     if (obj->element_type == &recpy_insn_type)
>> -    return recpy_insn_new (obj->thread, RECORD_METHOD_BTRACE, number);
>> +    return btpy_item_new (obj->thread, number);
>>     else
>>       return recpy_func_new (obj->thread, RECORD_METHOD_BTRACE, number);
>>   }

Markus> Isn't this code just creating list item objects?

Yes, but when creating the list we now don't want to add RecordAuxiliary
objects as RecordInstruction objects. The only list objects created are of type
recpy_insn_type or recpy_func_type.


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

  reply	other threads:[~2021-06-14 14:53 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  8:48 [PATCH 00/10] Extensions for PTWRITE felix.willgerodt
2019-05-29  8:48 ` [PATCH 06/10] python: Add clear_trace() to gdb.Record felix.willgerodt
2019-05-29 14:41   ` Eli Zaretskii
2019-06-04 12:36   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 07/10] btrace, linux: Enable ptwrite packets felix.willgerodt
2019-06-04 12:36   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 09/10] btrace, python: Enable calling the ptwrite listener felix.willgerodt
2019-06-04 12:37   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 03/10] btrace: Enable auxiliary instructions in record function-call-history felix.willgerodt
2019-05-29 14:40   ` Eli Zaretskii
2019-06-04 12:35   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2021-06-16  9:13       ` Metzger, Markus T
2021-06-16 10:03         ` Willgerodt, Felix
2021-06-16 10:16           ` Metzger, Markus T
2019-05-29  8:48 ` [PATCH 08/10] btrace, python: Enable ptwrite listener registration felix.willgerodt
2019-06-04 12:36   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 02/10] btrace: Enable auxiliary instructions in record instruction-history felix.willgerodt
2019-06-04 12:35   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 10/10] btrace: Extend event decoding for ptwrite felix.willgerodt
2019-05-29 14:53   ` Eli Zaretskii
2019-06-04 12:37   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 05/10] python: Introduce gdb.RecordAuxiliary class felix.willgerodt
2019-05-29 14:42   ` Eli Zaretskii
2019-06-04 12:36   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix [this message]
2019-05-29  8:48 ` [PATCH 04/10] btrace: Handle stepping and goto for auxiliary instructions felix.willgerodt
2019-06-04 12:35   ` Metzger, Markus T
2021-06-14 14:53     ` Willgerodt, Felix
2019-05-29  8:48 ` [PATCH 01/10] btrace: Introduce " felix.willgerodt
2019-05-29 14:39   ` Eli Zaretskii
2019-06-04 12:35   ` Metzger, Markus T

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=b3820730b70e41dca4b430605310c546@intel.com \
    --to=felix.willgerodt@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    /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).