(lookup_symtab): Use the new xfullpath function, in order to be able to
match a filename with either the real filename, or the name of any symbolic link to this file. (lookup_partial_symtab): Ditto.
This commit is contained in:
parent
a89f66e45b
commit
f079a2e599
1 changed files with 46 additions and 13 deletions
59
gdb/symtab.c
59
gdb/symtab.c
|
@ -144,11 +144,17 @@ lookup_symtab (const char *name)
|
|||
register struct partial_symtab *ps;
|
||||
register struct objfile *objfile;
|
||||
char *real_path = NULL;
|
||||
char *full_path = NULL;
|
||||
|
||||
/* Here we are interested in canonicalizing an absolute path, not
|
||||
absolutizing a relative path. */
|
||||
if (IS_ABSOLUTE_PATH (name))
|
||||
real_path = gdb_realpath (name);
|
||||
{
|
||||
full_path = xfullpath (name);
|
||||
make_cleanup (xfree, full_path);
|
||||
real_path = gdb_realpath (name);
|
||||
make_cleanup (xfree, real_path);
|
||||
}
|
||||
|
||||
got_symtab:
|
||||
|
||||
|
@ -158,24 +164,32 @@ got_symtab:
|
|||
{
|
||||
if (FILENAME_CMP (name, s->filename) == 0)
|
||||
{
|
||||
xfree (real_path);
|
||||
return s;
|
||||
}
|
||||
|
||||
/* If the user gave us an absolute path, try to find the file in
|
||||
this symtab and use its absolute path. */
|
||||
|
||||
if (full_path != NULL)
|
||||
{
|
||||
const char *fp = symtab_to_filename (s);
|
||||
if (FILENAME_CMP (full_path, fp) == 0)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
if (real_path != NULL)
|
||||
{
|
||||
char *rp = symtab_to_filename (s);
|
||||
const char *rp = gdb_realpath (symtab_to_filename (s));
|
||||
make_cleanup (xfree, rp);
|
||||
if (FILENAME_CMP (real_path, rp) == 0)
|
||||
{
|
||||
xfree (real_path);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xfree (real_path);
|
||||
|
||||
/* Now, search for a matching tail (only if name doesn't have any dirs) */
|
||||
|
||||
if (lbasename (name) == name)
|
||||
|
@ -221,37 +235,56 @@ lookup_partial_symtab (const char *name)
|
|||
{
|
||||
register struct partial_symtab *pst;
|
||||
register struct objfile *objfile;
|
||||
char *full_path = NULL;
|
||||
char *real_path = NULL;
|
||||
|
||||
/* Here we are interested in canonicalizing an absolute path, not
|
||||
absolutizing a relative path. */
|
||||
if (IS_ABSOLUTE_PATH (name))
|
||||
real_path = gdb_realpath (name);
|
||||
{
|
||||
full_path = xfullpath (name);
|
||||
make_cleanup (xfree, full_path);
|
||||
real_path = gdb_realpath (name);
|
||||
make_cleanup (xfree, real_path);
|
||||
}
|
||||
|
||||
ALL_PSYMTABS (objfile, pst)
|
||||
{
|
||||
if (FILENAME_CMP (name, pst->filename) == 0)
|
||||
{
|
||||
xfree (real_path);
|
||||
return (pst);
|
||||
}
|
||||
|
||||
/* If the user gave us an absolute path, try to find the file in
|
||||
this symtab and use its absolute path. */
|
||||
if (real_path != NULL)
|
||||
if (full_path != NULL)
|
||||
{
|
||||
if (pst->fullname == NULL)
|
||||
source_full_path_of (pst->filename, &pst->fullname);
|
||||
if (pst->fullname != NULL
|
||||
&& FILENAME_CMP (real_path, pst->fullname) == 0)
|
||||
&& FILENAME_CMP (full_path, pst->fullname) == 0)
|
||||
{
|
||||
return pst;
|
||||
}
|
||||
}
|
||||
|
||||
if (real_path != NULL)
|
||||
{
|
||||
char *rp = NULL;
|
||||
if (pst->fullname == NULL)
|
||||
source_full_path_of (pst->filename, &pst->fullname);
|
||||
if (pst->fullname != NULL)
|
||||
{
|
||||
rp = gdb_realpath (pst->fullname);
|
||||
make_cleanup (xfree, rp);
|
||||
}
|
||||
if (rp != NULL && FILENAME_CMP (real_path, rp) == 0)
|
||||
{
|
||||
xfree (real_path);
|
||||
return pst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xfree (real_path);
|
||||
|
||||
/* Now, search for a matching tail (only if name doesn't have any dirs) */
|
||||
|
||||
if (lbasename (name) == name)
|
||||
|
|
Loading…
Reference in a new issue