public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: "Willgerodt, Felix" <felix.willgerodt@intel.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v10 08/10] btrace, linux: Enable ptwrite packets.
Date: Wed, 6 Sep 2023 14:07:52 +0000	[thread overview]
Message-ID: <DM8PR11MB5749D56B95D5FA30BE057FC0DEEFA@DM8PR11MB5749.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN2PR11MB4566D12795913DB1A6FAA5858EE6A@MN2PR11MB4566.namprd11.prod.outlook.com>

Hello Felix,

>> >I looked at doing it when installing the extension language callback
>> >for ptwrite in btrace.c, e.g. something similar to this:
>> >
>> >  /* Register the ptwrite filter.  */
>> >  if (btinfo->target->conf.pt.ptwrite)
>> >	apply_ext_lang_ptwrite_filter (btinfo);
>> >  else
>> >    warning (_("Can't decode ptwrite events."));
>> >
>> >This we do regardless of libipt. But then we would get a warning
>> >regardless of the user trying to use ptwrite or not (with old libipt
>> >versions). Plus this doesn't compile, as struct btrace_target_info
>> >is forward declared, and we probably can't change that as btrace.c
>> >should be target independent.
>>
>> We'd want the check inside gdbpy_load_ptwrite_filter(), which gets
>> called by apply_ext_lang_ptwrite_filter() to install the btrace callback.
>
>If I add a similar warning to what I posted above for btrace.c, to
>python/py-record-btrace.c:gdbpy_load_ptwrite_filter(), I still can't
>compile. I get the following error:
>
>py-record-btrace.c:906:22: error: invalid use of incomplete type ?struct
>btrace_target_info?
>  906 |   if (!btinfo->target->conf.pt.ptwrite)
>
>The solution would be to include nat/linux-btrace.h to the file, or to move
>that struct to some other common header, e.g. btrace-common.h.
>I don't think either is possible, it is adding linux specific things to common files.
>Or is there any other solution that I missed?
>
>Another point is, even if I would put it there, gdbpy_load_ptwrite_filter()
>is called regardless of the user having installed a python filter.
>But I think we could additionally check that get_ptwrite_filter() didn't return
>Py_None to avoid that issue.

Yes, that's what I meant.  Warn if a ptwrite filter is installed but ptwrite is not
supported.

We cannot use btrace_target_info directly, so we'd need to add another function
to check whether ptwrite is supported/enabled on the target.

regards,
markus.
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:[~2023-09-06 14:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 11:56 [PATCH v10 00/10] Extensions for PTWRITE Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 01/10] btrace: Introduce auxiliary instructions Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 02/10] btrace: Enable auxiliary instructions in record instruction-history Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 03/10] btrace: Enable auxiliary instructions in record function-call-history Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 04/10] btrace: Handle stepping and goto for auxiliary instructions Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 05/10] python: Introduce gdb.RecordAuxiliary class Felix Willgerodt
2023-07-25 13:30   ` Metzger, Markus T
2023-08-07  9:08     ` Willgerodt, Felix
2023-08-08  9:37       ` Metzger, Markus T
2023-08-09  9:32         ` Willgerodt, Felix
2023-08-09 10:00           ` Metzger, Markus T
2023-08-30  8:39             ` Willgerodt, Felix
2023-07-18 11:56 ` [PATCH v10 06/10] python: Add clear() to gdb.Record Felix Willgerodt
2023-07-18 13:00   ` Eli Zaretskii
2023-07-18 11:56 ` [PATCH v10 07/10] btrace, gdbserver: Add ptwrite to btrace_config_pt Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 08/10] btrace, linux: Enable ptwrite packets Felix Willgerodt
2023-07-25 13:30   ` Metzger, Markus T
2023-08-07  9:10     ` Willgerodt, Felix
2023-08-08 10:13       ` Metzger, Markus T
2023-08-09  9:31         ` Willgerodt, Felix
2023-08-09  9:48           ` Metzger, Markus T
2023-08-30  8:42             ` Willgerodt, Felix
2023-09-06 14:07               ` Metzger, Markus T [this message]
2023-07-18 11:56 ` [PATCH v10 09/10] btrace, python: Enable ptwrite filter registration Felix Willgerodt
2023-07-18 11:56 ` [PATCH v10 10/10] btrace: Extend ptwrite event decoding Felix Willgerodt
2023-07-18 13:01   ` Eli Zaretskii

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=DM8PR11MB5749D56B95D5FA30BE057FC0DEEFA@DM8PR11MB5749.namprd11.prod.outlook.com \
    --to=markus.t.metzger@intel.com \
    --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).