This makes arguments to to_get_bookmark and to_goto_bookmark const and
fixes the fallout. Tested by rebuilding. The only thing of note is
the new split between cmd_record_goto and record_goto -- basically
separating the CLI function from a new internal API, to allow const
propagation.
2014-06-26 Tom Tromey <tromey@redhat.com>
* record-full.c (record_full_get_bookmark): Make "args" const.
(record_full_goto_bookmark): Make "raw_bookmark" const.
* record.c (record_goto): New function.
(cmd_record_goto): Use it. Now static.
* record.h (record_goto): Declare.
(cmd_record_goto): Remove declaration.
* target-delegates.c: Rebuild.
* target.h (struct target_ops) <to_get_bookmark,
to_goto_bookmark>: Make parameter const.
+2014-06-26 Tom Tromey <tromey@redhat.com>
+
+ * record-full.c (record_full_get_bookmark): Make "args" const.
+ (record_full_goto_bookmark): Make "raw_bookmark" const.
+ * record.c (record_goto): New function.
+ (cmd_record_goto): Use it. Now static.
+ * record.h (record_goto): Declare.
+ (cmd_record_goto): Remove declaration.
+ * target-delegates.c: Rebuild.
+ * target.h (struct target_ops) <to_get_bookmark,
+ to_goto_bookmark>: Make parameter const.
+
2014-06-26 Tom Tromey <tromey@redhat.com>
* defs.h (generic_load): Update.
2014-06-26 Tom Tromey <tromey@redhat.com>
* defs.h (generic_load): Update.
/* "to_get_bookmark" method for process record and prec over core. */
static gdb_byte *
/* "to_get_bookmark" method for process record and prec over core. */
static gdb_byte *
-record_full_get_bookmark (struct target_ops *self, char *args, int from_tty)
+record_full_get_bookmark (struct target_ops *self, const char *args,
+ int from_tty)
static void
record_full_goto_bookmark (struct target_ops *self,
static void
record_full_goto_bookmark (struct target_ops *self,
- gdb_byte *raw_bookmark, int from_tty)
+ const gdb_byte *raw_bookmark, int from_tty)
- char *bookmark = (char *) raw_bookmark;
+ const char *bookmark = (const char *) raw_bookmark;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
if (bookmark[0] == '\'' || bookmark[0] == '\"')
{
if (bookmark[0] == '\'' || bookmark[0] == '\"')
{
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
error (_("Unbalanced quotes: %s"), bookmark);
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
error (_("Unbalanced quotes: %s"), bookmark);
- /* Strip trailing quote. */
- bookmark[strlen (bookmark) - 1] = '\0';
- /* Strip leading quote. */
- bookmark++;
- /* Pass along to cmd_record_full_goto. */
+
+ copy = savestring (bookmark + 1, strlen (bookmark) - 2);
+ make_cleanup (xfree, copy);
+ bookmark = copy;
- cmd_record_goto (bookmark, from_tty);
- return;
+ record_goto (bookmark);
+
+ do_cleanups (cleanup);
}
static enum exec_direction_kind
}
static enum exec_direction_kind
target_save_record (recfilename);
}
target_save_record (recfilename);
}
-/* "record goto" command. Argument is an instruction number,
- as given by "info record".
-
- Rewinds the recording (forward or backward) to the given instruction. */
-cmd_record_goto (char *arg, int from_tty)
+record_goto (const char *arg)
target_goto_record (insn);
}
target_goto_record (insn);
}
+/* "record goto" command. Argument is an instruction number,
+ as given by "info record".
+
+ Rewinds the recording (forward or backward) to the given instruction. */
+
+static void
+cmd_record_goto (char *arg, int from_tty)
+{
+ record_goto (arg);
+}
+
/* The "record goto begin" command. */
static void
/* The "record goto begin" command. */
static void
CORE_ADDR memaddr, gdb_byte *myaddr,
ssize_t len);
CORE_ADDR memaddr, gdb_byte *myaddr,
ssize_t len);
-/* The "record goto" command. */
-extern void cmd_record_goto (char *arg, int from_tty);
+/* A wrapper for target_goto_record that parses ARG as a number. */
+extern void record_goto (const char *arg);
/* The default "to_disconnect" target method for record targets. */
extern void record_disconnect (struct target_ops *, const char *, int);
/* The default "to_disconnect" target method for record targets. */
extern void record_disconnect (struct target_ops *, const char *, int);
-delegate_get_bookmark (struct target_ops *self, char *arg1, int arg2)
+delegate_get_bookmark (struct target_ops *self, const char *arg1, int arg2)
{
self = self->beneath;
return self->to_get_bookmark (self, arg1, arg2);
}
static gdb_byte *
{
self = self->beneath;
return self->to_get_bookmark (self, arg1, arg2);
}
static gdb_byte *
-tdefault_get_bookmark (struct target_ops *self, char *arg1, int arg2)
+tdefault_get_bookmark (struct target_ops *self, const char *arg1, int arg2)
{
tcomplain ();
}
static void
{
tcomplain ();
}
static void
-delegate_goto_bookmark (struct target_ops *self, gdb_byte *arg1, int arg2)
+delegate_goto_bookmark (struct target_ops *self, const gdb_byte *arg1, int arg2)
{
self = self->beneath;
self->to_goto_bookmark (self, arg1, arg2);
}
static void
{
self = self->beneath;
self->to_goto_bookmark (self, arg1, arg2);
}
static void
-tdefault_goto_bookmark (struct target_ops *self, gdb_byte *arg1, int arg2)
+tdefault_goto_bookmark (struct target_ops *self, const gdb_byte *arg1, int arg2)
char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
/* get_bookmark support method for bookmarks */
char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
/* get_bookmark support method for bookmarks */
- gdb_byte * (*to_get_bookmark) (struct target_ops *, char *, int)
+ gdb_byte * (*to_get_bookmark) (struct target_ops *, const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* goto_bookmark support method for bookmarks */
TARGET_DEFAULT_NORETURN (tcomplain ());
/* goto_bookmark support method for bookmarks */
- void (*to_goto_bookmark) (struct target_ops *, gdb_byte *, int)
+ void (*to_goto_bookmark) (struct target_ops *, const gdb_byte *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library