forked from Imagelibrary/binutils-gdb
2009-07-25 Michael Snyder <msnyder@vmware.com>
* checkpoint.c: New file, target-agnostic checkpoints. * checkpoint.h: New file, interface. * Makefile.in (SFILES): Add checkpoint.c.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2009-07-25 Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
|
* checkpoint.c: New file, target-agnostic checkpoints.
|
||||||
|
* checkpoint.h: New file, interface.
|
||||||
|
* Makefile.in (SFILES): Add checkpoint.c.
|
||||||
|
|
||||||
2009-07-25 Michael Snyder <msnyder@vmware.com>
|
2009-07-25 Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
* target.h (struct target_ops): New methods to_set_checkpoint,
|
* target.h (struct target_ops): New methods to_set_checkpoint,
|
||||||
|
|||||||
@@ -667,7 +667,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
|
|||||||
stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \
|
stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \
|
||||||
symtab.c \
|
symtab.c \
|
||||||
target.c target-descriptions.c target-memory.c \
|
target.c target-descriptions.c target-memory.c \
|
||||||
thread.c top.c tracepoint.c \
|
thread.c top.c tracepoint.c checkpoint.c \
|
||||||
trad-frame.c \
|
trad-frame.c \
|
||||||
tramp-frame.c \
|
tramp-frame.c \
|
||||||
typeprint.c \
|
typeprint.c \
|
||||||
@@ -736,7 +736,7 @@ coff-pe-read.h parser-defs.h gdb_ptrace.h mips-linux-tdep.h \
|
|||||||
m68k-tdep.h spu-tdep.h jv-lang.h environ.h solib-irix.h amd64-tdep.h \
|
m68k-tdep.h spu-tdep.h jv-lang.h environ.h solib-irix.h amd64-tdep.h \
|
||||||
doublest.h regset.h hppa-tdep.h ppc-linux-tdep.h rs6000-tdep.h \
|
doublest.h regset.h hppa-tdep.h ppc-linux-tdep.h rs6000-tdep.h \
|
||||||
gdb_locale.h gdb_dirent.h arch-utils.h trad-frame.h gnu-nat.h \
|
gdb_locale.h gdb_dirent.h arch-utils.h trad-frame.h gnu-nat.h \
|
||||||
language.h nbsd-tdep.h wrapper.h solib-svr4.h \
|
language.h nbsd-tdep.h wrapper.h solib-svr4.h checkpoint.h \
|
||||||
macroexp.h ui-file.h regcache.h gdb_string.h tracepoint.h i386-tdep.h \
|
macroexp.h ui-file.h regcache.h gdb_string.h tracepoint.h i386-tdep.h \
|
||||||
inf-child.h p-lang.h event-top.h gdbtypes.h scm-tags.h user-regs.h \
|
inf-child.h p-lang.h event-top.h gdbtypes.h scm-tags.h user-regs.h \
|
||||||
regformats/regdef.h config/alpha/nm-osf3.h config/i386/nm-i386gnu.h \
|
regformats/regdef.h config/alpha/nm-osf3.h config/i386/nm-i386gnu.h \
|
||||||
@@ -786,6 +786,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
|
|||||||
block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o \
|
block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o \
|
||||||
infcall.o \
|
infcall.o \
|
||||||
infcmd.o infrun.o \
|
infcmd.o infrun.o \
|
||||||
|
checkpoint.o \
|
||||||
expprint.o environ.o stack.o thread.o \
|
expprint.o environ.o stack.o thread.o \
|
||||||
exceptions.o \
|
exceptions.o \
|
||||||
inf-child.o \
|
inf-child.o \
|
||||||
|
|||||||
97
gdb/checkpoint.c
Normal file
97
gdb/checkpoint.c
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/* Target-agnostic module for checkpoint commands.
|
||||||
|
|
||||||
|
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* XXX mvs put the actual commands here, and add them to gdb's
|
||||||
|
command lists only by request.
|
||||||
|
|
||||||
|
TBD: actually manage the list here?
|
||||||
|
How would that interplay with forks as written now?
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "gdbcmd.h"
|
||||||
|
|
||||||
|
/* Set a checkpoint (call target_ops method). */
|
||||||
|
|
||||||
|
static void
|
||||||
|
checkpoint_command (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
if (target_set_checkpoint)
|
||||||
|
target_set_checkpoint (args, from_tty);
|
||||||
|
else
|
||||||
|
error (_("checkpoint command not implemented for this target."));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Restore a checkpoint (call target_ops method). */
|
||||||
|
|
||||||
|
static void
|
||||||
|
restart_command (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
if (target_restore_checkpoint)
|
||||||
|
target_restore_checkpoint (args, from_tty);
|
||||||
|
else
|
||||||
|
error (_("restart command not implemented for this target."));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete a checkpoint (call target_ops method). */
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_checkpoint_command (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
if (target_unset_checkpoint)
|
||||||
|
target_unset_checkpoint (args, from_tty);
|
||||||
|
else
|
||||||
|
error (_("delete checkpoint command not implemented for this target."));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
info_checkpoints_command (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
if (target_info_checkpoints)
|
||||||
|
target_info_checkpoints (args, from_tty);
|
||||||
|
else
|
||||||
|
error (_("info checkpoints command not implemented for this target."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Initializer function checkpoint_init().
|
||||||
|
Note -- not called in the usual gdb module-initializer manner,
|
||||||
|
but only by explicit request by targets that want checkpoints. */
|
||||||
|
|
||||||
|
void
|
||||||
|
checkpoint_init (void)
|
||||||
|
{
|
||||||
|
add_com ("checkpoint", class_obscure, checkpoint_command, _("\
|
||||||
|
Create a checkpoint that can be restored later via 'restart'."));
|
||||||
|
|
||||||
|
/* Restart command: restore the context of a specified checkpoint
|
||||||
|
process. */
|
||||||
|
|
||||||
|
add_com ("restart", class_obscure, restart_command, _("\
|
||||||
|
restart <n>: restore program context from a checkpoint.\n\
|
||||||
|
Argument 'n' is checkpoint ID, as displayed by 'info checkpoints'."));
|
||||||
|
|
||||||
|
add_cmd ("checkpoint", class_obscure, delete_checkpoint_command, _("\
|
||||||
|
Delete a previously saved checkpoint."),
|
||||||
|
&deletelist);
|
||||||
|
|
||||||
|
add_info ("checkpoints", info_checkpoints_command,
|
||||||
|
_("IDs of currently known checkpoints."));
|
||||||
|
}
|
||||||
25
gdb/checkpoint.h
Normal file
25
gdb/checkpoint.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* External interface for checkpoint module.
|
||||||
|
Copyright (C) 2009
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GDB.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#if !defined (CHECKPOINT_H)
|
||||||
|
#define CHECKPOINT_H 1
|
||||||
|
|
||||||
|
extern void checkpoint_init (void);
|
||||||
|
|
||||||
|
#endif /* CHECKPOINT_H */
|
||||||
Reference in New Issue
Block a user