Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: markus.t.metzger@intel.com
Cc: palves@redhat.com, tromey@redhat.com, kettenis@gnu.org,
	       gdb-patches@sourceware.org, markus.t.metzger@gmail.com
Subject: Re: [patch v6 08/12] gdbserver, btrace: add generic btrace support
Date: Mon, 17 Dec 2012 20:43:00 -0000	[thread overview]
Message-ID: <20121217200456.GH14232@host2.jankratochvil.net> (raw)
In-Reply-To: <1355760101-26237-9-git-send-email-markus.t.metzger@intel.com>

On Mon, 17 Dec 2012 17:01:37 +0100, markus.t.metzger@intel.com wrote:
[...]
> +/* Handle the "Qbtrace" packet.  */
> +
> +static int
> +handle_btrace_general_set (char *own_buf)
> +{
> +  struct thread_info *thread;
> +  const char *err;
> +  char *op;
> +
> +  if (strncmp ("Qbtrace:", own_buf, strlen ("Qbtrace:")) != 0)
> +    return 0;
> +
> +  op = own_buf + strlen ("Qbtrace:");
> +
> +  if (!target_supports_btrace ())
> +    {
> +      strcpy (own_buf, "E.Target does not support branch tracing.");
> +      return 1;
> +    }
> +
> +  if (ptid_equal (general_thread, null_ptid)
> +      || ptid_equal (general_thread, minus_one_ptid))
> +    {
> +      strcpy (own_buf, "E.Must select a single thread.");
> +      return -1;
> +    }
> +
> +  thread = find_thread_ptid (general_thread);
> +  if (thread == NULL)
> +    {
> +      strcpy (own_buf, "E.No such thread.");
> +      return -1;
> +    }
> +
> +  err = NULL;
> +
> +  if (strncmp ("on", op, strlen ("on")) == 0)

Here

> +    err = handle_btrace_enable (thread);
> +  else if (strncmp ("off", op, strlen ("off")) == 0)

and here should be just strcmp, otherwise it falsely matches for example
future keyword "official" or whatever.


> +    err = handle_btrace_disable (thread);
> +  else
> +    err = "E.Bad Qbtrace operation. Use on or off.";
> +
> +  if (err != 0)
> +    strcpy (own_buf, err);
> +  else
> +    write_ok (own_buf);
> +
> +  return 1;
> +}
> +
[...]
> +/* Handle the "qbtrace" packet.  */
> +
> +static int
> +handle_btrace_query (char *own_buf)
> +{
> +  if (strncmp ("qbtrace:", own_buf, strlen ("qbtrace:")) == 0)
> +    {
> +      char *ptid_str = own_buf + strlen ("qbtrace:");
> +      ptid_t ptid = read_ptid (ptid_str, NULL);
> +      struct thread_info *thread = find_thread_ptid (ptid);
> +
> +      if (thread == NULL)
> +          strcpy (own_buf, "E.No such thread.");

Incorrect indentation.

> +      else if (thread->btrace == NULL)
> +          strcpy (own_buf, "E.Btrace not enabled.");

Incorrect indentation.

> +      else
> +        strcpy (own_buf,
> +                (target_btrace_has_changed (thread->btrace) ? "yes" : "no"));

Use tabs, not spaces.  Also below and everywhere in this patch (or patchset?)


[...]
> --- a/gdb/gdbserver/target.h
> +++ b/gdb/gdbserver/target.h
[...]
> +#define target_supports_btrace()                                        \
> +  (the_target->supports_btrace ? (*the_target->supports_btrace) () : 0)
> +
> +#define target_enable_btrace(ptid)              \

Use tabs for the \ backslash indentation.

> +  (*the_target->enable_btrace) (ptid)
> +
> +#define target_disable_btrace(tinfo)            \
> +  (*the_target->disable_btrace) (tinfo)
> +
> +#define target_btrace_has_changed(tinfo)        \
> +  (*the_target->btrace_has_changed) (tinfo)
> +
> +#define target_read_btrace(tinfo, buffer)       \
> +  (*the_target->read_btrace) (tinfo, buffer)
> +
>  /* Start non-stop mode, returns 0 on success, -1 on failure.   */
>  
>  int start_non_stop (int nonstop);
> -- 
> 1.7.6.5


Thanks,
Jan


  reply	other threads:[~2012-12-17 20:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 16:02 [patch v6 00/12] branch tracing support for Atom markus.t.metzger
2012-12-17 16:02 ` [patch v6 08/12] gdbserver, btrace: add generic btrace support markus.t.metzger
2012-12-17 20:43   ` Jan Kratochvil [this message]
2012-12-17 16:02 ` [patch v6 01/12] thread, btrace: add generic branch trace support markus.t.metzger
2012-12-17 16:02 ` [patch v6 12/12] btrace, x86: disable on some processors markus.t.metzger
2012-12-17 17:11   ` Mark Kettenis
2012-12-19 16:13     ` Metzger, Markus T
2012-12-19 16:36       ` Mark Kettenis
2012-12-21 10:38       ` Jan Kratochvil
2012-12-17 17:37   ` H.J. Lu
2012-12-19 15:58     ` Metzger, Markus T
2012-12-17 20:35   ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 02/12] cli, btrace: add btrace cli markus.t.metzger
2012-12-17 18:32   ` Jan Kratochvil
2012-12-18  7:36     ` Metzger, Markus T
2012-12-18  8:35       ` Jan Kratochvil
2012-12-18  9:04   ` Jan Kratochvil
2012-12-18  9:11     ` Metzger, Markus T
2012-12-17 16:02 ` [patch v6 06/12] remote, btrace: add branch trace remote ops markus.t.metzger
2012-12-17 19:57   ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 09/12] gdbserver, linux, btrace: add btrace support for linux-low markus.t.metzger
2012-12-17 16:03 ` [patch v6 03/12] linux, btrace: perf_event based branch tracing markus.t.metzger
2012-12-17 16:03 ` [patch v6 07/12] btrace, doc: document remote serial protocol markus.t.metzger
2012-12-17 16:03 ` [patch v6 11/12] test, btrace: more branch tracing tests markus.t.metzger
2012-12-17 16:03 ` [patch v6 05/12] xml, btrace: define btrace xml document style markus.t.metzger
2012-12-17 19:53   ` Jan Kratochvil
2012-12-18  7:43     ` Metzger, Markus T
2012-12-17 16:03 ` [patch v6 04/12] linux, i386, amd64: enable btrace for 32bit and 64bit linux native markus.t.metzger
2012-12-17 16:03 ` [patch v6 10/12] test, btrace: add branch tracing tests markus.t.metzger
2012-12-17 20:26   ` Jan Kratochvil
2012-12-17 18:45 ` [patch v6 00/12] branch tracing support for Atom Jan Kratochvil
2012-12-17 19:34   ` Tom Tromey
2012-12-18  7:24     ` Metzger, Markus T
2012-12-18  9:20 ` Jan Kratochvil
2012-12-18 10:14   ` Metzger, Markus T
2012-12-18 13:55     ` Jan Kratochvil
2012-12-19  9:59       ` Metzger, Markus T
2012-12-19 12:13         ` Mark Kettenis
2012-12-19 12:37           ` Jan Kratochvil
2012-12-20  7:17         ` Jan Kratochvil
2012-12-20  9:14           ` Metzger, Markus T
2012-12-20 11:43             ` Jan Kratochvil
2012-12-20 15:20               ` Metzger, Markus T
2012-12-21 19:12                 ` Jan Kratochvil
2012-12-22 13:08         ` Jan Kratochvil
2013-01-01 16:35           ` Jan Kratochvil

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=20121217200456.GH14232@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kettenis@gnu.org \
    --cc=markus.t.metzger@gmail.com \
    --cc=markus.t.metzger@intel.com \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.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