diff options
author | Pedro Alves <palves@redhat.com> | 2014-01-14 16:12:19 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-01-14 16:12:19 +0000 |
commit | 8213266aeadc6cfae8313f1335f33a43e40f0a8c (patch) | |
tree | b8039427571e396b044eca6d7fabfa1623201421 /gdb/record.h | |
parent | f44a1f8e513b37bcc52ba9ea0c172c3e94852756 (diff) | |
download | gdb-8213266aeadc6cfae8313f1335f33a43e40f0a8c.zip gdb-8213266aeadc6cfae8313f1335f33a43e40f0a8c.tar.gz gdb-8213266aeadc6cfae8313f1335f33a43e40f0a8c.tar.bz2 |
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.h')
-rw-r--r-- | gdb/record.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/record.h b/gdb/record.h index ab5ea4b..962e382 100644 --- a/gdb/record.h +++ b/gdb/record.h @@ -22,8 +22,6 @@ struct cmd_list_element; -#define RECORD_IS_USED (current_target.to_stratum == record_stratum) - extern unsigned int record_debug; /* Allow record targets to add their own sub-commands. */ @@ -63,4 +61,12 @@ extern void record_mourn_inferior (struct target_ops *); /* The default "to_kill" target method for record targets. */ extern void record_kill (struct target_ops *); +/* Find the record_stratum target in the current target stack. + Returns NULL if none is found. */ +extern struct target_ops *find_record_target (void); + +/* This is to be called by record_stratum targets' open routine before + it does anything. */ +extern void record_preopen (void); + #endif /* _RECORD_H_ */ |