diff options
Diffstat (limited to 'gdb/target.h')
-rw-r--r-- | gdb/target.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/gdb/target.h b/gdb/target.h index b05a971e600..26b71cfeb09 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -43,6 +43,7 @@ struct inferior; #include "infrun.h" /* For enum exec_direction_kind. */ #include "breakpoint.h" /* For enum bptype. */ #include "gdbsupport/scoped_restore.h" +#include "gdbsupport/refcounted-object.h" /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -427,6 +428,7 @@ struct target_info }; struct target_ops + : public refcounted_object { /* Return this target's stratum. */ virtual strata stratum () const = 0; @@ -445,10 +447,10 @@ struct target_ops virtual const target_info &info () const = 0; /* Name this target type. */ - const char *shortname () + const char *shortname () const { return info ().shortname; } - const char *longname () + const char *longname () const { return info ().longname; } /* Close the target. This is where the target can handle @@ -701,6 +703,8 @@ struct target_ops TARGET_DEFAULT_RETURN (false); virtual void async (int) TARGET_DEFAULT_NORETURN (tcomplain ()); + virtual int async_wait_fd () + TARGET_DEFAULT_NORETURN (noprocess ()); virtual void thread_events (int) TARGET_DEFAULT_IGNORE (); /* This method must be implemented in some situations. See the @@ -1264,6 +1268,27 @@ struct target_ops_deleter /* A unique pointer for target_ops. */ typedef std::unique_ptr<target_ops, target_ops_deleter> target_ops_up; +/* Decref a target and close if, if there are no references left. */ +extern void decref_target (target_ops *t); + +/* A policy class to interface gdb::ref_ptr with target_ops. */ + +struct target_ops_ref_policy +{ + static void incref (target_ops *t) + { + t->incref (); + } + + static void decref (target_ops *t) + { + decref_target (t); + } +}; + +/* A gdb::ref_ptr pointer to a target_ops. */ +typedef gdb::ref_ptr<target_ops, target_ops_ref_policy> target_ops_ref; + /* Native target backends call this once at initialization time to inform the core about which is the target that can respond to "run" or "attach". Note: native targets are always singletons. */ @@ -1318,6 +1343,9 @@ private: extern target_ops *current_top_target (); +/* Return the dummy target. */ +extern target_ops *get_dummy_target (); + /* Define easy words for doing these operations on our current target. */ #define target_shortname (current_top_target ()->shortname ()) @@ -2366,7 +2394,7 @@ extern void pop_all_targets_at_and_above (enum strata stratum); strictly above ABOVE_STRATUM. */ extern void pop_all_targets_above (enum strata above_stratum); -extern int target_is_pushed (struct target_ops *t); +extern bool target_is_pushed (target_ops *t); extern CORE_ADDR target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset); |