Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] [python] PR python/15461 (gate architecture calls)
Date: Wed, 28 Aug 2013 14:52:00 -0000	[thread overview]
Message-ID: <87k3j5x3yq.fsf@fleche.redhat.com> (raw)
In-Reply-To: <521DE761.6010403@redhat.com> (Phil Muldoon's message of "Wed, 28	Aug 2013 13:04:49 +0100")

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> This patch gates calls to architecture.name and
Phil> architecture.disassemble.  If the underlying GDB architecture is NULL,
Phil> calls to those Python functions will result in an assert call.

Thanks.

Phil> +/* Require a valid Architecture.  */
Phil> +#define ARCHPY_REQUIRE_VALID (arch_obj, arch)		\
Phil> +  do {							\
Phil> +    arch = arch_object_to_gdbarch (arch_obj);		\
Phil> +    if (arch == NULL)					\
Phil> +      error (_("Architecture is invalid."));		\
Phil> +  } while (0)

I think it would be simpler to either:

* Have this set the python exception and not call error, or
* Likewise but just have it be done in arch_object_to_gdbarch.

With the current approach you have to have a try/catch and then throw an
exception; but really all you want is to set the python exception --
which is cheaper to do directly.

Phil>  # You should have received a copy of the GNU General Public License
Phil>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
Phil> +load_lib gdb-python.exp

It would be handy to get this hunk in sooner.
It's obvious fwiw.

Tom


  reply	other threads:[~2013-08-28 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 12:04 Phil Muldoon
2013-08-28 14:52 ` Tom Tromey [this message]
2013-08-28 15:15   ` Phil Muldoon
2013-08-28 15:54     ` Tom Tromey
2013-08-29 11:15       ` Phil Muldoon
2013-08-29 14:58         ` Tom Tromey
2013-08-30 10:13           ` Phil Muldoon
2013-08-28 17:54 ` Tom Tromey
2013-08-28 18:14   ` Paul_Koning
2013-08-28 18:45     ` Phil Muldoon

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=87k3j5x3yq.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmuldoon@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