public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Thread handle to (GDB internal) thread object mapping
@ 2016-05-05 21:09 Kevin Buettner
  2016-05-05 21:12 ` [PATCH 1/4] Add target method for converting thread handle to thread_info struct pointer Kevin Buettner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kevin Buettner @ 2016-05-05 21:09 UTC (permalink / raw)
  To: gdb-patches

This patch set introduces an interface/mechanism for mapping thread
handles to the thread_info structs which GDB uses to keep track of
threads in the inferiors which it's debugging.  I need this in order
to find the GDB thread which corresponds to a saved thread handle (of
type pthread_t) within an implementation of a thread library built
atop pthreads.

Part 1 introduces a target method which maps a thread handle to
the corresponding internal GDB thread object, i.e. something of type
`struct thread_info *'.  An implementation of this new method is
provided for the Linux thread target.  Additional work will be
required, over time, for other thread targets.

Part 2 adds a python interface for the mechanism introduced in part 1.

Part 3 is a documentation patch.

Part 4 adds a test case.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] Add target method for converting thread handle to thread_info struct pointer
  2016-05-05 21:09 [PATCH 0/4] Thread handle to (GDB internal) thread object mapping Kevin Buettner
@ 2016-05-05 21:12 ` Kevin Buettner
  2016-05-05 21:14 ` [PATCH 2/4] Add `thread_from_thread_handle' function to (Python) gdb module Kevin Buettner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Buettner @ 2016-05-05 21:12 UTC (permalink / raw)
  To: gdb-patches

    This patch adds a target method named `to_thread_handle_to_thread_info'.
    It is intended to map a thread library specific thread handle (such as
    pthread_t for the pthread library) to the corresponding GDB internal
    thread_info struct (pointer).
    
    An implementation is provided for Linux pthreads; see linux-thread-db.c.
    
    gdb/ChangeLog:
    
    	* target.h (struct target_ops): Add to_thread_handle_to_thread_info.
    	(target_thread_handle_to_thread_info): Declare.
    	* target.c (target_thread_handle_to_thread_info): New function.
    	* target-delegates.c: Regenerate.
    	* gdbthread.h (find_thread_by_handle): Declare.
    	* thread.c (find_thread_by_handle): New function.
    	* linux-thread-db.c (thread_db_thread_handle_to_thread_info): New
    	function.
    	(init_thread_db_ops): Register thread_db_thread_handle_to_thread_info.
---
 gdb/gdbthread.h        |  3 +++
 gdb/linux-thread-db.c  | 24 ++++++++++++++++++++++++
 gdb/target-delegates.c | 35 +++++++++++++++++++++++++++++++++++
 gdb/target.c           |  8 ++++++++
 gdb/target.h           | 10 ++++++++++
 gdb/thread.c           |  9 +++++++++
 6 files changed, 89 insertions(+)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index bdd2bb0..95f9a36 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -428,6 +428,9 @@ extern struct thread_info *find_thread_ptid (ptid_t ptid);
 /* Find thread by GDB global thread ID.  */
 struct thread_info *find_thread_global_id (int global_id);
 
+/* Find thread by thread library specific handle.  */
+struct thread_info *find_thread_by_handle (struct value *thread_handle);
+
 /* Finds the first thread of the inferior given by PID.  If PID is -1,
    returns the first thread in the list.  */
 struct thread_info *first_thread_of_process (int pid);
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 992965f..02f88e9 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1414,6 +1414,29 @@ thread_db_extra_thread_info (struct target_ops *self,
   return NULL;
 }
 
