/* Core dump and executable file functions above target vector, for GDB.
- Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 1986-2020 Free Software Foundation, Inc.
This file is part of GDB.
#include "completer.h"
#include "observable.h"
#include "cli/cli-utils.h"
+#include "gdbarch.h"
/* You can have any number of hooks for `exec_file_command' command to
call. If there's only one hook, it is set in exec_file_display
/* See gdbsupport/common-inferior.h. */
-char *
+const char *
get_exec_file (int err)
{
- if (exec_filename)
- return exec_filename;
+ if (current_program_space->exec_filename != nullptr)
+ return current_program_space->exec_filename.get ();
if (!err)
return NULL;
error (_("No executable file specified.\n\
Use the \"file\" or \"exec-file\" command."));
- return NULL;
}
\f
return extract_unsigned_integer (buf, len, byte_order);
}
-void
-read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
-{
- char *cp;
- int i;
- int cnt;
-
- cp = buffer;
- while (1)
- {
- if (cp - buffer >= max_len)
- {
- buffer[max_len - 1] = '\0';
- break;
- }
- cnt = max_len - (cp - buffer);
- if (cnt > 8)
- cnt = 8;
- read_memory (memaddr + (int) (cp - buffer), (gdb_byte *) cp, cnt);
- for (i = 0; i < cnt && *cp; i++, cp++)
- ; /* null body */
-
- if (i < cnt && !*cp)
- break;
- }
-}
-
CORE_ADDR
read_memory_typed_address (CORE_ADDR addr, struct type *type)
{
\f
/* The current default bfd target. Points to storage allocated for
gnutarget_string. */
-char *gnutarget;
+const char *gnutarget;
/* Same thing, except it is "auto" not NULL for the default case. */
static char *gnutarget_string;
void
set_gnutarget (const char *newtarget)
{
- if (gnutarget_string != NULL)
- xfree (gnutarget_string);
+ xfree (gnutarget_string);
gnutarget_string = xstrdup (newtarget);
set_gnutarget_command (NULL, 0, NULL);
}
+void _initialize_core ();
void
-_initialize_core (void)
+_initialize_core ()
{
struct cmd_list_element *c;