diff options
author | Tom Tromey <tromey@redhat.com> | 2013-07-25 14:34:51 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-07-25 14:34:51 +0000 |
commit | 7fdc15218d384617a3aad142cfeca0594a7c5ff2 (patch) | |
tree | 79400605229edd964c75d69e0fea1e966fcd3ea7 /gdb/ChangeLog | |
parent | c22a2b88fe63d857110e9c86f3775e55197c9a04 (diff) | |
download | gdb-7fdc15218d384617a3aad142cfeca0594a7c5ff2.zip gdb-7fdc15218d384617a3aad142cfeca0594a7c5ff2.tar.gz gdb-7fdc15218d384617a3aad142cfeca0594a7c5ff2.tar.bz2 |
remove pop_target
This patch fixes the target double-close problem (PR remote/15266),
and in the process removes pop_target entire (PR remote/15256).
The first issue is that pop_target calls target_close. However, it
then calls unpush_target, which also calls target_close. This means
targets must be able to be closed twice. Not only is this strange,
but it also directly contradicts the contract of to_xclose targets.
(We currently have just a single such target, and it is never pushed;
but I plan to add more, and so this latent bug is triggered.)
The second issue is that it seems to me that calling pop_target is
often unsafe. This is what cropped up in 15256, where the remote
target assumed that it could pop_target -- but there was another
target higher on the stack, leading to confusion.
But, it is always just as easy to call unpush_target as it is to call
pop_target; and it is also safer. So, removing pop_target seemed like
an improvement.
Finally, this adds an assertion to target_close to ensure that no
currently-pushed target can be closed.
Built and regtested on x86-64 Fedora 18; both natively and using the
native-gdbserver board file.
PR remote/15256, PR remote/15266:
* bfd-target.c (target_bfd_reopen): Initialize to_magic.
* monitor.c (monitor_detach): Use unpush_target.
* remote-m32r-sdi.c (m32r_detach): Use unpush_target.
* remote-mips.c (mips_detach): Use unpush_target. Don't
call mips_close.
* remote-sim.c (gdbsim_detach): Use unpush_target.
* target.c (pop_target): Remove.
(pop_all_targets_above): Don't call target_close.
(target_close): Assert that the target is unpushed.
* target.h (pop_target): Don't declare.
* tracepoint.c (tfile_open): Use unpush_target.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 782a262..ff9ff87 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,20 @@ 2013-07-25 Tom Tromey <tromey@redhat.com> + PR remote/15256, PR remote/15266: + * bfd-target.c (target_bfd_reopen): Initialize to_magic. + * monitor.c (monitor_detach): Use unpush_target. + * remote-m32r-sdi.c (m32r_detach): Use unpush_target. + * remote-mips.c (mips_detach): Use unpush_target. Don't + call mips_close. + * remote-sim.c (gdbsim_detach): Use unpush_target. + * target.c (pop_target): Remove. + (pop_all_targets_above): Don't call target_close. + (target_close): Assert that the target is unpushed. + * target.h (pop_target): Don't declare. + * tracepoint.c (tfile_open): Use unpush_target. + +2013-07-25 Tom Tromey <tromey@redhat.com> + * linux-thread-db.c (init_thread_db_ops): Call complete_target_initialization. (_initialize_thread_db): Don't call add_target. |