From 2437fd32f17cb11338949cff1fd0741e14ce1681 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 5 Aug 2014 11:42:21 +0100 Subject: Make internal_vproblem always work internal_vproblem can be called (via malloc_failure) from almost the first line of captured_main, but it will crash if called before the first call to set_width. This commit makes internal_vproblem work at any time. There are two parts to this. If called before gdb_stderr is set up, internal_vproblem will fall back to printing the message on regular stderr and aborting. If called after gdb_stderr is set up but before filtered printing is set up, internal_vproblem will operate as usual except that it can not query whether to quit and/or dump core so it defaults to doing both. gdb/ChangeLog: * 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. --- gdb/utils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/utils.h') diff --git a/gdb/utils.h b/gdb/utils.h index 57a1c0f..62888a7 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -244,6 +244,9 @@ extern void fputstrn_filtered (const char *str, int n, int quotr, extern void fputstrn_unfiltered (const char *str, int n, int quotr, struct ui_file * stream); +/* Return nonzero if filtered printing is initialized. */ +extern int filtered_printing_initialized (void); + /* Display the host ADDR on STREAM formatted as ``0x%x''. */ extern void gdb_print_host_address (const void *addr, struct ui_file *stream); -- cgit v1.1