summaryrefslogtreecommitdiff
path: root/gdb/record-full.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-01-14 16:12:19 +0000
committerPedro Alves <palves@redhat.com>2014-01-14 16:12:19 +0000
commit8213266aeadc6cfae8313f1335f33a43e40f0a8c (patch)
treeb8039427571e396b044eca6d7fabfa1623201421 /gdb/record-full.c
parentf44a1f8e513b37bcc52ba9ea0c172c3e94852756 (diff)
Fix "is a record target open" checks.
RECORD_IS_USED and record_full_open look at current_target.to_stratum to determine whether a record target is in use. This is wrong because arch_stratum is greater than record_stratum, so if an arch_stratum target is pushed, RECORD_IS_USED and record_full_open will miss it. To fix this, we can use the existing find_record_target instead, which looks up for a record stratum target across the target stack. Since that means exporting find_record_target in record.h, RECORD_IS_USED ends up redundant, so the patch eliminates it. That exercise then reveals other issues: - adjust_pc_after_break is gating record_full_... calls based on RECORD_IS_USED. But, record_full_ calls shouldn't be made when recording with the record-btrace target. So this adds a new record_full_is_used predicate to be used in that spot. - record_full_open says "Process record target already running", even if the recording target is record-btrace ("process record" is the original complete name of the record-full target). record_btrace_open only says "The process is already being recorded." and does not suggest "record stop", like record-full does. The patch factors out and merges that error to a new record_preopen function that all record targets call in their open routine. Tested on x86_64 Fedora 17. gdb/ 2014-01-14 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * infrun.c (use_displaced_stepping): Use find_record_target instead of RECORD_IS_USED. (adjust_pc_after_break): Use record_full_is_used instead of RECORD_IS_USED. * record-btrace.c (record_btrace_open): Call record_preopen instead of checking RECORD_IS_USED. * record-full.c (record_full_shortname) (record_full_core_shortname): New globals. (record_full_is_used): New function. (find_full_open): Call record_preopen instead of checking RECORD_IS_USED. (init_record_full_ops): Set the target's shortname to record_full_shortname. (init_record_full_core_ops): Set the target's shortname to record_full_core_shortname. * record-full.h (record_full_is_used): Declare. * record.c (find_record_target): Make extern. (record_preopen): New function. * record.h (RECORD_IS_USED): Delete macro. (find_record_target, record_preopen): Declare functions.
Diffstat (limited to 'gdb/record-full.c')
-rw-r--r--gdb/record-full.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gdb/record-full.c b/gdb/record-full.c
index a9fc018ff0..a93418c4e5 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -208,6 +208,19 @@ static ULONGEST record_full_insn_count;
static struct target_ops record_full_ops;
static struct target_ops record_full_core_ops;
+/* See record-full.h. */
+
+int
+record_full_is_used (void)
+{
+ struct target_ops *t;
+
+ t = find_record_target ();
+ return (t == &record_full_ops
+ || t == &record_full_core_ops);
+}
+
+
/* Command lists for "set/show record full". */
static struct cmd_list_element *set_record_full_cmdlist;
static struct cmd_list_element *show_record_full_cmdlist;
@@ -907,10 +920,7 @@ record_full_open (char *name, int from_tty)
if (record_debug)
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open\n");
- /* Check if record target is already running. */
- if (current_target.to_stratum == record_stratum)
- error (_("Process record target already running. Use \"record stop\" to "
- "stop record target first."));
+ record_preopen ();
/* Reset the tmp beneath pointers. */
tmp_to_resume_ops = NULL;