This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 3/4] Tests for gdb.InfThread.thread_handle
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 15 Sep 2018 22:17:10 -0700
- Subject: [PATCH 3/4] Tests for gdb.InfThread.thread_handle
- References: <20180915220836.7dda4a63@pinnacle.lan>
gdb/testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Add tests for
gdb.InfThread.thread_handle.
---
gdb/testsuite/gdb.python/py-thrhandle.exp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/gdb/testsuite/gdb.python/py-thrhandle.exp b/gdb/testsuite/gdb.python/py-thrhandle.exp
index 49aa97c..b3caaf5 100644
--- a/gdb/testsuite/gdb.python/py-thrhandle.exp
+++ b/gdb/testsuite/gdb.python/py-thrhandle.exp
@@ -104,3 +104,17 @@ gdb_test "python print(gdb.selected_inferior().thread_from_thread_handle(gdb.par
gdb_test "python print(gdb.selected_inferior().thread_from_thread_handle(gdb.parse_and_eval('\"S\"')))" \
".*Thread handle size mismatch.*" \
"Pass too small of an object to thread_from_thread_handle"
+
+# Test the thread_handle method
+
+gdb_test "python h=gdb.parse_and_eval('thrs\[0\]');print(gdb.selected_inferior().thread_from_thread_handle(h)).thread_handle(gdb.lookup_type('pthread_t'))==h" \
+ "True" \
+ "Check operation of thread_handle method for thrs\[0\]"
+
+gdb_test "python h=gdb.parse_and_eval('thrs\[1\]');print(gdb.selected_inferior().thread_from_thread_handle(h)).thread_handle(gdb.lookup_type('pthread_t'))==h" \
+ "True" \
+ "Check operation of thread_handle method for thrs\[1\]"
+
+gdb_test "python h=gdb.parse_and_eval('thrs\[2\]');print(gdb.selected_inferior().thread_from_thread_handle(h)).thread_handle(gdb.lookup_type('pthread_t'))==h" \
+ "True" \
+ "Check operation of thread_handle method for thrs\[2\]"