+/* Return pointer to the thread_info struct which corresponds to
+   THREAD_HANDLE (having length HANDLE_LEN).  */
+static struct thread_info *
+thread_db_thread_handle_to_thread_info (struct target_ops *ops,
+                                        const gdb_byte *thread_handle,
+					int handle_len)
+{
+  struct thread_info *tp;
+  thread_t handle_tid;
+
+  gdb_assert (handle_len == sizeof (handle_tid));
+
+  handle_tid = * (const thread_t *) thread_handle;
+
+  ALL_NON_EXITED_THREADS (tp)
+    {
+      if (tp->priv != NULL && handle_tid == tp->priv->tid)
+        return tp;
+    }
+
+  return NULL;
+}
+
 /* Get the address of the thread local variable in load module LM which
    is stored at OFFSET within the thread local storage for thread PTID.  */
 
@@ -1693,6 +1716,7 @@ init_thread_db_ops (void)
     = thread_db_get_thread_local_address;
   thread_db_ops.to_extra_thread_info = thread_db_extra_thread_info;
   thread_db_ops.to_get_ada_task_ptid = thread_db_get_ada_task_ptid;
+  thread_db_ops.to_thread_handle_to_thread_info = thread_db_thread_handle_to_thread_info;
   thread_db_ops.to_magic = OPS_MAGIC;
 
   complete_target_initialization (&thread_db_ops);
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 03aa2cc..ec64b14 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -1559,6 +1559,37 @@ debug_thread_name (struct target_ops *self, struct thread_info *arg1)
   return result;
 }
 
