Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Markus Metzger <markus.t.metzger@intel.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/5] btrace: support Intel(R) Processor Trace
Date: Tue, 30 Jun 2015 12:56:00 -0000	[thread overview]
Message-ID: <55929205.6080907@redhat.com> (raw)
In-Reply-To: <1435047418-21611-3-git-send-email-markus.t.metzger@intel.com>

On 06/23/2015 09:16 AM, Markus Metzger wrote:
> Adds a new command "record btrace pt" to configure the kernel to use
> Intel(R) Processor Trace instead of Branch Trace Strore.

This looks very good to me.  A few minor details to sort out,
and this is good to go.

> 
> The "record btrace" command chooses the tracing format automatically.
> 
> Intel Processor Trace support requires kernel 4.1 and libipt.

s/kernel/Linux/.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 3ec5851..9ab64bf 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -112,6 +112,10 @@ show mpx bound
>  set mpx bound on i386 and amd64
>     Support for bound table investigation on Intel(R) MPX enabled applications.
>  
> +record btrace pt
> +record pt
> +  Start branch trace recording using Intel(R) Processor Trace format.
> +
>  * New options
>  

The patch also includes new RSP packets.  Those should be mentioned
in NEWS as well.  I think the new configure switch should be mentioned
in a:

* New configure options

section too.

> +  decoder = pt_insn_alloc_decoder (&config);
> +  if (decoder == NULL)
> +    error (_("Failed to allocate the Intel(R) Processor Trace decoder."));
> +
> +  TRY
> +    {
> +      struct pt_image *image;
> +
> +      image = pt_insn_get_image(decoder);
> +      if (image == NULL)
> +	error (_("Failed to configure the Intel(R) Processor Trace decoder."));
> +
> +      errcode = pt_image_set_callback(image, btrace_pt_readmem_callback, NULL);
> +      if (errcode < 0)
> +	error (_("Failed to configure the Intel(R) Processor Trace decoder: "
> +		 "%s."), pt_errstr (pt_errcode (errcode)));
> +
> +      ftrace_add_pt (decoder, &btinfo->begin, &btinfo->end, &level,
> +		     &btinfo->ngaps);
> +    }
> +  CATCH (error, RETURN_MASK_ALL)
> +    {
> +      /* Indicate a gap in the trace if we quit trace processing.  Errors were
> +	 already logged before.  */

What does this "already logged before" mean?  AFAICS, the errors thrown
in the TRY branch are just swallowed here.  Did you mean to rethrow them?
Otherwise I'm not seeing the point in throwing them in the first place.

> +      if (error.reason == RETURN_QUIT && btinfo->end != NULL)
> +	{
> +	  btinfo->end = ftrace_new_gap (btinfo->end, BDE_PT_USER_QUIT);
> +	  btinfo->ngaps++;
> +	}
> +    }
> +  END_CATCH
> +



>    internal_error (__FILE__, __LINE__, _("Unkown branch trace format."));
> @@ -1056,7 +1312,7 @@ check_xml_btrace_version (struct gdb_xml_parser *parser,
>  {
>    const char *version = xml_find_attribute (attributes, "version")->value;
>  
> -  if (strcmp (version, "1.0") != 0)
> +  if (strcmp (version, "1.0") != 0 && strcmp (version, "2.0") != 0)

What fails if you send the new xml to an old/unpatched gdb, while keeping the
version at 1.0?  Is the new file really incompatible, or are you just
adding new elements/attributes?  There's usually no need to bump the
version in the latter case.  Old gdb will just ignore the
elements/attributes it doesn't recognize, and thus not support the feature.

> +/* The "set record btrace pt" command.  */
> +
> +static void
> +cmd_set_record_btrace_pt (char *args, int from_tty)
> +{
> +  printf_unfiltered (_("\"set record btrace pt\" must be followed "
> +		       "by an apporpriate subcommand.\n"));

typo: "apporpriate"

> +  help_list (set_record_btrace_pt_cmdlist, "set record btrace pt ",
> +	     all_commands, gdb_stdout);
> +}


> +  add_setshow_uinteger_cmd ("buffer-size", no_class,
> +			    &record_btrace_conf.pt.size,
> +			    _("Set the record/replay pt buffer size."),
> +			    _("Show the record/replay pt buffer size."), _("\
> +Bigger buffers allow longer recording but also take more time to process \
> +the recorded execution.\n\
> +The actual buffer size may differ from the requested size.  Use \"info record\" \
> +to see the actual buffer size."), NULL, NULL,
                                           ^^^^
Please add a "showfunc" hook for i18n.

Thanks,
Pedro Alves


  parent reply	other threads:[~2015-06-30 12:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23  8:22 [PATCH 0/5] Support " Markus Metzger
2015-06-23  8:22 ` [PATCH 3/5] btrace, linux: use data_size and data_offset Markus Metzger
2015-06-30 12:56   ` Pedro Alves
2015-06-23  8:22 ` [PATCH 5/5] btrace: maintenance commands Markus Metzger
2015-06-23 15:28   ` Eli Zaretskii
2015-06-24  7:05     ` Metzger, Markus T
2015-06-24 14:38       ` Eli Zaretskii
2015-06-30 12:57   ` Pedro Alves
2015-06-23  8:22 ` [PATCH 1/5] configure: check for libipt Markus Metzger
2015-06-30 12:56   ` Pedro Alves
2015-06-30 14:54     ` Metzger, Markus T
2015-06-30 15:01       ` Pedro Alves
2015-06-23  8:22 ` [PATCH 4/5] btrace: store raw btrace data Markus Metzger
2015-06-30 12:56   ` Pedro Alves
2015-06-23  8:23 ` [PATCH 2/5] btrace: support Intel(R) Processor Trace Markus Metzger
2015-06-23 15:32   ` Eli Zaretskii
2015-06-30 12:56   ` Pedro Alves [this message]
2015-06-30 14:54     ` Metzger, Markus T
2015-06-30 15:08       ` Pedro Alves
2015-07-01  8:39         ` 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=55929205.6080907@redhat.com \
    --to=palves@redhat.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