+2014-08-29 Gary Benson <gbenson@redhat.com>
+
+ * utils.h (filtered_printing_initialized): New declaration.
+ * utils.c (abort_with_message): New function.
+ (internal_vproblem): Use abort_with_message for first level
+ recursive internal problems, and if gdb_stderr is not set up.
+ Protect calls to target_terminal_ours, begin_line and query.
+
2014-08-28 Doug Evans <dje@google.com>
* symtab.c (in_prologue): Move definition to better spot.
error (("%s"), message);
}
+/* Emit a message and abort. */
+
+static void ATTRIBUTE_NORETURN
+abort_with_message (const char *msg)
+{
+ if (gdb_stderr == NULL)
+ fputs (msg, stderr);
+ else
+ fputs_unfiltered (msg, gdb_stderr);
+
+ abort (); /* NOTE: GDB has only three calls to abort(). */
+}
+
/* Dump core trying to increase the core soft limit to hard limit first. */
void
break;
case 1:
dejavu = 2;
- fputs_unfiltered (msg, gdb_stderr);
- abort (); /* NOTE: GDB has only three calls to abort(). */
+ abort_with_message (msg);
default:
dejavu = 3;
/* Newer GLIBC versions put the warn_unused_result attribute
}
}
- /* Try to get the message out and at the start of a new line. */
- target_terminal_ours ();
- begin_line ();
-
/* Create a string containing the full error/warning message. Need
to call query with this full string, as otherwize the reason
(error/warning) and question become separated. Format using a
make_cleanup (xfree, reason);
}
+ /* Fall back to abort_with_message if gdb_stderr is not set up. */
+ if (gdb_stderr == NULL)
+ {
+ fputs (reason, stderr);
+ abort_with_message ("\n");
+ }
+
+ /* Try to get the message out and at the start of a new line. */
+ if (target_supports_terminal_ours ())
+ target_terminal_ours ();
+ if (filtered_printing_initialized ())
+ begin_line ();
+
/* Emit the message unless query will emit it below. */
- if (problem->should_quit != internal_problem_ask || !confirm)
+ if (problem->should_quit != internal_problem_ask
+ || !confirm
+ || !filtered_printing_initialized ())
fprintf_unfiltered (gdb_stderr, "%s\n", reason);
if (problem->should_quit == internal_problem_ask)
/* Default (yes/batch case) is to quit GDB. When in batch mode
this lessens the likelihood of GDB going into an infinite
loop. */
- if (!confirm)
+ if (!confirm || !filtered_printing_initialized ())
quit_p = 1;
else
quit_p = query (_("%s\nQuit this debugging session? "), reason);
{
if (!can_dump_core_warn (LIMIT_MAX, reason))
dump_core_p = 0;
+ else if (!filtered_printing_initialized ())
+ dump_core_p = 1;
else
{
/* Default (yes/batch case) is to dump core. This leaves a GDB
set_width ();
}
+/* Return nonzero if filtered printing is initialized. */
+int
+filtered_printing_initialized (void)
+{
+ return wrap_buffer != NULL;
+}
+
/* Helper for make_cleanup_restore_page_info. */
static void