aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-01-13 17:00:31 -0800
committerDoug Evans <dje@google.com>2015-01-13 17:02:53 -0800
commite02c96a79949824bbe1da22ddfc6b50d362fb552 (patch)
tree8703c754cef937d9fd90c9224327bc81f729f9fa /gdb/objfiles.c
parent8068939ab8058b48d0c7c318d463b0c6b85741fa (diff)
downloadgdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.zip
gdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.tar.gz
gdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.tar.bz2
Enhance gdb.lookup_objfile so that it works with a symlinked binary.
gdb/Changelog: * objfiles.c (objfile_filename): New function. * objfiles.h (objfile_filename): Declare it. (objfile_name): Add function comment. * python/py-objfile.c (objfpy_lookup_objfile_by_name): Try both the bfd file name (which may be realpath'd), and the original name. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Test gdb.lookup_objfile on symlinked binary.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index c397f68..ff20bc8 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1492,7 +1492,7 @@ default_iterate_over_objfiles_in_search_order
}
}
-/* Return canonical name for OBJFILE. */
+/* See objfiles.h. */
const char *
objfile_name (const struct objfile *objfile)
@@ -1506,6 +1506,17 @@ objfile_name (const struct objfile *objfile)
/* See objfiles.h. */
const char *
+objfile_filename (const struct objfile *objfile)
+{
+ if (objfile->obfd != NULL)
+ return bfd_get_filename (objfile->obfd);
+
+ return NULL;
+}
+
+/* See objfiles.h. */
+
+const char *
objfile_debug_name (const struct objfile *objfile)
{
return lbasename (objfile->original_name);