diff options
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/record-full.c | 24 | ||||
-rw-r--r-- | gdb/record.c | 18 | ||||
-rw-r--r-- | gdb/record.h | 4 | ||||
-rw-r--r-- | gdb/target-delegates.c | 8 | ||||
-rw-r--r-- | gdb/target.h | 4 |
6 files changed, 47 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5ebae5e..49d41fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 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. * m32r-rom.c (m32r_load_gen): Make "filename" const. * monitor.c (monitor_load): Make "args" const. diff --git a/gdb/record-full.c b/gdb/record-full.c index a496cf3..fcd7790 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1703,7 +1703,8 @@ record_full_can_execute_reverse (struct target_ops *self) /* "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) { char *ret = NULL; @@ -1727,9 +1728,10 @@ record_full_get_bookmark (struct target_ops *self, char *args, int from_tty) 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, @@ -1737,18 +1739,20 @@ record_full_goto_bookmark (struct target_ops *self, if (bookmark[0] == '\'' || bookmark[0] == '\"') { + char *copy; + 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 diff --git a/gdb/record.c b/gdb/record.c index b801b7f..acdbc1a 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -311,13 +311,10 @@ cmd_record_save (char *args, int from_tty) 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. */ +/* See record.h. */ void -cmd_record_goto (char *arg, int from_tty) +record_goto (const char *arg) { ULONGEST insn; @@ -330,6 +327,17 @@ cmd_record_goto (char *arg, int from_tty) 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 diff --git a/gdb/record.h b/gdb/record.h index 29784ad..702d7b6 100644 --- a/gdb/record.h +++ b/gdb/record.h @@ -53,8 +53,8 @@ extern int record_read_memory (struct gdbarch *gdbarch, 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); diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 38ca2b4..eac7018 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -742,27 +742,27 @@ delegate_make_corefile_notes (struct target_ops *self, bfd *arg1, int *arg2) } static gdb_byte * -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 * -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 -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 -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) { tcomplain (); } diff --git a/gdb/target.h b/gdb/target.h index a0a0d30..d0601b8 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -596,10 +596,10 @@ struct target_ops 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 */ - 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 |