mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-10 09:59:06 +08:00
constify get_bookmark and goto_bookmark
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.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
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>
|
2014-06-26 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* defs.h (generic_load): Update.
|
* defs.h (generic_load): Update.
|
||||||
|
@ -1703,7 +1703,8 @@ record_full_can_execute_reverse (struct target_ops *self)
|
|||||||
/* "to_get_bookmark" method for process record and prec over core. */
|
/* "to_get_bookmark" method for process record and prec over core. */
|
||||||
|
|
||||||
static gdb_byte *
|
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;
|
char *ret = NULL;
|
||||||
|
|
||||||
@ -1727,9 +1728,10 @@ record_full_get_bookmark (struct target_ops *self, char *args, int from_tty)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
record_full_goto_bookmark (struct target_ops *self,
|
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)
|
if (record_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
@ -1737,18 +1739,20 @@ record_full_goto_bookmark (struct target_ops *self,
|
|||||||
|
|
||||||
if (bookmark[0] == '\'' || bookmark[0] == '\"')
|
if (bookmark[0] == '\'' || bookmark[0] == '\"')
|
||||||
{
|
{
|
||||||
|
char *copy;
|
||||||
|
|
||||||
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
|
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
|
||||||
error (_("Unbalanced quotes: %s"), bookmark);
|
error (_("Unbalanced quotes: %s"), bookmark);
|
||||||
|
|
||||||
/* Strip trailing quote. */
|
|
||||||
bookmark[strlen (bookmark) - 1] = '\0';
|
copy = savestring (bookmark + 1, strlen (bookmark) - 2);
|
||||||
/* Strip leading quote. */
|
make_cleanup (xfree, copy);
|
||||||
bookmark++;
|
bookmark = copy;
|
||||||
/* Pass along to cmd_record_full_goto. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_record_goto (bookmark, from_tty);
|
record_goto (bookmark);
|
||||||
return;
|
|
||||||
|
do_cleanups (cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum exec_direction_kind
|
static enum exec_direction_kind
|
||||||
|
18
gdb/record.c
18
gdb/record.c
@ -311,13 +311,10 @@ cmd_record_save (char *args, int from_tty)
|
|||||||
target_save_record (recfilename);
|
target_save_record (recfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "record goto" command. Argument is an instruction number,
|
/* See record.h. */
|
||||||
as given by "info record".
|
|
||||||
|
|
||||||
Rewinds the recording (forward or backward) to the given instruction. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_record_goto (char *arg, int from_tty)
|
record_goto (const char *arg)
|
||||||
{
|
{
|
||||||
ULONGEST insn;
|
ULONGEST insn;
|
||||||
|
|
||||||
@ -330,6 +327,17 @@ cmd_record_goto (char *arg, int from_tty)
|
|||||||
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. */
|
/* The "record goto begin" command. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -53,8 +53,8 @@ extern int record_read_memory (struct gdbarch *gdbarch,
|
|||||||
CORE_ADDR memaddr, gdb_byte *myaddr,
|
CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||||
ssize_t len);
|
ssize_t len);
|
||||||
|
|
||||||
/* The "record goto" command. */
|
/* A wrapper for target_goto_record that parses ARG as a number. */
|
||||||
extern void cmd_record_goto (char *arg, int from_tty);
|
extern void record_goto (const char *arg);
|
||||||
|
|
||||||
/* The default "to_disconnect" target method for record targets. */
|
/* The default "to_disconnect" target method for record targets. */
|
||||||
extern void record_disconnect (struct target_ops *, const char *, int);
|
extern void record_disconnect (struct target_ops *, const char *, int);
|
||||||
|
@ -742,27 +742,27 @@ delegate_make_corefile_notes (struct target_ops *self, bfd *arg1, int *arg2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gdb_byte *
|
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;
|
self = self->beneath;
|
||||||
return self->to_get_bookmark (self, arg1, arg2);
|
return self->to_get_bookmark (self, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gdb_byte *
|
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 ();
|
tcomplain ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 = self->beneath;
|
||||||
self->to_goto_bookmark (self, arg1, arg2);
|
self->to_goto_bookmark (self, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 ();
|
tcomplain ();
|
||||||
}
|
}
|
||||||
|
@ -596,10 +596,10 @@ struct target_ops
|
|||||||
char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
|
char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
|
||||||
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
|
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
|
||||||
/* get_bookmark support method for bookmarks */
|
/* 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 ());
|
TARGET_DEFAULT_NORETURN (tcomplain ());
|
||||||
/* goto_bookmark support method for bookmarks */
|
/* 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 ());
|
TARGET_DEFAULT_NORETURN (tcomplain ());
|
||||||
/* Return the thread-local address at OFFSET in the
|
/* Return the thread-local address at OFFSET in the
|
||||||
thread-local storage for the thread PTID and the shared library
|
thread-local storage for the thread PTID and the shared library
|
||||||
|
Reference in New Issue
Block a user