aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/python.exp
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-06-05 07:42:12 -0600
committerTom Tromey <tom@tromey.com>2022-07-08 14:14:58 -0600
commitd19ca0b35c9536210c5e8bd30504489b7439f51f (patch)
treea488182e25b0d0a16eea68ab816c986988c28cfd /gdb/testsuite/gdb.python/python.exp
parentfa17a6814113ac22d8059d61514aa2c6e29b0aae (diff)
downloadbinutils-d19ca0b35c9536210c5e8bd30504489b7439f51f.zip
binutils-d19ca0b35c9536210c5e8bd30504489b7439f51f.tar.gz
binutils-d19ca0b35c9536210c5e8bd30504489b7439f51f.tar.bz2
Accept gdb.Value in more Python APIs
PR python/27000 points out that gdb.block_for_pc will accept a Python integer, but not a gdb.Value. This patch corrects this oversight. I looked at all uses of GDB_PY_LLU_ARG and fixed these up to use get_addr_from_python instead. I also looked at uses of GDB_PY_LL_ARG, but those seemed relatively unlikely to be useful with a gdb.Value, so I didn't change them. My thinking here is that a Value will typically come from inferior memory, and something like a line number is not too likely to be found this way. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27000
Diffstat (limited to 'gdb/testsuite/gdb.python/python.exp')
-rw-r--r--gdb/testsuite/gdb.python/python.exp3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 7e0d4cb..8c0da6d 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -514,6 +514,9 @@ gdb_test "python print (pc_rtn > pc_call)" "True" \
gdb_test "python print (gdb.find_pc_line(pc_rtn).line >= line)" "True" \
"test find_pc_line with resume address"
+gdb_test "python print (gdb.find_pc_line(pc_rtn).line == gdb.find_pc_line(gdb.Value(pc_rtn)).line)" \
+ "True" \
+ "test find_pc_line using Value"
gdb_test_no_output "set variable \$cvar1 = 23" "set convenience variable"
gdb_test "python print(gdb.convenience_variable('cvar1'))" "23"