PR python/20190 - compute TLS symbol without a frame
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / tls.exp
index 29384e5449f101abe228c637bb73fda9bde121ba..5c07844f147fbc70199f09628dec9fcd5a24128c 100644 (file)
@@ -14,6 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+load_lib gdb-python.exp
+
 standard_testfile tls.c tls2.c
 
 if [istarget "*-*-linux"] then {
@@ -70,6 +72,17 @@ proc check_thread_local {number} {
            "= $expected_value" \
            "${number} thread local storage"
 
+    if {![skip_python_tests]} {
+       gdb_test_no_output \
+           "python sym = gdb.lookup_symbol('a_thread_local')\[0\]" \
+           "${number} look up a_thread_local symbol"
+       # We intentionally do not pass a frame to "value" here.  If a
+       # TLS variable requires a frame, this will fail.  However, if
+       # it does not require a frame, then it will succeed.
+       gdb_test "python print(sym.value())" "$expected_value" \
+           "${number} get symbol value without frame"
+    }
+
     gdb_test "p K::another_thread_local" \
            "= $me_variable" \
            "${number} another thread local storage"
@@ -139,6 +152,10 @@ proc check_thread_stack {number spin_threads spin_threads_level} {
 }
 
 clean_restart ${binfile}
+
+gdb_test "print a_thread_local" \
+    "Cannot read .a_thread_local. without registers"
+
 if ![runto_main] then {
    fail "Can't run to main"
    return 0
This page took 0.024063 seconds and 4 git commands to generate.