From 99298c958c5393402cd2bc2885c195838a9dd363 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 20 Jun 2022 12:32:52 -0600 Subject: 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. --- gdb/testsuite/gdb.base/jit-reader.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gdb/testsuite') 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 . +# 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 -- cgit v1.1