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-btrace.c | |
parent | f44a1f8e513b37bcc52ba9ea0c172c3e94852756 (diff) | |
download | binutils-8213266aeadc6cfae8313f1335f33a43e40f0a8c.zip binutils-8213266aeadc6cfae8313f1335f33a43e40f0a8c.tar.gz binutils-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-btrace.c')
-rw-r--r-- | gdb/record-btrace.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 5fd26e2..c3330e9 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -142,8 +142,7 @@ record_btrace_open (char *args, int from_tty) DEBUG ("open"); - if (RECORD_IS_USED) - error (_("The process is already being recorded.")); + record_preopen (); if (!target_has_execution) error (_("The program is not being run.")); |