diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-10-22 21:39:09 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-10-22 21:39:09 +0000 |
commit | 779fba24143f45ca71f5f794296d8e8ae589af38 (patch) | |
tree | aaa3a6f0736a36a89896df4cc4bdea9648bc7160 /gdb/target.c | |
parent | b5a64628c132b5e5795b3e940dff3027ab415366 (diff) | |
download | gdb-779fba24143f45ca71f5f794296d8e8ae589af38.tar.gz |
2003-10-22 Andrew Cagney <cagney@redhat.com>
* target.c (target_close): New function.
(debug_to_close): Use "target_close".
(push_target): Use "target_close".
(unpush_target): Use "target_close".
(pop_target): Use "target_close".
* target.h (struct target_ops): Add "to_xclose".
(target_open): Delete macro. Move comment to "to_open".
(target_close): Replace macro with function that takes a target.
* top.c (quit_target): Pass "current_target" to "target_close".
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gdb/target.c b/gdb/target.c index b7d398b8e36..2677fb3f92c 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -672,8 +672,7 @@ push_target (struct target_ops *t) struct target_ops *tmp = (*cur); (*cur) = (*cur)->beneath; tmp->beneath = NULL; - if (tmp->to_close) - (tmp->to_close) (0); + target_close (tmp, 0); } /* We have removed all targets in our stratum, now add the new one. */ @@ -698,8 +697,7 @@ unpush_target (struct target_ops *t) struct target_ops **cur; struct target_ops *tmp; - if (t->to_close) - t->to_close (0); /* Let it clean up */ + target_close (t, 0); /* Look for the specified target. Note that we assume that a target can only occur once in the target stack. */ @@ -726,7 +724,7 @@ unpush_target (struct target_ops *t) void pop_target (void) { - (current_target.to_close) (0); /* Let it clean up */ + target_close (¤t_target, 0); /* Let it clean up */ if (unpush_target (target_stack) == 1) return; @@ -1600,11 +1598,19 @@ debug_to_open (char *args, int from_tty) static void debug_to_close (int quitting) { - debug_target.to_close (quitting); - + target_close (&debug_target, quitting); fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting); } +void +target_close (struct target_ops *targ, int quitting) +{ + if (targ->to_xclose != NULL) + targ->to_xclose (targ, quitting); + else if (targ->to_close != NULL) + targ->to_close (quitting); +} + static void debug_to_attach (char *args, int from_tty) { |