#include <stdio.h>
#include <errno.h>
#include <signal.h>
+#include <fcntl.h>
#include "defs.h"
#include "param.h"
#include "frame.h" /* required by inferior.h */
int
solib_add_stub (from_tty)
- int from_tty;
+ char *from_tty;
{
- SOLIB_ADD (NULL, from_tty, &core_ops);
+ SOLIB_ADD (NULL, (int)from_tty, &core_ops);
return 0;
}
#endif /* SOLIB_ADD */
char *temp;
bfd *temp_bfd;
int ontop;
+ int scratch_chan;
target_preopen (from_tty);
if (!filename)
}
old_chain = make_cleanup (free, filename);
- temp_bfd = bfd_openr (filename, NULL);
+
+ scratch_chan = open (filename, write_files? O_RDWR: O_RDONLY, 0);
+ if (scratch_chan < 0)
+ perror_with_name (filename);
+
+ temp_bfd = bfd_fdopenr (filename, NULL, scratch_chan);
if (temp_bfd == NULL)
{
perror_with_name (filename);
/* Add symbols and section mappings for any shared libraries */
#ifdef SOLIB_ADD
- (void) catch_errors (solib_add_stub, from_tty, (char *)0);
+ (void) catch_errors (solib_add_stub, (char *)from_tty, (char *)0);
#endif
/* Now, set up the frame cache, and print the top of stack */
set_current_frame ( create_new_frame (read_register (FP_REGNUM),
{
if (exec_bfd && core_bfd)
{
- if (core_file_matches_executable_p (core_bfd, exec_bfd))
- printf ("Warning: core file does not match specified executable file.\n");
+ if (!core_file_matches_executable_p (core_bfd, exec_bfd))
+ printf ("Warning: core file may not match specified executable file.\n");
else if (bfd_get_mtime(exec_bfd) > bfd_get_mtime(core_bfd))
printf ("Warning: exec file is newer than core file.\n");
}