Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Markus Metzger <markus.t.metzger@intel.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] btrace, gdbserver: check btrace target pointers
Date: Wed, 28 Feb 2018 16:26:00 -0000	[thread overview]
Message-ID: <86sh9lgjxt.fsf@gmail.com> (raw)
In-Reply-To: <1519727985-17914-1-git-send-email-markus.t.metzger@intel.com>	(Markus Metzger's message of "Tue, 27 Feb 2018 11:39:45 +0100")

Markus Metzger <markus.t.metzger@intel.com> writes:

> -#define target_enable_btrace(ptid, conf) \
> -  (*the_target->enable_btrace) (ptid, conf)
> +static inline struct btrace_target_info *
> +target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
> +{
> +  if (the_target->enable_btrace == nullptr)
> +    error ("Target does not support branch tracing.");
> +
> +  return (*the_target->enable_btrace) (ptid, conf);
> +}

It is reasonable to me that (*the_target->enable_btrace) may throw
various exceptions due to different reasons, but I am not convinced that
we should error on (the_target->enable_btrace == nullptr).  I don't like
replacing control flow logic with exception.  This is my personal
flavor.  Instead, can we check
(the_target->enable_btrace == nullptr) before using
target_enable_btrace, and error in handle_btrace_general_set if
thread->btrace is NULL.  What do you think?

-- 
Yao (齐尧)


  reply	other threads:[~2018-02-28 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 10:39 Markus Metzger
2018-02-28 16:26 ` Yao Qi [this message]
2018-02-28 17:11   ` Metzger, Markus T
2018-03-01  9:15     ` Yao Qi
2018-03-01 11:09       ` Pedro Alves

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=86sh9lgjxt.fsf@gmail.com \
    --to=qiyaoltc@gmail.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