This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 2/5] Add python method InferiorThread.thread_handle


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]