+static struct thread_info *
+delegate_thread_handle_to_thread_info (struct target_ops *self, const gdb_byte *arg1, int arg2)
+{
+  self = self->beneath;
+  return self->to_thread_handle_to_thread_info (self, arg1, arg2);
+}
+
+static struct thread_info *
+tdefault_thread_handle_to_thread_info (struct target_ops *self, const gdb_byte *arg1, int arg2)
+{
+  return NULL;
+}
+
+static struct thread_info *
+debug_thread_handle_to_thread_info (struct target_ops *self, const gdb_byte *arg1, int arg2)
+{
+  struct thread_info * result;
+  fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_handle_to_thread_info (...)\n", debug_target.to_shortname);
+  result = debug_target.to_thread_handle_to_thread_info (&debug_target, arg1, arg2);
+  fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_handle_to_thread_info (", debug_target.to_shortname);
+  target_debug_print_struct_target_ops_p (&debug_target);
+  fputs_unfiltered (", ", gdb_stdlog);
+  target_debug_print_const_gdb_byte_p (arg1);
+  fputs_unfiltered (", ", gdb_stdlog);
+  target_debug_print_int (arg2);
+  fputs_unfiltered (") = ", gdb_stdlog);
+  target_debug_print_struct_thread_info_p (result);
+  fputs_unfiltered ("\n", gdb_stdlog);
+  return result;
+}
+
 static void
 delegate_stop (struct target_ops *self, ptid_t arg1)
 {
@@ -4185,6 +4216,8 @@ install_delegators (struct target_ops *ops)
     ops->to_extra_thread_info = delegate_extra_thread_info;
   if (ops->to_thread_name == NULL)
     ops->to_thread_name = delegate_thread_name;
+  if (ops->to_thread_handle_to_thread_info == NULL)
+    ops->to_thread_handle_to_thread_info = delegate_thread_handle_to_thread_info;
   if (ops->to_stop == NULL)
     ops->to_stop = delegate_stop;
   if (ops->to_interrupt == NULL)
@@ -4435,6 +4468,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_pid_to_str = default_pid_to_str;
   ops->to_extra_thread_info = tdefault_extra_thread_info;
   ops->to_thread_name = tdefault_thread_name;
+  ops->to_thread_handle_to_thread_info = tdefault_thread_handle_to_thread_info;
   ops->to_stop = tdefault_stop;
   ops->to_interrupt = tdefault_interrupt;
   ops->to_pass_ctrlc = default_target_pass_ctrlc;
@@ -4591,6 +4625,7 @@ init_debug_target (struct target_ops *ops)
   ops->to_pid_to_str = debug_pid_to_str;
   ops->to_extra_thread_info = debug_extra_thread_info;
   ops->to_thread_name = debug_thread_name;
+  ops->to_thread_handle_to_thread_info = debug_thread_handle_to_thread_info;
   ops->to_stop = debug_stop;
   ops->to_interrupt = debug_interrupt;
   ops->to_pass_ctrlc = debug_pass_ctrlc;
diff --git a/gdb/target.c b/gdb/target.c
index a9744c4..d6b966d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2286,6 +2286,14 @@ target_thread_name (struct thread_info *info)
   return current_target.to_thread_name (&current_target, info);
 }
 
+struct thread_info *
+target_thread_handle_to_thread_info (const gdb_byte * thread_handle,
+                                     int handle_len)
+{
+  return current_target.to_thread_handle_to_thread_info
+           (&current_target, thread_handle, handle_len);
+}
+
 void
 target_resume (ptid_t ptid, int step, enum gdb_signal signal)
 {
diff --git a/gdb/target.h b/gdb/target.h
index 6b5b6e0..010c89a 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -641,6 +641,10 @@ struct target_ops
       TARGET_DEFAULT_RETURN (NULL);
     const char *(*to_thread_name) (struct target_ops *, struct thread_info *)
       TARGET_DEFAULT_RETURN (NULL);
+    struct thread_info *(*to_thread_handle_to_thread_info) (struct target_ops *,
+                                                            const gdb_byte *,
+							    int)
+      TARGET_DEFAULT_RETURN (NULL);
     void (*to_stop) (struct target_ops *, ptid_t)
       TARGET_DEFAULT_IGNORE ();
     void (*to_interrupt) (struct target_ops *, ptid_t)
@@ -1837,6 +1841,12 @@ extern char *normal_pid_to_str (ptid_t ptid);
 
 extern const char *target_thread_name (struct thread_info *);
 
+/* Given a pointer to a thread library specific thread handle and
+   its length, return a pointer to the corresponding thread_info struct.  */
+
+extern struct thread_info *target_thread_handle_to_thread_info
+  (const gdb_byte * thread_handle, int handle_len);
+
 /* Attempts to find the pathname of the executable file
    that was run to create a specified process.
 
diff --git a/gdb/thread.c b/gdb/thread.c
index 75bfb47..31da3ad 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -526,6 +526,15 @@ find_thread_ptid (ptid_t ptid)
   return NULL;
 }
 
+/* Find a thread_info by matching thread libary specific handle.  */
+struct thread_info *
+find_thread_by_handle (struct value *thread_handle)
+{
+  return target_thread_handle_to_thread_info
+           (value_contents_all (thread_handle),
+           TYPE_LENGTH (value_type (thread_handle)));
+}
+
 /*
  * Thread iterator function.
  *

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/4] Add `thread_from_thread_handle' function to (Python) gdb module
  2016-05-05 21:09 [PATCH 0/4] Thread handle to (GDB internal) thread object mapping Kevin Buettner
  2016-05-05 21:12 ` [PATCH 1/4] Add target method for converting thread handle to thread_info struct pointer Kevin Buettner
@ 2016-05-05 21:14 ` Kevin Buettner
  2016-05-05 21:17 ` [PATCH 3/4] Documentation for gdb.thread_from_thread_handle Kevin Buettner
  2016-05-05 21:19 ` [PATCH 4/4] Test case " Kevin Buettner
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Buettner @ 2016-05-05 21:14 UTC (permalink / raw)
  To: gdb-patches

gdb/ChangeLog:
    	* python/py-infthread.c (gdbpy_thread_from_thread_handle): New
    	function.
    	* python/python-internal.h (thread_object_type): Declare.
    	(gdbpy_thread_from_thread_handle): Declare.
    	* python/python.c (thread_from_thread_handle): Register.
---
 gdb/python/py-infthread.c    | 37 +++++++++++++++++++++++++++++++++++++
 gdb/python/python-internal.h |  3 +++
 gdb/python/python.c          |  4 ++++
 3 files changed, 44 insertions(+)

diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 3a9bae7..433e3e4 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -294,6 +294,43 @@ gdbpy_selected_thread (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+PyObject *
+gdbpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
+{
+  PyObject *handle_obj, *result;
+  static char *keywords[] = { "thread_handle", NULL };
+
+  if (! PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &handle_obj))
+    return NULL;
+
+  result = NULL;
+
+  if (gdbpy_is_value_object (handle_obj))
+    {
+      TRY
+	{
+	  struct thread_info *thread_info;
+	  struct value *val = value_object_to_value (handle_obj);
+
+	  thread_info = find_thread_by_handle (val);
+	  if (thread_info != NULL)
+	    {
+              result = (PyObject *) find_thread_object (thread_info->ptid);
+	      if (result)
+		Py_INCREF (result);
+	    }
+	}
+      CATCH (except, RETURN_MASK_ALL)
+	{
+	  if (except.reason < 0)
+	    gdbpy_convert_exception (except);
+	}
+      END_CATCH
+    }
+
+  return result;
+}
+
 int
 gdbpy_initialize_thread (void)
 {
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 6a2619c..4e0ef0d 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -249,6 +249,8 @@ extern PyTypeObject breakpoint_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_object");
 extern PyTypeObject frame_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("frame_object");
+extern PyTypeObject thread_object_type
+    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
 
 typedef struct gdbpy_breakpoint_object
 {
@@ -373,6 +375,7 @@ PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
 PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2);
 PyObject *gdbpy_create_ptid_object (ptid_t ptid);
 PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args);
+PyObject *gdbpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw);
 PyObject *gdbpy_selected_inferior (PyObject *self, PyObject *args);
 PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args);
 PyObject *gdbpy_parameter (PyObject *self, PyObject *args);
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c706644..0fccadc 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2064,6 +2064,10 @@ Arguments are separate by spaces and may be quoted."
   { "selected_thread", gdbpy_selected_thread, METH_NOARGS,
     "selected_thread () -> gdb.InferiorThread.\n\
 Return the selected thread object." },
+  { "thread_from_thread_handle", (PyCFunction) gdbpy_thread_from_thread_handle,
+     METH_VARARGS | METH_KEYWORDS,
+     "thread_from_thread_handle (handle) -> gdb.InferiorThread.\n\
+Return thread object corresponding to thread handle." },
   { "selected_inferior", gdbpy_selected_inferior, METH_NOARGS,
     "selected_inferior () -> gdb.Inferior.\n\
 Return the selected inferior object." },

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/4] Documentation for gdb.thread_from_thread_handle
  2016-05-05 21:09 [PATCH 0/4] Thread handle to (GDB internal) thread object mapping Kevin Buettner
  2016-05-05 21:12 ` [PATCH 1/4] Add target method for converting thread handle to thread_info struct pointer Kevin Buettner
  2016-05-05 21:14 ` [PATCH 2/4] Add `thread_from_thread_handle' function to (Python) gdb module Kevin Buettner
@ 2016-05-05 21:17 ` Kevin Buettner
  2016-05-06  6:31   ` Eli Zaretskii
  2016-05-06  6:32   ` Eli Zaretskii
  2016-05-05 21:19 ` [PATCH 4/4] Test case " Kevin Buettner
  3 siblings, 2 replies; 7+ messages in thread
From: Kevin Buettner @ 2016-05-05 21:17 UTC (permalink / raw)
  To: gdb-patches

gdb/doc/ChangeLog:
    
    	* python.texi (Threads In Python): Add description for function
    	gdb.thread_from_thread_handle.
---
 gdb/doc/python.texi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index ffbf89a..c519d1c 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -2981,6 +2981,13 @@ This function returns the thread object for the selected thread.  If there
 is no selected thread, this will return @code{None}.
 @end defun
 
+@findex gdb.thread_from_thread_handle
+@defun gdb.thread_from_thread_handle
+Return the thread object corresponding to the thread handle,
+@var{thread_handle}, a thread library specific data structure such as
+@code{pthread_t} for pthreads library implementations.
+@end defun
+
 A @code{gdb.InferiorThread} object has the following attributes:
 
 @defvar InferiorThread.name

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/4] Test case for gdb.thread_from_thread_handle
  2016-05-05 21:09 [PATCH 0/4] Thread handle to (GDB internal) thread object mapping Kevin Buettner
                   ` (2 preceding siblings ...)
  2016-05-05 21:17 ` [PATCH 3/4] Documentation for gdb.thread_from_thread_handle Kevin Buettner
@ 2016-05-05 21:19 ` Kevin Buettner
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Buettner @ 2016-05-05 21:19 UTC (permalink / raw)
  To: gdb-patches

As the title says, this is a test case for
gdb.thread_from_thread_handle, a python function which will, given a
thread library dependent thread handle, find the GDB thread which
corresponds to that thread handle.

The C file for this test case causes the thread handles for the
main thread and two child threads to be placed into an array.  The
test case runs to one of the functions (do_something()) at which point,
it retrieves the thread handles from the array and attempts to find the
correponding thread in GDB's internal thread list.

I use a barrier to make sure that both threads have actually started;
execution will stop when one of the threads breaks at do_something.

The one concern I have about what I've written is with the last three
invocations of gdb_test.  I don't know that we can be certain that
thrs[1] will always map to GDB thread 2 and that thrs[2] will map to
GDB thread 3.  It seems likely, but some perverse pthreads implementation
could change the order in which newly created threads are actually started.
If anyone thinks this is a problem, I can tweak it so that the test case
simply verifies that reasonable output is produced and another test can
verify that the two child thread numbers are actually different.

gdb/testsuite/ChangeLog:
    
    	* gdb.python/py-thrhandle.c, gdb.python/py-thrhandle.exp: New
    	files.
---
 gdb/testsuite/gdb.python/py-thrhandle.c   | 71 +++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.python/py-thrhandle.exp | 46 ++++++++++++++++++++
 2 files changed, 117 insertions(+)

diff --git a/gdb/testsuite/gdb.python/py-thrhandle.c b/gdb/testsuite/gdb.python/py-thrhandle.c
new file mode 100644
index 0000000..ec148c9
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-thrhandle.c
@@ -0,0 +1,71 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2016 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see  <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <alloca.h>
+
+#define NTHR 3
+pthread_t thrs[NTHR];
+pthread_barrier_t barrier;
+pthread_mutex_t mutex;
+
+void
+do_something (int n)
+{
+  pthread_mutex_lock (&mutex);
+  printf ("%d\n", n);
+  pthread_mutex_unlock (&mutex);
+}
+
+void *
+do_work (void *data)
+{
+  int num = * (int *) data;
+
+  pthread_barrier_wait (&barrier);
+
+  do_something (num);
+
+  pthread_exit (NULL);
+}
+
+int
+main (int argc, char **argv)
+{
+  int i;
+
+  pthread_barrier_init (&barrier, NULL, NTHR-1);
+  pthread_mutex_init (&mutex, NULL);
+
+  thrs[0] = pthread_self ();
+
+  for (i=1; i< NTHR; i++)
+    {
+      int *iptr = alloca (sizeof (int));
+      
+      *iptr = i;
+      pthread_create (&thrs[i], NULL, do_work, iptr);
+    }
+
+  for (i=1; i< NTHR; i++)
+    {
+      pthread_join (thrs[i], NULL);
+    }
+  printf ("Done!");
+}
diff --git a/gdb/testsuite/gdb.python/py-thrhandle.exp b/gdb/testsuite/gdb.python/py-thrhandle.exp
new file mode 100644
index 0000000..a324d4e
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-thrhandle.exp
@@ -0,0 +1,46 @@
+# Copyright (C) 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@gnu.org
+
+# This file verifies that gdb.thread_from_thread_handle works as expected.
+
+standard_testfile
+
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
+    return -1
+}
+
+clean_restart ${binfile}
+runto_main
+
+gdb_test "break do_something" \
+    "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
+         "breakpoint on do_something"
+
+gdb_test "continue" \
+	"Breakpoint 2, do_something .*" \
+	"run to do_something"
+
+gdb_test "python print gdb.thread_from_thread_handle(gdb.parse_and_eval('thrs\[0\]')).num" \
+	"1" 
+
+gdb_test "python print gdb.thread_from_thread_handle(gdb.parse_and_eval('thrs\[1\]')).num" \
+	"2"
+
+gdb_test "python print gdb.thread_from_thread_handle(gdb.parse_and_eval('thrs\[2\]')).num" \
+	"3"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/4] Documentation for gdb.thread_from_thread_handle
  2016-05-05 21:17 ` [PATCH 3/4] Documentation for gdb.thread_from_thread_handle Kevin Buettner
@ 2016-05-06  6:31   ` Eli Zaretskii
  2016-05-06  6:32   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2016-05-06  6:31 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> Date: Thu, 5 May 2016 14:16:47 -0700
> From: Kevin Buettner <kevinb@redhat.com>
> 
> gdb/doc/ChangeLog:
>     
>     	* python.texi (Threads In Python): Add description for function
>     	gdb.thread_from_thread_handle.
> ---
>  gdb/doc/python.texi | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index ffbf89a..c519d1c 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -2981,6 +2981,13 @@ This function returns the thread object for the selected thread.  If there
>  is no selected thread, this will return @code{None}.
>  @end defun
>  
> +@findex gdb.thread_from_thread_handle
> +@defun gdb.thread_from_thread_handle
> +Return the thread object corresponding to the thread handle,
> +@var{thread_handle}, a thread library specific data structure such as
> +@code{pthread_t} for pthreads library implementations.
> +@end defun

Thanks.  But should the @defun line include thread_handle as well?
It's the argument of the method, right?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/4] Documentation for gdb.thread_from_thread_handle
  2016-05-05 21:17 ` [PATCH 3/4] Documentation for gdb.thread_from_thread_handle Kevin Buettner
  2016-05-06  6:31   ` Eli Zaretskii
@ 2016-05-06  6:32   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2016-05-06  6:32 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> Date: Thu, 5 May 2016 14:16:47 -0700
> From: Kevin Buettner <kevinb@redhat.com>
> 
> gdb/doc/ChangeLog:
>     
>     	* python.texi (Threads In Python): Add description for function
>     	gdb.thread_from_thread_handle.
> ---
>  gdb/doc/python.texi | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index ffbf89a..c519d1c 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -2981,6 +2981,13 @@ This function returns the thread object for the selected thread.  If there
>  is no selected thread, this will return @code{None}.
>  @end defun
>  
> +@findex gdb.thread_from_thread_handle
> +@defun gdb.thread_from_thread_handle
> +Return the thread object corresponding to the thread handle,
> +@var{thread_handle}, a thread library specific data structure such as
> +@code{pthread_t} for pthreads library implementations.
> +@end defun

Thanks.  But should the @defun line include thread_handle as well?
It's the argument of the method, right?

Also, @defun automatically places its argument in the function index,
so @findex is not needed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-06  6:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 21:09 [PATCH 0/4] Thread handle to (GDB internal) thread object mapping Kevin Buettner
2016-05-05 21:12 ` [PATCH 1/4] Add target method for converting thread handle to thread_info struct pointer Kevin Buettner
2016-05-05 21:14 ` [PATCH 2/4] Add `thread_from_thread_handle' function to (Python) gdb module Kevin Buettner
2016-05-05 21:17 ` [PATCH 3/4] Documentation for gdb.thread_from_thread_handle Kevin Buettner
2016-05-06  6:31   ` Eli Zaretskii
2016-05-06  6:32   ` Eli Zaretskii
2016-05-05 21:19 ` [PATCH 4/4] Test case " Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).