aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-progspace.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/py-progspace.exp
parentfa17a6814113ac22d8059d61514aa2c6e29b0aae (diff)
downloadgdb-d19ca0b35c9536210c5e8bd30504489b7439f51f.zip
gdb-d19ca0b35c9536210c5e8bd30504489b7439f51f.tar.gz
gdb-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/py-progspace.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-progspace.exp3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp
index 6c7142c..7c36585 100644
--- a/gdb/testsuite/gdb.python/py-progspace.exp
+++ b/gdb/testsuite/gdb.python/py-progspace.exp
@@ -60,6 +60,9 @@ if {![runto_main]} {
set pc_val [get_integer_valueof "\$pc" 0]
gdb_py_test_silent_cmd "python blk = gdb.current_progspace ().block_for_pc (${pc_val})" \
"get block for the current \$pc" 1
+gdb_py_test_silent_cmd \
+ "python blk = gdb.current_progspace ().block_for_pc (gdb.Value(${pc_val}))" \
+ "get block for the current \$pc as value" 1
gdb_test "python print (blk.start <= ${pc_val})" "True" \
"block start is before \$pc"
gdb_test "python print (blk.end >= ${pc_val})" "True" \