aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-block.exp
diff options
context:
space:
mode:
authorJan Vrany <jan.vrany@labware.com>2025-02-04 13:56:49 +0000
committerJan Vrany <jan.vrany@labware.com>2025-02-04 13:56:49 +0000
commit5166ed9c9c6f60859295d932b65c5c5a19984dfd (patch)
tree874e1421f9a70922c7d1a66da7bdff26f6ac6233 /gdb/testsuite/gdb.python/py-block.exp
parent96a02b669eb4e5483bc820cc2cc8acfff8b8ae23 (diff)
downloadbinutils-5166ed9c9c6f60859295d932b65c5c5a19984dfd.zip
binutils-5166ed9c9c6f60859295d932b65c5c5a19984dfd.tar.gz
binutils-5166ed9c9c6f60859295d932b65c5c5a19984dfd.tar.bz2
gdb/python: add subblocks property to gdb.Block
This commit adds new propery "subblocks" to gdb.Block objects. This allows Python to traverse block tree starting with global block. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/testsuite/gdb.python/py-block.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-block.exp6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp
index 0e6851d..ce3f7ce 100644
--- a/gdb/testsuite/gdb.python/py-block.exp
+++ b/gdb/testsuite/gdb.python/py-block.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,6 +61,10 @@ gdb_py_test_silent_cmd "python sblock = block.static_block" \
"Get block, static_block" 1
gdb_test "python print (gblock.is_global)" "True" "is the global block"
gdb_test "python print (sblock.is_static)" "True" "is the static block"
+gdb_test "python print (len(gblock.subblocks) > 0)" "True" \
+ "global block contains at least one block"
+gdb_test "python print (sblock in gblock.subblocks)" "True" \
+ "global block contains at static block"
# Move up superblock(s) until we reach function block_func.
gdb_test_no_output "python block = block.superblock" "get superblock"