/* Core dump and executable file functions above target vector, for GDB.
- Copyright 1986, 1987, 1989, 1991-1994, 2000
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
+ 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
-#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "symtab.h"
#include "command.h"
#include "target.h"
#include "gdbcore.h"
#include "dis-asm.h"
-#include "language.h"
#include "gdb_stat.h"
-#include "symfile.h"
-#include "objfiles.h"
+#include "completer.h"
/* Local function declarations. */
dont_repeat (); /* Either way, seems bogus. */
t = find_core_target ();
- if (t != NULL)
- if (!filename)
- (t->to_detach) (filename, from_tty);
- else
- {
- /* Yes, we were given the path of a core file. Do we already
- have a symbol file? If not, can we determine it from the
- core file? If we can, do so.
- */
-#ifdef HPUXHPPA
- if (symfile_objfile == NULL)
- {
- char *symfile;
- symfile = t->to_core_file_to_sym_file (filename);
- if (symfile)
- {
- char *symfile_copy = xstrdup (symfile);
-
- make_cleanup (free, symfile_copy);
- symbol_file_command (symfile_copy, from_tty);
- }
- else
- warning ("Unknown symbols for '%s'; use the 'symbol-file' command.", filename);
- }
-#endif
- (t->to_open) (filename, from_tty);
- }
- else
+ if (t == NULL)
error ("GDB can't read core files on this machine.");
+
+ if (!filename)
+ (t->to_detach) (filename, from_tty);
+ else
+ (t->to_open) (filename, from_tty);
}
\f
This is called from the x-window display code. */
void
-specify_exec_file_hook (hook)
- void (*hook) (char *);
+specify_exec_file_hook (void (*hook) (char *))
{
hook_type *new_array;
/* If the timestamp of the exec file has changed, reopen it. */
filename = xstrdup (bfd_get_filename (exec_bfd));
- make_cleanup (free, filename);
+ make_cleanup (xfree, filename);
mtime = bfd_get_mtime (exec_bfd);
res = stat (filename, &st);
if (mtime && mtime != st.st_mtime)
- exec_file_command (filename, 0);
+ {
+ exec_open (filename, 0);
+ }
#endif
}
\f
print_address (addr, info->stream);
}
-/* Same as target_write_memory, but report an error if can't write. */
-void
-write_memory (CORE_ADDR memaddr, char *myaddr, int len)
-{
- int status;
-
- status = target_write_memory (memaddr, myaddr, len);
- if (status != 0)
- memory_error (status, memaddr);
-}
-
/* Read an integer from debugged memory, given address and number of bytes. */
LONGEST
break;
}
}
+
+/* Same as target_write_memory, but report an error if can't write. */
+void
+write_memory (CORE_ADDR memaddr, char *myaddr, int len)
+{
+ int status;
+
+ status = target_write_memory (memaddr, myaddr, len);
+ if (status != 0)
+ memory_error (status, memaddr);
+}
+
+/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
+void
+write_memory_unsigned_integer (CORE_ADDR addr, int len, ULONGEST value)
+{
+ char *buf = alloca (len);
+ store_unsigned_integer (buf, len, value);
+ write_memory (addr, buf, len);
+}
+
+/* Store VALUE at ADDR in the inferior as a LEN-byte signed integer. */
+void
+write_memory_signed_integer (CORE_ADDR addr, int len, LONGEST value)
+{
+ char *buf = alloca (len);
+ store_signed_integer (buf, len, value);
+ write_memory (addr, buf, len);
+}
+
\f
#if 0
if the protocol has a less general search function, they can call this
in the cases it can't handle. */
void
-generic_search (len, data, mask, startaddr, increment, lorange, hirange
- addr_found, data_found)
- int len;
- char *data;
- char *mask;
- CORE_ADDR startaddr;
- int increment;
- CORE_ADDR lorange;
- CORE_ADDR hirange;
- CORE_ADDR *addr_found;
- char *data_found;
+generic_search (int len, char *data, char *mask, CORE_ADDR startaddr,
+ int increment, CORE_ADDR lorange, CORE_ADDR hirange,
+ CORE_ADDR *addr_found, char *data_found)
{
int i;
CORE_ADDR curaddr = startaddr;
set_gnutarget (char *newtarget)
{
if (gnutarget_string != NULL)
- free (gnutarget_string);
+ xfree (gnutarget_string);
gnutarget_string = savestring (newtarget, strlen (newtarget));
set_gnutarget_command (NULL, 0, NULL);
}