summaryrefslogtreecommitdiff
path: root/gdb/infrun.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/infrun.h')
-rw-r--r--gdb/infrun.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 3e84805accb..0c7c55eabec 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -40,14 +40,40 @@ extern bool debug_infrun;
/* Print "infrun" start/end debug statements. */
-#define INFRUN_SCOPED_DEBUG_START_END(msg) \
- scoped_debug_start_end (debug_infrun, "infrun", msg)
+#define INFRUN_SCOPED_DEBUG_START_END(fmt, ...) \
+ scoped_debug_start_end (debug_infrun, "infrun", fmt, ##__VA_ARGS__)
/* Print "infrun" enter/exit debug statements. */
#define INFRUN_SCOPED_DEBUG_ENTER_EXIT \
scoped_debug_enter_exit (debug_infrun, "infrun")
+/* A infrun debug helper routine to print out all the threads in the set
+ THREADS (which should be a range type that returns thread_info*
+ objects).
+
+ The TITLE is a string that is printed before the list of threads.
+
+ Output is only produced when 'set debug infrun on'. */
+
+template<typename ThreadRange>
+static inline void
+infrun_debug_show_threads (const char *title, ThreadRange threads)
+{
+ if (debug_infrun)
+ {
+ infrun_debug_printf ("%s:", title);
+ for (thread_info *thread : threads)
+ infrun_debug_printf (" thread %s, executing = %d, resumed = %d, "
+ "state = %s",
+ thread->ptid.to_string ().c_str (),
+ thread->executing (),
+ thread->resumed (),
+ thread_state_string (thread->state));
+ }
+}
+
+
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
extern int stop_on_solib_events;
@@ -124,9 +150,8 @@ extern process_stratum_target *user_visible_resume_target (ptid_t resume_ptid);
extern int normal_stop (void);
/* Return the cached copy of the last target/ptid/waitstatus returned
- by target_wait()/deprecated_target_wait_hook(). The data is
- actually cached by handle_inferior_event(), which gets called
- immediately after target_wait()/deprecated_target_wait_hook(). */
+ by target_wait(). The data is actually cached by handle_inferior_event(),
+ which gets called immediately after target_wait(). */
extern void get_last_target_status (process_stratum_target **target,
ptid_t *ptid,
struct target_waitstatus *status);
@@ -139,8 +164,14 @@ extern void set_last_target_status (process_stratum_target *target, ptid_t ptid,
target_wait(). */
extern void nullify_last_target_wait_ptid ();
-/* Stop all threads. Only returns after everything is halted. */
-extern void stop_all_threads (void);
+/* Stop all threads. Only returns after everything is halted.
+
+ REASON is a string indicating the reason why we stop all threads, used in
+ debug messages.
+
+ If INF is non-nullptr, stop all threads of that inferior. Otherwise, stop
+ all threads of all inferiors. */
+extern void stop_all_threads (const char *reason, inferior *inf = nullptr);
extern void prepare_for_detach (void);