aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2002-04-05 16:42:04 +0000
committerJoel Brobecker <brobecker@gnat.com>2002-04-05 16:42:04 +0000
commitf079a2e599ced3a094c9b70fb38cb9bdf9d746d1 (patch)
tree39d68429a6fc07971396c83fb0b4bcce570fdf0e /gdb/symtab.c
parenta89f66e45baa2c50abda9b316fe0c93c3168045e (diff)
downloadgdb-f079a2e599ced3a094c9b70fb38cb9bdf9d746d1.zip
gdb-f079a2e599ced3a094c9b70fb38cb9bdf9d746d1.tar.gz
gdb-f079a2e599ced3a094c9b70fb38cb9bdf9d746d1.tar.bz2
(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.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c59
1 files changed, 46 insertions, 13 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index bf6df51..e32dcf7 100644
--- a/gdb/symtab.c
+++ b/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,36 +235,55 @@ 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)
{
- xfree (real_path);
return pst;
}
}
- }
- xfree (real_path);
+ 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)
+ {
+ return pst;
+ }
+ }
+ }
/* Now, search for a matching tail (only if name doesn't have any dirs) */