Created
November 20, 2018 19:49
-
-
Save noahp/79bf5cc81288d9d339381c24ffa68c77 to your computer and use it in GitHub Desktop.
patch gdb python bindings to expose InferiorThread extra_info string π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c | |
index 4b2705a0af..34983f0ec5 100644 | |
--- a/gdb/python/py-infthread.c | |
+++ b/gdb/python/py-infthread.c | |
@@ -117,6 +117,22 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore) | |
return 0; | |
} | |
+static PyObject * | |
+thpy_get_extra_info (PyObject *self, void *ignore) | |
+{ | |
+ thread_object *thread_obj = (thread_object *) self; | |
+ const char *extra_info; | |
+ | |
+ THPY_REQUIRE_VALID (thread_obj); | |
+ | |
+ extra_info = target_extra_thread_info(thread_obj->thread); | |
+ | |
+ if (extra_info == NULL) | |
+ Py_RETURN_NONE; | |
+ | |
+ return PyString_FromString (extra_info); | |
+} | |
+ | |
/* Getter for InferiorThread.num. */ | |
static PyObject * | |
@@ -303,6 +319,8 @@ static gdb_PyGetSetDef thread_object_getset[] = | |
{ | |
{ "name", thpy_get_name, thpy_set_name, | |
"The name of the thread, as set by the user or the OS.", NULL }, | |
+ { "extra_info", thpy_get_extra_info, NULL, | |
+ "Extra info string associated with the thread.", NULL }, | |
{ "num", thpy_get_num, NULL, | |
"Per-inferior number of the thread, as assigned by GDB.", NULL }, | |
{ "global_num", thpy_get_global_num, NULL, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment