aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-01-27 10:13:52 -0800
committerDoug Evans <dje@google.com>2015-01-27 10:13:52 -0800
commit3a8b707add581af37804947536025dd3e7fc1a33 (patch)
tree20c64055757dbd442dd4188b7d00d204fd719685 /gdb/testsuite/gdb.python
parent1b5493961ab1f65a3336b2178ba3d035a130f9f6 (diff)
downloadgdb-3a8b707add581af37804947536025dd3e7fc1a33.zip
gdb-3a8b707add581af37804947536025dd3e7fc1a33.tar.gz
gdb-3a8b707add581af37804947536025dd3e7fc1a33.tar.bz2
Add gdb.Objfile.username.
gdb/ChangeLog: * NEWS: Mention gdb.Objfile.username. * python/py-objfile.c (objfpy_get_username): New function. (objfile_getset): Add "username". gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.username. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Add tests for objfile.username. Add test for objfile.filename, objfile.username after objfile has been unloaded.
Diffstat (limited to 'gdb/testsuite/gdb.python')
-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"