Allow other kernel subsystems to check for kgdb debug sessions. This will first be used by kvm to switch to conservative debug register saving/restoring on x86 if kgdb is in use. CC: Jason Wessel <jason.wessel@xxxxxxxxxxxxx> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- include/linux/kgdb.h | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 6adcc29..aebc768 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -72,6 +72,23 @@ struct uart_port; */ void kgdb_breakpoint(void); +/** + * kgdb_in_use - Check if kgdb is currently in use + * + * This function allows other kernel subsystems to check if the kernel + * is currently being debugged via kgdb. It returns false if not or if + * kgdb support was not built into the kernel. + * + */ +static inline int kgdb_in_use(void) +{ +#ifdef CONFIG_KGDB + return kgdb_connected; +#else + return 0; +#endif +} + extern int kgdb_connected; extern atomic_t kgdb_setting_breakpoint; -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html