From 357d8270b141ee35d60fc6e01d0a17b9cd9b45fa Mon Sep 17 00:00:00 2001 From: Paul Koning Date: Mon, 26 Oct 2015 15:26:16 -0400 Subject: introduce the target stack there's a huge hack in multi_target_compatible 2014-07-29 Tom Tromey * target-delegates.c: Rebuild. * make-target-delegates (write_debugmethod): Update for change to debug_target. * progspace.c (add_program_space): Acquire a reference to the target stack. (release_program_space): Release reference to the program space. (set_current_program_space): Set the target stack. * progspace.h (struct program_space) : New field. * target.c (target_ops_ptr): New typedef. (struct target_stack): New. (target_stack): Change type. (current_target): Update comment. (update_current_target): Update. (multi_target_compatible, ensure_multi_target_ok): New functions. (push_target): Update. Add multi-target check. (unpush_target, pop_all_targets_above, target_is_pushed) (target_info, target_require_runnable): Update. (target_stack_set): New global. (currently_multi_target, target_stack_incref, target_stack_decref) (target_stack_set_current, new_target_stack): New functions. (maintenance_print_target_stack): Update. (initialize_targets): Initialize target_stack_set, target_stack. Update. (target_stack_id): New function. (next_available_target_id): New global. (print_one_target_stack): New function. (maintenance_print_target_stack): Move earlier. Rewrite. (debug_target): Remove. (debug_to_open, setup_target_debug): Update. * target.h (target_stack_incref, target_stack_decref) (target_stack_set_current, new_target_stack, target_stack_id): Declare. * testsuite/gdb.base/auto-connect-native-target.exp: Update. --- gdb/target.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index e319271..78610bf 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -39,6 +39,7 @@ struct traceframe_info; struct expression; struct dcache_struct; struct inferior; +struct target_stack; #include "infrun.h" /* For enum exec_direction_kind. */ #include "breakpoint.h" /* For enum bptype. */ @@ -1256,6 +1257,28 @@ struct target_ops #define OPS_MAGIC 3840 +/* Acquire a reference to the target stack. */ + +extern struct target_stack *target_stack_incref (void); + +/* Release a reference to the target stack. */ + +extern void target_stack_decref (struct target_stack *); + +/* Set target_stack and current_target from TSTACK. */ + +extern void target_stack_set_current (struct target_stack *tstack); + +/* Create a new "empty" target stack and return it. The current + target stack is not changed. The new stack is initialized with a + single reference count, which is owned by the caller. */ + +extern struct target_stack *new_target_stack (void); + +/* Return the numeric identifier of the current target stack. */ + +extern int target_stack_id (void); + /* The ops structure for our "current" target process. This should never be NULL. If there is no target, it points to the dummy_target. */ -- cgit v1.1