aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-objfile.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python/py-objfile.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-objfile.exp18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index cddbd3d..b53f5e3 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -42,6 +42,9 @@ gdb_py_test_silent_cmd "python objfile = sym\[0\].symtab.objfile" \
gdb_test "python print (objfile.filename)" "${testfile}" \
"Get objfile file name"
+gdb_test "python print (objfile.username)" "${testfile}" \
+ "Get objfile user name"
+
gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").filename)" \
"${testfile}"
gdb_test "python print (gdb.lookup_objfile (\"junk\"))" \
@@ -78,6 +81,18 @@ gdb_py_test_silent_cmd "python objfile.random_attribute = 42" \
gdb_test "python print (objfile.random_attribute)" "42" \
"Verify set of random attribute in objfile"
+# Verify invalid objfile handling.
+
+if { [gdb_unload] < 0 } {
+ fail "unload all files"
+ return -1
+}
+
+gdb_test "python print objfile.filename" "None" \
+ "objfile.filename after objfile is unloaded"
+gdb_test "python print objfile.username" "None" \
+ "objfile.username after objfile is unloaded"
+
# Now build another copy of the testcase, this time without debug info.
if { [prepare_for_testing ${testfile}.exp ${testfile}2 ${srcfile} {nodebug ldflags=-Wl,--strip-debug}] } {
@@ -107,6 +122,9 @@ gdb_py_test_silent_cmd "python sep_objfile = gdb.objfiles()\[0\]" \
gdb_test "python print (sep_objfile.owner.filename)" "${testfile}2" \
"Test owner of separate debug file"
+gdb_test "python print (sep_objfile.owner.username)" "${testfile}2" \
+ "Test user-name of owner of separate debug file"
+
gdb_test "p main" "= {int \\(\\)} $hex <main>" \
"print main with debug info"