aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-style.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-style.h')
-rw-r--r--gdb/cli/cli-style.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index 18827ce..e94b48d 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -171,4 +171,23 @@ extern void disable_cli_styling ();
/* Return true styled output is currently enabled. */
extern bool term_cli_styling ();
+/* Allow styling to be temporarily suppressed without changing the value of
+ 'set style enabled' user setting. This is useful in, for example, the
+ Python gdb.execute() call which can produce unstyled output. */
+struct scoped_disable_styling
+{
+ /* Temporarily suppress styling without changing the value of 'set
+ style enabled' user setting. */
+ scoped_disable_styling ();
+
+ /* If the constructor started suppressing styling, then styling is
+ resumed after this destructor call. */
+ ~scoped_disable_styling ();
+
+private:
+
+ /* The value to restore in the destructor. */
+ bool m_old_value;
+};
+
#endif /* GDB_CLI_CLI_STYLE_H */