[3/4] Tests for gdb.InfThread.thread_handle

Message ID 20180915221710.786b60a0@pinnacle.lan
State New
Headers show
Series
  • Add python method gdb.InferiorThread.thread_handle
Related show

Commit Message

Kevin Buettner Sept. 16, 2018, 5:17 a.m.
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(+)

Patch

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