Split record.h into record.h and record-full.h.

Split record.c into record.c and record-full.c.

The split leaves the command part in record.c and moves the target part into
record-full.c.

gdb/
	* record.h: Split into this and ...
	* record-full.h: ... this.
	* record.c: Split into this and ...
	* record-full.c: ... this.
	* target.h (target_ops): Add new fields to_info_record,
	to_save_record, to_delete_record, to_record_is_replaying,
	to_goto_record_begin, to_goto_record_end, to_goto_record.
	(target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* target.c (target_info_record): New.
	(target_save_record): New.
	(target_supports_delete_record): New.
	(target_delete_record): New.
	(target_record_is_replaying): New.
	(target_goto_record_begin): New.
	(target_goto_record_end): New.
	(target_goto_record): New.
	* record.h: Declare struct cmd_list_element.
	(record_cmdlist): New declaration.
	(set_record_cmdlist): New declaration.
	(show_record_cmdlist): New declaration.
	(info_record_cmdlist): New declaration.
	(cmd_record_goto): New declaration.
	* record.c: Remove unnecessary includes.
	Include inferior.h.
	(cmd_record_goto): Remove declaration.
	(record_cmdlist): Now extern. Initialize.
	(set_record_cmdlist): Now extern. Initialize.
	(show_record_cmdlist): Now extern. Initialize.
	(info_record_cmdlist): Now extern. Initialize.
	(find_record_target): New.
	(require_record_target): New.
	(cmd_record_start): Update.
	(cmd_record_delete): Remove target-specific code.
	Call target_delete_record.
	(cmd_record_stop): Unpush any record target.
	(set_record_insn_max_num): Move to record-full.c
	(set_record_command): Add comment.
	(show_record_command): Add comment.
	(info_record_command): Update comment.
	Remove target-specific code.
	Call the record target's to_info_record.
	(cmd_record_start): New.
	(cmd_record_goto): Now extern.
	Remove target-specific code.
	Call target_goto_begin,  target_goto_end, or target_goto.
	(_initialize_record): Move record target ops initialization to
	record-full.c.
	Change "record" command help text.
	Move "record restore", "record set", and "record show" commands to
	record-full.c.
	* Makefile.in (SFILES): Add record-full.c.
	(HFILES_NO_SRCDIR): Add record-full.h.
	(COMMON_OBS): Add record-full.o.
	* amd64-linux-tdep.c: Include record-full.h instead of record.h.
	* arm-tdep.c: Include record-full.h.
	* i386-linux-tdep.c: Include record-full.h instead of record.h.
	* i386-tdep.c: Include record-full.h.
	* infrun.c: Include record-full.h.
	* linux-record.c: Include record-full.h.
	* moxie-tdep.c: Include record-full.h.
	* record-full.c: Include record-full.h.
	Change module comment.
	(set_record_full_cmdlist): New.
	(show_record_full_cmdlist): New.
	(record_full_cmdlist): New.
	(record_goto_insn): New declaration.
	(record_save): New declaration.
	(record_check_insn_num): Change query string.
	(record_info): New.
	(record_delete): New.
	(record_is_replaying): New.
	(record_goto_entry): New.
	(record_goto_begin): New.
	(record_goto_end): New.
	(record_goto): New.
	(init_record_ops): Update.
	(init_record_core_ops): Update.
	(cmd_record_save): Rename to record_save. Remove target and arg checks.
	(cmd_record_start): New.
	(set_record_insn_max_num): Moved from record.c
	(set_record_full_command): New.
	(show_record_full_command): New.
	(_initialize_record_full): New.
This commit is contained in:
Markus Metzger 2013-03-11 08:42:55 +00:00
parent b48d48ebed
commit d02ed0bbfa
15 changed files with 3414 additions and 2879 deletions

View File

@ -1,3 +1,96 @@
2013-03-11 Markus Metzger <markus.t.metzger@intel.com>
* record.h: Split into this and ...
* record-full.h: ... this.
* record.c: Split into this and ...
* record-full.c: ... this.
* target.h (target_ops): Add new fields to_info_record,
to_save_record, to_delete_record, to_record_is_replaying,
to_goto_record_begin, to_goto_record_end, to_goto_record.
(target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* target.c (target_info_record): New.
(target_save_record): New.
(target_supports_delete_record): New.
(target_delete_record): New.
(target_record_is_replaying): New.
(target_goto_record_begin): New.
(target_goto_record_end): New.
(target_goto_record): New.
* record.h: Declare struct cmd_list_element.
(record_cmdlist): New declaration.
(set_record_cmdlist): New declaration.
(show_record_cmdlist): New declaration.
(info_record_cmdlist): New declaration.
(cmd_record_goto): New declaration.
* record.c: Remove unnecessary includes.
Include inferior.h.
(cmd_record_goto): Remove declaration.
(record_cmdlist): Now extern. Initialize.
(set_record_cmdlist): Now extern. Initialize.
(show_record_cmdlist): Now extern. Initialize.
(info_record_cmdlist): Now extern. Initialize.
(find_record_target): New.
(require_record_target): New.
(cmd_record_start): Update.
(cmd_record_delete): Remove target-specific code.
Call target_delete_record.
(cmd_record_stop): Unpush any record target.
(set_record_insn_max_num): Move to record-full.c
(set_record_command): Add comment.
(show_record_command): Add comment.
(info_record_command): Update comment.
Remove target-specific code.
Call the record target's to_info_record.
(cmd_record_start): New.
(cmd_record_goto): Now extern.
Remove target-specific code.
Call target_goto_begin, target_goto_end, or target_goto.
(_initialize_record): Move record target ops initialization to
record-full.c.
Change "record" command help text.
Move "record restore", "record set", and "record show" commands to
record-full.c.
* Makefile.in (SFILES): Add record-full.c.
(HFILES_NO_SRCDIR): Add record-full.h.
(COMMON_OBS): Add record-full.o.
* amd64-linux-tdep.c: Include record-full.h instead of record.h.
* arm-tdep.c: Include record-full.h.
* i386-linux-tdep.c: Include record-full.h instead of record.h.
* i386-tdep.c: Include record-full.h.
* infrun.c: Include record-full.h.
* linux-record.c: Include record-full.h.
* moxie-tdep.c: Include record-full.h.
* record-full.c: Include record-full.h.
Change module comment.
(set_record_full_cmdlist): New.
(show_record_full_cmdlist): New.
(record_full_cmdlist): New.
(record_goto_insn): New declaration.
(record_save): New declaration.
(record_check_insn_num): Change query string.
(record_info): New.
(record_delete): New.
(record_is_replaying): New.
(record_goto_entry): New.
(record_goto_begin): New.
(record_goto_end): New.
(record_goto): New.
(init_record_ops): Update.
(init_record_core_ops): Update.
(cmd_record_save): Rename to record_save. Remove target and arg checks.
(cmd_record_start): New.
(set_record_insn_max_num): Moved from record.c
(set_record_full_command): New.
(show_record_full_command): New.
(_initialize_record_full): New.
2013-03-11 Markus Metzger <markus.t.metzger@intel.com>
* target.h (add_deprecated_target_alias): New.

View File

@ -753,7 +753,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
valarith.c valops.c valprint.c value.c varobj.c common/vec.c \
xml-tdesc.c xml-support.c \
inferior.c gdb_usleep.c \
record.c gcore.c \
record.c record-full.c gcore.c \
jit.c \
xml-syscall.c \
annotate.c common/signals.c copying.c dfp.c gdb.c inf-child.c \
@ -829,6 +829,7 @@ dicos-tdep.h filesystem.h gcore.h gdb_wchar.h hppabsd-tdep.h \
i386-darwin-tdep.h i386-nat.h linux-record.h moxie-tdep.h \
osdata.h procfs.h python/py-event.h python/py-events.h python/py-stopevent.h \
python/python-internal.h python/python.h ravenscar-thread.h record.h \
record-full.h \
solib-darwin.h solib-ia64-hpux.h solib-spu.h windows-nat.h xcoffread.h \
gnulib/import/extra/snippet/arg-nonnull.h gnulib/import/extra/snippet/c++defs.h \
gnulib/import/extra/snippet/warn-on-use.h \
@ -926,7 +927,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
prologue-value.o memory-map.o memrange.o \
xml-support.o xml-syscall.o xml-utils.o \
target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \
inferior.o osdata.o gdb_usleep.o record.o gcore.o \
inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o \
gdb_vecs.o jit.o progspace.o skip.o probe.o \
common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
format.o registry.o btrace.o

View File

@ -48,7 +48,7 @@
/* The syscall's XML filename for i386. */
#define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
#include "record.h"
#include "record-full.h"
#include "linux-record.h"
/* Supported register note sections. */

View File

@ -56,6 +56,7 @@
#include "vec.h"
#include "record.h"
#include "record-full.h"
#include "features/arm-with-m.c"
#include "features/arm-with-m-fpa-layout.c"

View File

@ -44,7 +44,7 @@
/* The syscall's XML filename for i386. */
#define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml"
#include "record.h"
#include "record-full.h"
#include "linux-record.h"
#include <stdint.h>

View File

@ -52,6 +52,7 @@
#include "i386-xstate.h"
#include "record.h"
#include "record-full.h"
#include <stdint.h>
#include "features/i386/i386.c"

View File

@ -49,6 +49,7 @@
#include "mi/mi-common.h"
#include "event-top.h"
#include "record.h"
#include "record-full.h"
#include "inline-frame.h"
#include "jit.h"
#include "tracepoint.h"

View File

@ -22,6 +22,7 @@
#include "gdbtypes.h"
#include "regcache.h"
#include "record.h"
#include "record-full.h"
#include "linux-record.h"
/* These macros are the values of the first argument of system call

View File

@ -37,6 +37,7 @@
#include "trad-frame.h"
#include "dis-asm.h"
#include "record.h"
#include "record-full.h"
#include "gdb_assert.h"

3019
gdb/record-full.c Normal file

File diff suppressed because it is too large Load Diff

30
gdb/record-full.h Normal file
View File

@ -0,0 +1,30 @@
/* Process record and replay target for GDB, the GNU debugger.
Copyright (C) 2013 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/>. */
#ifndef RECORD_FULL_H
#define RECORD_FULL_H
extern int record_memory_query;
extern int record_arch_list_add_reg (struct regcache *regcache, int num);
extern int record_arch_list_add_mem (CORE_ADDR addr, int len);
extern int record_arch_list_add_end (void);
extern struct cleanup *record_gdb_operation_disable_set (void);
#endif /* RECORD_FULL_H */

File diff suppressed because it is too large Load Diff

View File

@ -20,15 +20,17 @@
#ifndef _RECORD_H_
#define _RECORD_H_
struct cmd_list_element;
#define RECORD_IS_USED (current_target.to_stratum == record_stratum)
extern unsigned int record_debug;
extern int record_memory_query;
extern int record_arch_list_add_reg (struct regcache *regcache, int num);
extern int record_arch_list_add_mem (CORE_ADDR addr, int len);
extern int record_arch_list_add_end (void);
extern struct cleanup *record_gdb_operation_disable_set (void);
/* Allow record targets to add their own sub-commands. */
extern struct cmd_list_element *record_cmdlist;
extern struct cmd_list_element *set_record_cmdlist;
extern struct cmd_list_element *show_record_cmdlist;
extern struct cmd_list_element *info_record_cmdlist;
/* Wrapper for target_read_memory that prints a debug message if
reading memory fails. */
@ -36,4 +38,7 @@ 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);
#endif /* _RECORD_H_ */

View File

@ -4241,6 +4241,136 @@ target_read_btrace (struct btrace_target_info *btinfo,
return NULL;
}
/* See target.h. */
void
target_info_record (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_info_record != NULL)
{
t->to_info_record ();
return;
}
tcomplain ();
}
/* See target.h. */
void
target_save_record (char *filename)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_save_record != NULL)
{
t->to_save_record (filename);
return;
}
tcomplain ();
}
/* See target.h. */
int
target_supports_delete_record (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_delete_record != NULL)
return 1;
return 0;
}
/* See target.h. */
void
target_delete_record (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_delete_record != NULL)
{
t->to_delete_record ();
return;
}
tcomplain ();
}
/* See target.h. */
int
target_record_is_replaying (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_record_is_replaying != NULL)
return t->to_record_is_replaying ();
return 0;
}
/* See target.h. */
void
target_goto_record_begin (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record_begin != NULL)
{
t->to_goto_record_begin ();
return;
}
tcomplain ();
}
/* See target.h. */
void
target_goto_record_end (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record_end != NULL)
{
t->to_goto_record_end ();
return;
}
tcomplain ();
}
/* See target.h. */
void
target_goto_record (ULONGEST insn)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record != NULL)
{
t->to_goto_record (insn);
return;
}
tcomplain ();
}
static void
debug_to_prepare_to_store (struct regcache *regcache)
{

View File

@ -882,6 +882,27 @@ struct target_ops
VEC (btrace_block_s) *(*to_read_btrace) (struct btrace_target_info *,
enum btrace_read_type);
/* Print information about the recording. */
void (*to_info_record) (void);
/* Save the recorded execution trace into a file. */
void (*to_save_record) (char *filename);
/* Delete the recorded execution trace from the current position onwards. */
void (*to_delete_record) (void);
/* Query if the record target is currently replaying. */
int (*to_record_is_replaying) (void);
/* Go to the begin of the execution trace. */
void (*to_goto_record_begin) (void);
/* Go to the end of the execution trace. */
void (*to_goto_record_end) (void);
/* Go to a specific location in the recorded execution trace. */
void (*to_goto_record) (ULONGEST insn);
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@ -1946,5 +1967,28 @@ extern void target_teardown_btrace (struct btrace_target_info *btinfo);
extern VEC (btrace_block_s) *target_read_btrace (struct btrace_target_info *,
enum btrace_read_type);
/* See to_info_record in struct target_ops. */
extern void target_info_record (void);
/* See to_save_record in struct target_ops. */
extern void target_save_record (char *filename);
/* Query if the target supports deleting the execution log. */
extern int target_supports_delete_record (void);
/* See to_delete_record in struct target_ops. */
extern void target_delete_record (void);
/* See to_record_is_replaying in struct target_ops. */
extern int target_record_is_replaying (void);
/* See to_goto_record_begin in struct target_ops. */
extern void target_goto_record_begin (void);
/* See to_goto_record_end in struct target_ops. */
extern void target_goto_record_end (void);
/* See to_goto_record in struct target_ops. */
extern void target_goto_record (ULONGEST insn);
#endif /* !defined (TARGET_H) */