diff options
author | Tom Tromey <tromey@redhat.com> | 2001-12-21 22:32:37 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2001-12-21 22:32:37 +0000 |
commit | 58d370e0e6b0b1cc1df5b587ca39a14e975f5850 (patch) | |
tree | a9f4b92ec61a2199bbe1ee7d60063c67ce99263c /gdb/symtab.c | |
parent | a532ca62825cc3e09712af03d0dfaaf4ae96ffbf (diff) | |
download | gdb-58d370e0e6b0b1cc1df5b587ca39a14e975f5850.zip gdb-58d370e0e6b0b1cc1df5b587ca39a14e975f5850.tar.gz gdb-58d370e0e6b0b1cc1df5b587ca39a14e975f5850.tar.bz2 |
* configure, config.in: Rebuilt.
* configure.in: Check for realpath.
* defs.h (gdb_realpath): Declare.
* symtab.h (partial_symtab): Added fullname field.
* source.c (openp): Use gdb_realpath.
(forget_cached_source_info): Clear full name of each partial
symtab.
* utils.c (gdb_realpath): New function.
* symtab.c (lookup_symtab): Removed.
(lookup_symtab_1): Renamed to lookup_symtab.
(lookup_symtab): Look for real path.
(lookup_partial_symtab): Likewise.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index d11daba..2353ae5 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -141,14 +141,38 @@ lookup_symtab (const char *name) register struct symtab *s; register struct partial_symtab *ps; register struct objfile *objfile; + 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); got_symtab: /* First, search for an exact match */ ALL_SYMTABS (objfile, s) + { if (FILENAME_CMP (name, s->filename) == 0) - return s; + { + 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 (real_path != NULL) + { + char *rp = symtab_to_filename (s); + 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) */ @@ -195,15 +219,37 @@ lookup_partial_symtab (const char *name) { register struct partial_symtab *pst; register struct objfile *objfile; + 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); 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 (pst->fullname == NULL) + source_full_path_of (pst->filename, &pst->fullname); + if (pst->fullname != NULL + && FILENAME_CMP (real_path, pst->fullname) == 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) |