/* Make the default place to list be the function `main'
if one exists. */
- if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0, NULL))
+ if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0))
{
sals = decode_line_spec (main_name (), 1);
sal = sals.sals[0];
/* FIXME, this goes to "delete dir"... */
if (dirname == 0)
{
- if (from_tty && query (_("Reinitialize source path to empty? ")))
+ if (!from_tty || query (_("Reinitialize source path to empty? ")))
{
xfree (source_path);
init_source_path ();
DIRNAME is the compilation directory of a particular source file.
Only some debug formats provide this info.
FULLNAME can be the last known absolute path to the file in question.
+ Space for the path must have been malloc'd. If a path substitution
+ is applied we free the old value and set a new one.
On Success
A valid file descriptor is returned. ( the return value is positive )
FULLNAME is set to the absolute path to the file just opened.
+ The caller is responsible for freeing FULLNAME.
On Failure
An invalid file descriptor is returned. ( the return value is negative )
FULLNAME is set to NULL. */
-int
+
+static int
find_and_open_source (struct objfile *objfile,
const char *filename,
const char *dirname,
strcat (path + len, source_path + len + cdir_len); /* After $cdir */
}
}
- else
+
+ if (IS_ABSOLUTE_PATH (filename))
{
- /* If dirname is NULL, chances are the path is embedded in
- the filename. Try the source path substitution on it. */
+ /* If filename is absolute path, try the source path
+ substitution on it. */
char *rewritten_filename = rewrite_source_path (filename);
if (rewritten_filename != NULL)
result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, 0, fullname);
}
- if (result >= 0)
- {
- char *tmp_fullname;
- tmp_fullname = *fullname;
- *fullname = xstrdup (tmp_fullname);
- xfree (tmp_fullname);
- }
return result;
}
/* Finds the fullname that a symtab represents.
- If this functions finds the fullname, it will save it in ps->fullname
+ If this functions finds the fullname, it will save it in s->fullname
and it will also return the value.
If this function fails to find the file that this symtab represents,
- NULL will be returned and ps->fullname will be set to NULL. */
+ NULL will be returned and s->fullname will be set to NULL. */
char *
symtab_to_fullname (struct symtab *s)
{
perror_with_name (s->filename);
if (s->objfile && s->objfile->obfd)
- mtime = bfd_get_mtime (s->objfile->obfd);
+ mtime = s->objfile->mtime;
else if (exec_bfd)
- mtime = bfd_get_mtime (exec_bfd);
+ mtime = exec_bfd_mtime;
if (mtime && mtime < st.st_mtime)
warning (_("Source file is more recent than executable."));
}
\f
/* Show source lines from the file of symtab S, starting with line
- number LINE and stopping before line number STOPLINE. If this is the
+ number LINE and stopping before line number STOPLINE. If this is
not the command line version, then the source is shown in the source
window otherwise it is simply printed */