gdb: introduce 'all_non_exited_process_targets' and 'switch_to_target_no_thread'

Introduce two new convenience functions:

1. all_non_exited_process_targets: returns a collection of all process
stratum targets that have non-exited inferiors on them.  Useful for
iterating targets.

2. switch_to_target_no_thread: switch the context to the first
inferior of the given target, and to no selected thread.

gdb/ChangeLog:
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.
This commit is contained in:
Tankut Baris Aktemur
2020-05-14 13:59:54 +02:00
parent 293b3ebcba
commit d890404b63
3 changed files with 43 additions and 0 deletions

View File

@ -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) */