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.
This commit is contained in:
Doug Evans 2015-01-13 17:00:31 -08:00
parent 8068939ab8
commit e02c96a799
6 changed files with 52 additions and 2 deletions

View file

@ -438,12 +438,18 @@ objfpy_lookup_objfile_by_name (const char *name)
ALL_OBJFILES (objfile)
{
const char *filename;
if ((objfile->flags & OBJF_NOT_FILENAME) != 0)
continue;
/* Don't return separate debug files. */
if (objfile->separate_debug_objfile_backlink != NULL)
continue;
if (compare_filenames_for_search (objfile_name (objfile), name))
filename = objfile_filename (objfile);
if (filename != NULL && compare_filenames_for_search (filename, name))
return objfile;
if (compare_filenames_for_search (objfile->original_name, name))
return objfile;
}