diff options
author | Kevin Buettner <kevinb@redhat.com> | 2019-02-27 15:06:28 -0700 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2019-04-08 20:14:26 -0700 |
commit | 50a82723c446c556287dcabe22183bc5cedab566 (patch) | |
tree | b7845795032a6ce525e9f5c30a61d5edb6017b70 /gdb/thread.c | |
parent | cf63b0162b6cbf74bdb056609d1ad777c6d48954 (diff) | |
download | gdb-50a82723c446c556287dcabe22183bc5cedab566.zip gdb-50a82723c446c556287dcabe22183bc5cedab566.tar.gz gdb-50a82723c446c556287dcabe22183bc5cedab566.tar.bz2 |
Support buffer objects as handles in Inferior.thread_from_thread_handle()
InferiorThread.handle() returns a python bytes object. We'd like to
be able to pass the output of this function, a thread handle, to
Inferior.thread_from_thread_handle(). Up to now,
thread_from_thread_handle() expects to receive a gdb.Value input.
This commit adds support to also allow a python buffer object to be
passed as the handle.
infpy_thread_from_thread_handle() calls find_thread_by_handle() which
has the obvious functionality. It used to pass the thread handle via
a struct value pointer. I've revised this interface to instead pass a
gdb::array_view<const gdb_byte> object. (Thanks to Tom Tromey for
suggesting this data structure over an earlier version which passed a
gdb_byte pointer and length.)
gdb/ChangeLog:
* gdbthread.h (find_thread_by_handle): Revise declaration.
* thread.c (find_thread_by_handle): Likewise. Adjust
implementation too.
* python/py-inferior.c (infpy_thread_from_thread_handle): Add
support for buffer objects as handles.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r-- | gdb/thread.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/thread.c b/gdb/thread.c index 5b23b8c..dbcf8be 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -540,12 +540,12 @@ find_thread_ptid (inferior *inf, ptid_t ptid) /* See gdbthread.h. */ struct thread_info * -find_thread_by_handle (struct value *thread_handle, struct inferior *inf) +find_thread_by_handle (gdb::array_view<const gdb_byte> handle, + struct inferior *inf) { - return target_thread_handle_to_thread_info - (value_contents_all (thread_handle), - TYPE_LENGTH (value_type (thread_handle)), - inf); + return target_thread_handle_to_thread_info (handle.data (), + handle.size (), + inf); } /* |