int quit_p;
int dump_core_p;
char *reason;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
/* Don't allow infinite error/warning recursion. */
{
}
dejavu = 0;
+ do_cleanups (cleanup);
}
static struct internal_problem internal_error_problem = {
}
/* Print the system error message for errno, and also mention STRING
- as the file name for which the error was encountered.
- Then return to command level. */
+ as the file name for which the error was encountered. Use ERRCODE
+ for the thrown exception. Then return to command level. */
void
-perror_with_name (const char *string)
+throw_perror_with_name (enum errors errcode, const char *string)
{
char *err;
char *combined;
bfd_set_error (bfd_error_no_error);
errno = 0;
- error (_("%s."), combined);
+ throw_error (errcode, _("%s."), combined);
+}
+
+/* See throw_perror_with_name, ERRCODE defaults here to GENERIC_ERROR. */
+
+void
+perror_with_name (const char *string)
+{
+ throw_perror_with_name (GENERIC_ERROR, string);
}
/* Print the system error message for ERRCODE, and also mention STRING
return result;
}
+/* Compile a regexp and throw an exception on error. This returns a
+ cleanup to free the resulting pattern on success. RX must not be
+ NULL. */
+
+struct cleanup *
+compile_rx_or_error (regex_t *pattern, const char *rx, const char *message)
+{
+ int code;
+
+ gdb_assert (rx != NULL);
+
+ code = regcomp (pattern, rx, REG_NOSUB);
+ if (code != 0)
+ {
+ char *err = get_regcomp_error (code, pattern);
+
+ make_cleanup (xfree, err);
+ error (("%s: %s"), message, err);
+ }
+
+ return make_regfree_cleanup (pattern);
+}
+
\f
/* This function supports the query, nquery, and yquery functions.
Set number of characters where GDB should wrap lines of its output."), _("\
Show number of characters where GDB should wrap lines of its output."), _("\
This affects where GDB wraps its output to fit the screen width.\n\
-Setting this to zero prevents GDB from wrapping its output."),
+Setting this to \"unlimited\" or zero prevents GDB from wrapping its output."),
set_width_command,
show_chars_per_line,
&setlist, &showlist);
Show number of lines in a page for GDB output pagination."), _("\
This affects the number of lines after which GDB will pause\n\
its output and ask you whether to continue.\n\
-Setting this to zero causes GDB never pause during output."),
+Setting this to \"unlimited\" or zero causes GDB never pause during output."),
set_height_command,
show_lines_per_page,
&setlist, &showlist);
Show state of GDB output pagination."), _("\
When pagination is ON, GDB pauses at end of each screenful of\n\
its output and asks you whether to continue.\n\
-Turning pagination off is an alternative to \"set height 0\"."),
+Turning pagination off is an alternative to \"set height unlimited\"."),
NULL,
show_pagination_enabled,
&setlist, &showlist);