aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-20 12:32:52 -0600
committerTom Tromey <tromey@adacore.com>2022-07-05 11:22:20 -0600
commit99298c958c5393402cd2bc2885c195838a9dd363 (patch)
treedd05d620651f849488132ef02898f96318ec518e /gdb/testsuite
parent3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3 (diff)
downloadgdb-99298c958c5393402cd2bc2885c195838a9dd363.zip
gdb-99298c958c5393402cd2bc2885c195838a9dd363.tar.gz
gdb-99298c958c5393402cd2bc2885c195838a9dd363.tar.bz2
Add gdb.Objfile.is_file attribute
Sometimes an objfile comes from memory and not from a file. It can be useful to be able to check this from Python, so this patch adds a new "is_file" attribute.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/jit-reader.exp12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index e0b3ba4..69bf721 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -13,6 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Optionally test a Python API here as well.
+load_lib gdb-python.exp
+
standard_testfile jit-reader-host.c
if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is_lp64_target] } {
@@ -265,6 +268,15 @@ proc jit_reader_test {} {
"#1 ${any} in main ${any}" \
]
}
+
+ if {![skip_python_tests]} {
+ gdb_test "python print(any(\[not x.is_file for x in gdb.objfiles()\]))" \
+ "True" \
+ "at least one non-file objfile"
+ gdb_test "python print(any(\[x.is_file for x in gdb.objfiles()\]))" \
+ "True" \
+ "at least one file-based objfile"
+ }
}
jit_reader_test