Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/5] Add python method InferiorThread.thread_handle
Date: Tue, 05 Mar 2019 21:48:00 -0000	[thread overview]
Message-ID: <87ef7lq9fx.fsf@tromey.com> (raw)
In-Reply-To: <20190227193107.5c55cc03@f29-4.lan> (Kevin Buettner's message of	"Wed, 27 Feb 2019 19:31:07 -0700")

>>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:

Kevin> +/* Implementation of gdb.InferiorThread.thread_handle (self) -> handle. */

What would you think of just the name "handle"?  The "thread" part
seemed redundant to me.

Kevin> +  gdb::byte_vector hv = target_thread_info_to_thread_handle (thread_obj->thread);

In general, calls into gdb from Python require a try/catch.
It can be ok if you're 100% sure a throw is not only not possible but
will never be possible.  (I feel like we normally ignore out-of-memory
exceptions when deciding this, but that's probably a bad idea.)

Kevin> +  PyObject *object = PyBytes_FromStringAndSize ((const char *) hv.data (),
Kevin> +				                hv.size());

I thought this wasn't available in Python 2 but I see it is used
unconditionally in py-record-btrace.c.

Tom


  reply	other threads:[~2019-03-05 21:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28  2:24 [PATCH v2 0/5] Add python method gdb.InferiorThread.thread_handle Kevin Buettner
2019-02-28  2:30 ` [PATCH v2 1/5] Introduce target_ops method thread_info_to_thread_handle Kevin Buettner
2019-03-05 21:44   ` Tom Tromey
2019-02-28  2:31 ` [PATCH v2 2/5] Add python method InferiorThread.thread_handle Kevin Buettner
2019-03-05 21:48   ` Tom Tromey [this message]
2019-03-20 20:24     ` Kevin Buettner
2019-03-20 20:39       ` Tom Tromey
2019-03-20 20:48         ` Kevin Buettner
2019-02-28  2:32 ` [PATCH v2 3/5] Support buffer objects as handles in Inferior.thread_from_thread_handle() Kevin Buettner
2019-03-05 21:51   ` Tom Tromey
2019-02-28  2:34 ` [PATCH v2 4/5] Tests for gdb.InferiorThread.thread_handle Kevin Buettner
2019-03-05 21:54   ` Tom Tromey
2019-02-28  2:35 ` [PATCH v2 5/5] Documentation for python method InferiorThread.thread_handle Kevin Buettner
2019-02-28 18:06   ` 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=87ef7lq9fx.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@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