aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-07-06 11:57:26 -0600
committerTom Tromey <tromey@adacore.com>2023-07-14 10:52:56 -0600
commit817437c2ffcdf14e6d4aae30fc8159e5e8e390d6 (patch)
tree8263c40da0d01b36091431a1f454d2bd496e45c8 /gdb
parenteef2e91d32928096b5c174d50d40fe13955a407a (diff)
downloadgdb-817437c2ffcdf14e6d4aae30fc8159e5e8e390d6.zip
gdb-817437c2ffcdf14e6d4aae30fc8159e5e8e390d6.tar.gz
gdb-817437c2ffcdf14e6d4aae30fc8159e5e8e390d6.tar.bz2
Rename Python variable in py-inferior.exp
py-inferior.exp creates a Python variable named 'str'. This clashes with the built-in type of the same name and can be confusing when trying to evaluate Python code when debugging the test case. This patch renames it. Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.python/py-inferior.exp11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 723f212..8762b69 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -88,13 +88,14 @@ gdb_continue_to_breakpoint "cont to Break here." ".*Break here\..*"
gdb_py_test_silent_cmd "python addr = gdb.selected_frame ().read_var ('str')" \
"read str address" 0
-gdb_py_test_silent_cmd "python str = gdb.inferiors()\[0\].read_memory (addr, 5); print(str)" \
- "read str contents" 1
+gdb_test "python astr = gdb.inferiors()\[0\].read_memory (addr, 5); print(astr)" \
+ "<memory at $hex>" \
+ "read str contents"
gdb_py_test_silent_cmd "python a = bytes('a', 'ascii')" "" 0
-gdb_py_test_silent_cmd "python str\[1\] = a" "change str" 0
-gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, str)" \
+gdb_py_test_silent_cmd "python astr\[1\] = a" "change str" 0
+gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, astr)" \
"write str" 1
-gdb_test "print (str)" " = \"hallo, testsuite\"" \
+gdb_test "print str" " = \"hallo, testsuite\"" \
"ensure str was changed in the inferior"
# Test memory search.