diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/process-stratum-target.c | 25 | ||||
-rw-r--r-- | gdb/process-stratum-target.h | 10 |
3 files changed, 43 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c27876b..9f93948 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> + * process-stratum-target.h: Include <set>. + (all_non_exited_process_targets, switch_to_target_no_thread): New + function declarations. + * process-stratum-target.c (all_non_exited_process_targets) + (switch_to_target_no_thread): New function implementations. + +2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> + * infrun.c (handle_inferior_event): Extract out a piece of code into... (mark_non_executing_threads): ...this new function. diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c index f3fd9ee..9eff5ab 100644 --- a/gdb/process-stratum-target.c +++ b/gdb/process-stratum-target.c @@ -83,3 +83,28 @@ process_stratum_target::has_execution (inferior *inf) through hoops. */ return inf->pid != 0; } + +/* See process-stratum-target.h. */ + +std::set<process_stratum_target *> +all_non_exited_process_targets () +{ + /* Inferiors may share targets. To eliminate duplicates, use a set. */ + std::set<process_stratum_target *> targets; + for (inferior *inf : all_non_exited_inferiors ()) + targets.insert (inf->process_target ()); + + return targets; +} + +/* See process-stratum-target.h. */ + +void +switch_to_target_no_thread (process_stratum_target *target) +{ + for (inferior *inf : all_inferiors (target)) + { + switch_to_inferior_no_thread (inf); + break; + } +} diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h index 1be0210..7e7905b 100644 --- a/gdb/process-stratum-target.h +++ b/gdb/process-stratum-target.h @@ -21,6 +21,7 @@ #define PROCESS_STRATUM_TARGET_H #include "target.h" +#include <set> /* Abstract base class inherited by all process_stratum targets. */ @@ -82,4 +83,13 @@ as_process_stratum_target (target_ops *target) return static_cast<process_stratum_target *> (target); } +/* Return a collection of targets that have non-exited inferiors. */ + +extern std::set<process_stratum_target *> all_non_exited_process_targets (); + +/* Switch to the first inferior (and program space) of TARGET, and + switch to no thread selected. */ + +extern void switch_to_target_no_thread (process_stratum_target *target); + #endif /* !defined (PROCESS_STRATUM_TARGET_H) */ |