#include "defs.h"
#include "arch-utils.h"
-#include <string.h>
-#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#ifdef HAVE_SYS_FILE_H
#endif
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
+#include "infrun.h"
#include "symtab.h"
#include "command.h"
#include "bfd.h"
#include "symfile.h"
#include "exec.h"
#include "readline/readline.h"
-#include "gdb_assert.h"
#include "exceptions.h"
#include "solib.h"
#include "filenames.h"
static int gdb_check_format (bfd *);
-static void core_open (char *, int);
-
static void core_close (struct target_ops *self);
static void core_close_cleanup (void *ignore);
/* This routine opens and sets up the core file bfd. */
static void
-core_open (char *filename, int from_tty)
+core_open (const char *arg, int from_tty)
{
const char *p;
int siggy;
int scratch_chan;
int flags;
volatile struct gdb_exception except;
+ char *filename;
target_preopen (from_tty);
- if (!filename)
+ if (!arg)
{
if (core_bfd)
error (_("No core file specified. (Use `detach' "
error (_("No core file specified."));
}
- filename = tilde_expand (filename);
+ filename = tilde_expand (arg);
if (!IS_ABSOLUTE_PATH (filename))
{
temp = concat (current_directory, "/",
size = bfd_section_size (core_bfd, section);
if (offset >= size)
- return 0;
+ return TARGET_XFER_EOF;
size -= offset;
if (size > len)
size = len;
return TARGET_XFER_E_IO;
default:
- if (ops->beneath != NULL)
- return ops->beneath->to_xfer_partial (ops->beneath, object,
- annex, readbuf,
- writebuf, offset, len,
- xfered_len);
- return TARGET_XFER_E_IO;
+ return ops->beneath->to_xfer_partial (ops->beneath, object,
+ annex, readbuf,
+ writebuf, offset, len,
+ xfered_len);
}
}
/* Implement the to_info_proc method. */
static void
-core_info_proc (struct target_ops *ops, char *args, enum info_proc_what request)
+core_info_proc (struct target_ops *ops, const char *args,
+ enum info_proc_what request)
{
struct gdbarch *gdbarch = get_current_arch ();
"Use a core file as a target. Specify the filename of the core file.";
core_ops.to_open = core_open;
core_ops.to_close = core_close;
- core_ops.to_attach = find_default_attach;
core_ops.to_detach = core_detach;
core_ops.to_fetch_registers = get_core_registers;
core_ops.to_xfer_partial = core_xfer_partial;
core_ops.to_files_info = core_files_info;
core_ops.to_insert_breakpoint = ignore;
core_ops.to_remove_breakpoint = ignore;
- core_ops.to_create_inferior = find_default_create_inferior;
core_ops.to_thread_alive = core_thread_alive;
core_ops.to_read_description = core_read_description;
core_ops.to_pid_to_str = core_pid_to_str;