Remove exception_none
authorTom Tromey <tromey@adacore.com>
Tue, 23 Apr 2019 21:31:07 +0000 (15:31 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 25 Apr 2019 18:59:35 +0000 (12:59 -0600)
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  <tromey@adacore.com>

* 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) <exception>: Update.
* cli/cli-interp.c (safe_execute_command): Update.
* breakpoint.c (insert_bp_location, location_to_sals): Update.

19 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/cli/cli-interp.c
gdb/common/common-exceptions.c
gdb/common/common-exceptions.h
gdb/event-top.c
gdb/exec.c
gdb/guile/scm-breakpoint.c
gdb/guile/scm-frame.c
gdb/guile/scm-param.c
gdb/guile/scm-symbol.c
gdb/guile/scm-value.c
gdb/infcall.c
gdb/linespec.c
gdb/mi/mi-interp.c
gdb/python/py-breakpoint.c
gdb/python/py-inferior.c
gdb/python/py-value.c
gdb/xml-support.c

index 5167cc2..106f0e6 100644 (file)
@@ -1,3 +1,30 @@
+2019-04-25  Tom Tromey  <tromey@adacore.com>
+
+       * 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) <exception>: Update.
+       * cli/cli-interp.c (safe_execute_command): Update.
+       * breakpoint.c (insert_bp_location, location_to_sals): Update.
+
 2019-04-25  Ali Tamur  <tamur@google.com>
 
        * dwarf2read.c (skip_one_die): Add DW_FORM_strx.
index 3047ef3..c74fc61 100644 (file)
@@ -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<symtab_and_line>
 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);
 
index c150f40..17639d0 100644 (file)
@@ -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 (&current_uiout,
index 6378dc4..59c27ab 100644 (file)
@@ -21,8 +21,6 @@
 #include "common-exceptions.h"
 #include <forward_list>
 
-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().  */
index 3f47cae..33fa8a9 100644 (file)
@@ -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 */
index cd54eb5..959792d 100644 (file)
@@ -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
index b0eb9ff..7ff77f9 100644 (file)
@@ -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.
index 3ba2dab..f86c263 100644 (file)
@@ -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.  */
index ca271db..f3795f8 100644 (file)
@@ -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, &register_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))
        {
index a55deab..cc10806 100644 (file)
@@ -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<char> name
        = gdbscm_scm_to_host_string (self, NULL, &except_scm);
index c135ff5..ab39123 100644 (file)
@@ -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,
index 5bbc3e8..00d1c18 100644 (file)
@@ -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.  */
index c102b30..52f9bc9 100644 (file)
@@ -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;
index c42ddba..6d26638 100644 (file)
@@ -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
index 25c79b1..4568d39 100644 (file)
@@ -181,7 +181,7 @@ gdb_exception
 mi_interp::exec (const char *command)
 {
   mi_execute_command_wrapper (command);
-  return exception_none;
+  return gdb_exception ();
 }
 
 void
index 03430e6..dfc30f7 100644 (file)
@@ -445,7 +445,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
   gdb::unique_xmalloc_ptr<char> 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);
 
index 984cebb..1b7e3c2 100644 (file)
@@ -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;
index d3f4de4..3349802 100644 (file)
@@ -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<char> 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.  */
index 4145878..d4cd89c 100644 (file)
@@ -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)