However, taking a closer look at gdb/cli/cli-cmds.c, I think further changes need to be made to remove all possibility of a crash. The behaviour of source_script_with_search() looks rather unusual in the para-phrased snippet below (my comments prefixed by '/* XXX: '):
#-----------------------------------
old_cleanups = make_cleanup (xfree, full_path);
make_cleanup_fclose (stream);
if (stream == NULL)
{
/* XXX: since a cleanup was added for 'stream' before checking it opened correctly, this appears to *guarantee* a crash if it didn't */
}
if (from_tty == -1)
{
/* XXX: ? this is already been done above */
make_cleanup_fclose (stream);
}
#-----------------------------------
I agree with Dave's comments in #3.
However, taking a closer look at gdb/cli/cli-cmds.c, I think further changes need to be made to remove all possibility of a crash. The behaviour of source_ script_ with_search( ) looks rather unusual in the para-phrased snippet below (my comments prefixed by '/* XXX: '):
#------ ------- ------- ------- ------- -
old_cleanups = make_cleanup (xfree, full_path);
make_cleanup_fclose (stream);
if (stream == NULL)
{
/* XXX: since a cleanup was added for 'stream' before checking it opened correctly, this appears to *guarantee* a crash if it didn't */
}
if (from_tty == -1) cleanup_ fclose (stream); ------- ------- ------- ------- -
{
/* XXX: ? this is already been done above */
make_
}
#------