From cc06b668978e542ecbc2aff1beca40e5baff86b0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 23 Apr 2019 15:31:07 -0600 Subject: [PATCH] Remove exception_none Now that gdb_exception has a constructor, there's no need for exception_none. This patch removes it. gdb/ChangeLog 2019-04-25 Tom Tromey * xml-support.c (gdb_xml_parser::gdb_xml_parser): Update. * python/py-value.c (valpy_getitem, valpy_nonzero): Update. * python/py-inferior.c (infpy_write_memory, infpy_search_memory): Update. * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): Update. * mi/mi-interp.c (mi_interp::exec): Update. * linespec.c (parse_linespec): Update. * infcall.c (run_inferior_call): Update. * guile/scm-value.c (gdbscm_value_to_lazy_string): Update. * guile/scm-symbol.c (gdbscm_lookup_symbol) (gdbscm_lookup_global_symbol): Update. * guile/scm-param.c (gdbscm_parameter_value): Update. * guile/scm-frame.c (gdbscm_frame_read_register) (gdbscm_frame_read_var): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * exec.c (try_open_exec_file): Update. * event-top.c (gdb_rl_callback_read_char_wrapper_noexcept) (gdb_rl_callback_handler): Update. * common/common-exceptions.h (exception_none): Don't declare. * common/common-exceptions.c (exception_none): Don't define. (struct catcher) : Update. * cli/cli-interp.c (safe_execute_command): Update. * breakpoint.c (insert_bp_location, location_to_sals): Update. --- gdb/ChangeLog | 27 +++++++++++++++++++++++++++ gdb/breakpoint.c | 4 ++-- gdb/cli/cli-interp.c | 2 +- gdb/common/common-exceptions.c | 4 +--- gdb/common/common-exceptions.h | 3 --- gdb/event-top.c | 4 ++-- gdb/exec.c | 2 +- gdb/guile/scm-breakpoint.c | 2 +- gdb/guile/scm-frame.c | 4 ++-- gdb/guile/scm-param.c | 2 +- gdb/guile/scm-symbol.c | 4 ++-- gdb/guile/scm-value.c | 2 +- gdb/infcall.c | 2 +- gdb/linespec.c | 2 +- gdb/mi/mi-interp.c | 2 +- gdb/python/py-breakpoint.c | 4 ++-- gdb/python/py-inferior.c | 4 ++-- gdb/python/py-value.c | 4 ++-- gdb/xml-support.c | 1 - 19 files changed, 50 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5167cc26754..106f0e65bbe 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +2019-04-25 Tom Tromey + + * xml-support.c (gdb_xml_parser::gdb_xml_parser): Update. + * python/py-value.c (valpy_getitem, valpy_nonzero): Update. + * python/py-inferior.c (infpy_write_memory, infpy_search_memory): + Update. + * python/py-breakpoint.c (bppy_set_condition, bppy_set_commands): + Update. + * mi/mi-interp.c (mi_interp::exec): Update. + * linespec.c (parse_linespec): Update. + * infcall.c (run_inferior_call): Update. + * guile/scm-value.c (gdbscm_value_to_lazy_string): Update. + * guile/scm-symbol.c (gdbscm_lookup_symbol) + (gdbscm_lookup_global_symbol): Update. + * guile/scm-param.c (gdbscm_parameter_value): Update. + * guile/scm-frame.c (gdbscm_frame_read_register) + (gdbscm_frame_read_var): Update. + * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. + * exec.c (try_open_exec_file): Update. + * event-top.c (gdb_rl_callback_read_char_wrapper_noexcept) + (gdb_rl_callback_handler): Update. + * common/common-exceptions.h (exception_none): Don't declare. + * common/common-exceptions.c (exception_none): Don't define. + (struct catcher) : Update. + * cli/cli-interp.c (safe_execute_command): Update. + * breakpoint.c (insert_bp_location, location_to_sals): Update. + 2019-04-25 Ali Tamur * dwarf2read.c (skip_one_die): Add DW_FORM_strx. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3047ef3827d..c74fc61ea42 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2434,7 +2434,7 @@ insert_bp_location (struct bp_location *bl, int *hw_breakpoint_error, int *hw_bp_error_explained_already) { - gdb_exception bp_excpt = exception_none; + gdb_exception bp_excpt; if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update)) return 0; @@ -13593,7 +13593,7 @@ static std::vector location_to_sals (struct breakpoint *b, struct event_location *location, struct program_space *search_pspace, int *found) { - struct gdb_exception exception = exception_none; + struct gdb_exception exception; gdb_assert (b->ops != NULL); diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index c150f40feed..17639d0c3f3 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -357,7 +357,7 @@ static struct gdb_exception safe_execute_command (struct ui_out *command_uiout, const char *command, int from_tty) { - struct gdb_exception e = exception_none; + struct gdb_exception e; /* Save and override the global ``struct ui_out'' builder. */ scoped_restore saved_uiout = make_scoped_restore (¤t_uiout, diff --git a/gdb/common/common-exceptions.c b/gdb/common/common-exceptions.c index 6378dc40d6d..59c27ab52d4 100644 --- a/gdb/common/common-exceptions.c +++ b/gdb/common/common-exceptions.c @@ -21,8 +21,6 @@ #include "common-exceptions.h" #include -const struct gdb_exception exception_none; - /* Possible catcher states. */ enum catcher_state { /* Initial state, a new catcher has just been created. */ @@ -47,7 +45,7 @@ struct catcher /* Jump buffer pointing back at the exception handler. */ jmp_buf buf; /* Status buffer belonging to the exception handler. */ - struct gdb_exception exception = exception_none; + struct gdb_exception exception; }; /* Where to go for throw_exception(). */ diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h index 3f47caec775..33fa8a92ec2 100644 --- a/gdb/common/common-exceptions.h +++ b/gdb/common/common-exceptions.h @@ -295,7 +295,4 @@ extern void throw_error (enum errors error, const char *fmt, ...) extern void throw_quit (const char *fmt, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2); -/* A pre-defined non-exception. */ -extern const struct gdb_exception exception_none; - #endif /* COMMON_COMMON_EXCEPTIONS_H */ diff --git a/gdb/event-top.c b/gdb/event-top.c index cd54eb5a2c5..959792d9e7a 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -164,7 +164,7 @@ void (*after_char_processing_hook) (void); static struct gdb_exception gdb_rl_callback_read_char_wrapper_noexcept () noexcept { - struct gdb_exception gdb_expt = exception_none; + struct gdb_exception gdb_expt; /* C++ exceptions can't normally be thrown across readline (unless it is built with -fexceptions, but it won't by default on many @@ -205,7 +205,7 @@ gdb_rl_callback_read_char_wrapper (gdb_client_data client_data) static void gdb_rl_callback_handler (char *rl) noexcept { - struct gdb_exception gdb_rl_expt = exception_none; + struct gdb_exception gdb_rl_expt; struct ui *ui = current_ui; try diff --git a/gdb/exec.c b/gdb/exec.c index b0eb9ff02a3..7ff77f99160 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -148,7 +148,7 @@ void try_open_exec_file (const char *exec_file_host, struct inferior *inf, symfile_add_flags add_flags) { - struct gdb_exception prev_err = exception_none; + struct gdb_exception prev_err; /* exec_file_attach and symbol_file_add_main may throw an error if the file cannot be opened either locally or remotely. diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index 3ba2dab18f6..f86c26390c4 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -411,7 +411,7 @@ gdbscm_register_breakpoint_x (SCM self) { breakpoint_smob *bp_smob = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - struct gdb_exception except = exception_none; + struct gdb_exception except; const char *location, *copy; /* We only support registering breakpoints created with make-breakpoint. */ diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index ca271dbab5c..f3795f83f72 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -777,7 +777,7 @@ gdbscm_frame_read_register (SCM self, SCM register_scm) gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s", register_scm, ®ister_str); - struct gdb_exception except = exception_none; + struct gdb_exception except; try { @@ -864,7 +864,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) } else if (scm_is_string (symbol_scm)) { - struct gdb_exception except = exception_none; + struct gdb_exception except; if (! SCM_UNBNDP (block_scm)) { diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index a55deabf56c..cc10806d97e 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -1056,7 +1056,7 @@ gdbscm_parameter_value (SCM self) struct cmd_list_element *alias, *prefix, *cmd; char *newarg; int found = -1; - struct gdb_exception except = exception_none; + struct gdb_exception except; gdb::unique_xmalloc_ptr name = gdbscm_scm_to_host_string (self, NULL, &except_scm); diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index c135ff5ac37..ab39123dff0 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -614,7 +614,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) } } - struct gdb_exception except = exception_none; + struct gdb_exception except; try { symbol = lookup_symbol (name, block, (domain_enum) domain, @@ -646,7 +646,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) int domain_arg_pos = -1; int domain = VAR_DOMAIN; struct symbol *symbol = NULL; - struct gdb_exception except = exception_none; + struct gdb_exception except; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", name_scm, &name, rest, diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 5bbc3e8b8df..00d1c182e72 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -1048,7 +1048,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest) char *encoding = NULL; int length = -1; SCM result = SCM_BOOL_F; /* -Wall */ - struct gdb_exception except = exception_none; + struct gdb_exception except; /* The sequencing here, as everywhere else, is important. We can't have existing cleanups when a Scheme exception is thrown. */ diff --git a/gdb/infcall.c b/gdb/infcall.c index c102b301e00..52f9bc907e2 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -568,7 +568,7 @@ static struct gdb_exception run_inferior_call (struct call_thread_fsm *sm, struct thread_info *call_thread, CORE_ADDR real_pc) { - struct gdb_exception caught_error = exception_none; + struct gdb_exception caught_error; int saved_in_infcall = call_thread->control.in_infcall; ptid_t call_thread_ptid = call_thread->ptid; enum prompt_state saved_prompt_state = current_ui->prompt_state; diff --git a/gdb/linespec.c b/gdb/linespec.c index c42ddba7315..6d26638296e 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2508,7 +2508,7 @@ parse_linespec (linespec_parser *parser, const char *arg, symbol_name_match_type match_type) { linespec_token token; - struct gdb_exception file_exception = exception_none; + struct gdb_exception file_exception; /* A special case to start. It has become quite popular for IDEs to work around bugs in the previous parser by quoting diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 25c79b150ef..4568d398d94 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -181,7 +181,7 @@ gdb_exception mi_interp::exec (const char *command) { mi_execute_command_wrapper (command); - return exception_none; + return gdb_exception (); } void diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 03430e69e39..dfc30f70bb2 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -445,7 +445,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure) gdb::unique_xmalloc_ptr exp_holder; const char *exp = NULL; gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; - struct gdb_exception except = exception_none; + struct gdb_exception except; BPPY_SET_REQUIRE_VALID (self_bp); @@ -515,7 +515,7 @@ static int bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure) { gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self; - struct gdb_exception except = exception_none; + struct gdb_exception except; BPPY_SET_REQUIRE_VALID (self_bp); diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 984cebb101d..1b7e3c24917 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -546,7 +546,7 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw) static PyObject * infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) { - struct gdb_exception except = exception_none; + struct gdb_exception except; Py_ssize_t buf_len; const gdb_byte *buffer; CORE_ADDR addr, length; @@ -682,7 +682,7 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr) static PyObject * infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) { - struct gdb_exception except = exception_none; + struct gdb_exception except; CORE_ADDR start_addr, length; static const char *keywords[] = { "address", "length", "pattern", NULL }; PyObject *start_addr_obj, *length_obj; diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index d3f4de40540..3349802f7fa 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -903,7 +903,7 @@ get_field_type (PyObject *field) static PyObject * valpy_getitem (PyObject *self, PyObject *key) { - struct gdb_exception except = exception_none; + struct gdb_exception except; value_object *self_value = (value_object *) self; gdb::unique_xmalloc_ptr field; struct type *base_class_type = NULL, *field_type = NULL; @@ -1480,7 +1480,7 @@ valpy_absolute (PyObject *self) static int valpy_nonzero (PyObject *self) { - struct gdb_exception except = exception_none; + struct gdb_exception except; value_object *self_value = (value_object *) self; struct type *type; int nonzero = 0; /* Appease GCC warning. */ diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 4145878bf3a..d4cd89c0339 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -479,7 +479,6 @@ gdb_xml_parser::gdb_xml_parser (const char *name, void *user_data) : m_name (name), m_user_data (user_data), - m_error (exception_none), m_last_line (0), m_dtd_name (NULL), m_is_xinclude (false) -- 2.30.2