Record objfile->original_name as an absolute path

gdb/
2013-12-02  Doug Evans  <dje@google.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	* objfiles.c (allocate_objfile): Save original_name as an absolute
	path.
	* objfiles.h (struct objfile): Expand comment on original_name.
	* source.c (openp): Call gdb_abspath.
	* utils.c (gdb_abspath): New function.
	* utils.h (gdb_abspath): Declare.

gdb/testsuite/
2013-12-02  Doug Evans  <dje@google.com>

	* gdb.dwarf/dwp-symlink.c: Fake out gdb to not load debug info
	at start.
	* gdb.dwarf/dwp-symlink.exp: Test trying to load dwp when the binary
	has been specified with a relative path and we have chdir'd before
	accessing the debug info.
This commit is contained in:
Jan Kratochvil
2013-12-02 22:24:32 +01:00
parent aee4bf8505
commit 04affae3ef
9 changed files with 94 additions and 26 deletions

View File

@ -272,6 +272,7 @@ struct objfile *
allocate_objfile (bfd *abfd, const char *name, int flags)
{
struct objfile *objfile;
char *expanded_name;
objfile = (struct objfile *) xzalloc (sizeof (struct objfile));
objfile->psymbol_cache = psymbol_bcache_init ();
@ -286,10 +287,20 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
{
gdb_assert (abfd == NULL);
gdb_assert ((flags & OBJF_NOT_FILENAME) != 0);
name = "<<anonymous objfile>>";
expanded_name = xstrdup ("<<anonymous objfile>>");
}
objfile->original_name = obstack_copy0 (&objfile->objfile_obstack, name,
strlen (name));
else if ((flags & OBJF_NOT_FILENAME) != 0)
expanded_name = xstrdup (name);
else
expanded_name = gdb_abspath (name);
objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
expanded_name,
strlen (expanded_name));
xfree (expanded_name);
/* Update the per-objfile information that comes from the bfd, ensuring
that any data that is reference is saved in the per-objfile data
region. */
/* Update the per-objfile information that comes from the bfd, ensuring
that any data that is reference is saved in the per-objfile data