diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-09-07 11:18:16 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-09-28 15:33:13 +0100 |
commit | 5ce85461a143e0d564b6dfa6407374851899d491 (patch) | |
tree | b3491a93a686d78c5d00090781ccc450abff6d4d /gdb/testsuite | |
parent | ce65386db6653171334434ae488a0c0e10a60871 (diff) | |
download | gdb-5ce85461a143e0d564b6dfa6407374851899d491.zip gdb-5ce85461a143e0d564b6dfa6407374851899d491.tar.gz gdb-5ce85461a143e0d564b6dfa6407374851899d491.tar.bz2 |
gdb/python: new Progspace.symbol_file attribute
Add a new Progspace.symbol_file attribute. This attribute holds the
gdb.Objfile object that corresponds to Progspace.filename, or None if
there is no main symbol file currently set.
Currently, to get this gdb.Objfile, a user would need to use
Progspace.objfiles, and then search for the objfile with a name that
matches Progspace.filename -- which should work just fine, but having
direct access seems a little nicer.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.python/py-progspace.exp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp index f0dc208..befd643 100644 --- a/gdb/testsuite/gdb.python/py-progspace.exp +++ b/gdb/testsuite/gdb.python/py-progspace.exp @@ -30,6 +30,8 @@ clean_restart gdb_test "python print (gdb.current_progspace().filename)" "None" \ "current progspace filename (None)" +gdb_test "python print (gdb.current_progspace().symbol_file)" "None" \ + "current progspace symbol_file is None" gdb_test "python print (gdb.progspaces())" "\\\[<gdb.Progspace object at $hex>\\\]" gdb_test_no_output "python dir(gdb.current_progspace())" @@ -42,6 +44,10 @@ gdb_py_test_silent_cmd "python progspace = gdb.current_progspace()" \ gdb_test "python print (progspace.filename)" "py-progspace" \ "current progspace filename (py-progspace)" +gdb_test "python print (gdb.current_progspace().symbol_file)" \ + "<gdb.Objfile filename=.*/py-progspace>" \ + "current progspace symbol_file is set correctly" + gdb_py_test_silent_cmd "python progspace.random_attribute = 42" \ "Set random attribute in progspace" 1 gdb_test "python print (progspace.random_attribute)" "42" \ @@ -100,3 +106,6 @@ gdb_test "inferior 1" "Switching to inferior 1.*" gdb_test_no_output "remove-inferiors 2" gdb_test "python print (progspace2.objfiles ())" \ "RuntimeError: Program space no longer exists.*" + +gdb_test "python print (progspace2.symbol_file)" \ + "RuntimeError: Program space no longer exists.*" |