#include "defs.h"
#include <ctype.h>
-#include "common/gdb_wait.h"
+#include "gdbsupport/gdb_wait.h"
#include "event-top.h"
#include "gdbthread.h"
#include "fnmatch.h"
#include "gdb_usleep.h"
#include "interps.h"
#include "gdb_regex.h"
-#include "common/job-control.h"
-#include "common/selftest.h"
-#include "common/gdb_optional.h"
+#include "gdbsupport/job-control.h"
+#include "gdbsupport/selftest.h"
+#include "gdbsupport/gdb_optional.h"
#include "cp-support.h"
#include <algorithm>
-#include "common/pathstuff.h"
+#include "gdbsupport/pathstuff.h"
#include "cli/cli-style.h"
-#include "common/scope-exit.h"
+#include "gdbsupport/scope-exit.h"
+#include "gdbarch.h"
void (*deprecated_error_begin_hook) (void);
if (problem->user_settable_should_quit)
{
set_doc = xstrprintf (_("Set whether GDB should quit "
- "when an %s is detected"),
+ "when an %s is detected."),
problem->name);
show_doc = xstrprintf (_("Show whether GDB will quit "
- "when an %s is detected"),
+ "when an %s is detected."),
problem->name);
add_setshow_enum_cmd ("quit", class_maintenance,
internal_problem_modes,
if (problem->user_settable_should_dump_core)
{
set_doc = xstrprintf (_("Set whether GDB should create a core "
- "file of GDB when %s is detected"),
+ "file of GDB when %s is detected."),
problem->name);
show_doc = xstrprintf (_("Show whether GDB will create a core "
- "file of GDB when %s is detected"),
+ "file of GDB when %s is detected."),
problem->name);
add_setshow_enum_cmd ("corefile", class_maintenance,
internal_problem_modes,
quit ();
quit_handler ();
-
- if (deprecated_interactive_hook)
- deprecated_interactive_hook ();
}
\f
if (!stream->can_emit_style_escape ())
return;
- /* Note that we don't pass STREAM here, because we want to emit to
+ /* Note that we may not pass STREAM here, when we want to emit to
the wrap buffer, not directly to STREAM. */
- emit_style_escape (style);
+ if (stream == gdb_stdout)
+ stream = nullptr;
+ emit_style_escape (style, stream);
}
/* See utils.h. */
+ (save_chars - wrap_column);
wrap_column = 0; /* And disable fancy wrap */
}
- else if (did_paginate && can_emit_style_escape (stream))
+ else if (did_paginate && stream->can_emit_style_escape ())
emit_style_escape (save_style, stream);
}
}
}
}
+/* See utils.h. */
+
+void
+fputs_highlighted (const char *str, const compiled_regex &highlight,
+ struct ui_file *stream)
+{
+ regmatch_t pmatch;
+
+ while (*str && highlight.exec (str, 1, &pmatch, 0) == 0)
+ {
+ size_t n_highlight = pmatch.rm_eo - pmatch.rm_so;
+
+ /* Output the part before pmatch with current style. */
+ while (pmatch.rm_so > 0)
+ {
+ fputc_filtered (*str, stream);
+ pmatch.rm_so--;
+ str++;
+ }
+
+ /* Output pmatch with the highlight style. */
+ set_output_style (stream, highlight_style.style ());
+ while (n_highlight > 0)
+ {
+ fputc_filtered (*str, stream);
+ n_highlight--;
+ str++;
+ }
+ set_output_style (stream, ui_file_style ());
+ }
+
+ /* Output the trailing part of STR not matching HIGHLIGHT. */
+ if (*str)
+ fputs_filtered (str, stream);
+}
+
int
putchar_unfiltered (int c)
{
{
int match;
- if (template_string != (char *) NULL && string_to_compare != (char *) NULL
+ if (template_string != NULL && string_to_compare != NULL
&& strlen (string_to_compare) <= strlen (template_string))
match =
(startswith (template_string, string_to_compare));