static void
print_exception (struct ui_file *file, const struct gdb_exception &e)
{
+ /* Exceptions are always created using styling. If styling is not
+ desired, then it has to be removed here. */
+ no_terminal_escape_file<wrapped_file<ui_file *>> strip_escapes (file);
+ if (!file->can_emit_style_escape ())
+ file = &strip_escapes;
+
/* KLUDGE: cagney/2005-01-13: Write the string out one line at a time
as that way the MI's behavior is preserved. */
const char *start;
because these classes aren't instantiated in very many ways. */
template class escape_buffering_file<stdio_file>;
template class no_terminal_escape_file<stdio_file>;
+template class no_terminal_escape_file<wrapped_file<ui_file *>>;
void
verror (const char *string, va_list args)
{
- throw_verror (GENERIC_ERROR, string, args);
+ string_file text (true);
+ text.vprintf (string, args);
+ throw gdb_exception_error (GENERIC_ERROR, text.release ());
}
/* Emit a message and abort. */
{
}
+ gdb_exception (enum return_reason r, enum errors e, std::string &&str)
+ : reason (r),
+ error (e),
+ message (std::make_shared<std::string> (std::move (str)))
+ {
+ }
+
gdb_exception (enum return_reason r, enum errors e,
const char *fmt, va_list ap)
ATTRIBUTE_PRINTF (4, 0)
{
}
+ gdb_exception_error (enum errors e, std::string &&str)
+ : gdb_exception (RETURN_ERROR, e, std::move (str))
+ {
+ }
+
explicit gdb_exception_error (gdb_exception &&ex) noexcept
: gdb_exception (std::move (ex))
{