]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Add const to catch gdb_exception
authorTom de Vries <tdevries@suse.de>
Thu, 22 Aug 2024 07:49:53 +0000 (09:49 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 22 Aug 2024 07:49:53 +0000 (09:49 +0200)
I did a review of lines containing "catch (gdb_exception" and found a few
where we can add const.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/exec.c
gdb/python/py-breakpoint.c
gdb/python/py-inferior.c
gdb/python/py-value.c
gdb/unittests/scoped_mmap-selftests.c

index 63eee4297bc49036f40a105775a3b0eb86ad1467..683b0a17b1415c7b25944d33a625062868d9edda 100644 (file)
@@ -294,7 +294,7 @@ validate_exec_file (int from_tty)
              symbol_file_add_main (exec_file_target.c_str (), add_flags);
              exec_file_attach (exec_file_target.c_str (), from_tty);
            }
-         catch (gdb_exception_error &err)
+         catch (const gdb_exception_error &err)
            {
              warning (_("loading %ps %s"),
                       styled_string (file_name_style.style (),
index e7dd47020c58b67aca16c07e212957bbee02629d..74013977f0d64e3a512796185983be8dedd9058f 100644 (file)
@@ -611,7 +611,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
     {
       set_breakpoint_condition (self_bp->bp, exp, 0, false);
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       GDB_PY_SET_HANDLE_EXCEPTION (ex);
     }
@@ -677,7 +677,7 @@ bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
       counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
       breakpoint_set_commands (self_bp->bp, std::move (lines));
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       GDB_PY_SET_HANDLE_EXCEPTION (ex);
     }
index a1042ee72ac733091f7572bc04b072546d3c1519..ccc3e881702ab628bd8e676d9643fe39aba4bff7 100644 (file)
@@ -631,7 +631,7 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
 
       write_memory_with_notification (addr, buffer, length);
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       GDB_PY_HANDLE_EXCEPTION (ex);
     }
@@ -705,7 +705,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
                                    buffer, pattern_size,
                                    &found_addr);
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       GDB_PY_HANDLE_EXCEPTION (ex);
     }
index 5c62ef681d4a2714876f7cda1b529cc4fe4a545a..4980076a0ef4af5e7d163fa5695038b1f5911ade 100644 (file)
@@ -1178,7 +1178,7 @@ valpy_getitem (PyObject *self, PyObject *key)
       if (res_val)
        result = value_to_value_object (res_val);
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       GDB_PY_HANDLE_EXCEPTION (ex);
     }
@@ -1704,7 +1704,7 @@ valpy_nonzero (PyObject *self)
        /* All other values are True.  */
        nonzero = 1;
     }
-  catch (gdb_exception &ex)
+  catch (const gdb_exception &ex)
     {
       /* This is not documented in the Python documentation, but if
         this function fails, return -1 as slot_nb_nonzero does (the
index 7b3a6f5202b4ef7c6e56d71b86c66260885d2762..09a94ed6590e649ff26ec05c9286eb5899a7dab2 100644 (file)
@@ -114,7 +114,7 @@ test_invalid_filename ()
 
   try {
       ::scoped_mmap m = ::mmap_file ("/this/file/should/not/exist");
-  } catch (gdb_exception &e) {
+  } catch (const gdb_exception &e) {
       threw = true;
   }