# 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 {
"= $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"
}
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