]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Add error_value_not_available
authorTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 17:30:41 +0000 (19:30 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 17:30:41 +0000 (19:30 +0200)
Add error_value_not_available, and use it.

gdb/valops.c
gdb/value.c
gdb/value.h

index fccadae6cf6450e42531719d45d5d34cfc04227d..c8b27868a8c8639606919ca2d54380eaf996bdfd 100644 (file)
@@ -1227,8 +1227,7 @@ value_assign (struct value *toval, struct value *fromval)
                if (optim)
                  error_value_optimized_out ();
                if (unavail)
-                 throw_error (NOT_AVAILABLE_ERROR,
-                              _("value is not available"));
+                 error_value_not_available ();
              }
 
            modify_field (type, buffer, value_as_long (fromval),
index 2d90780f57aea9416f68c770b46a0d6e00d7e849..7213afa81474e7e20c7f76f8be44ece6e21869b9 100644 (file)
@@ -1127,6 +1127,12 @@ error_value_optimized_out (void)
   throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out"));
 }
 
+void
+error_value_not_available ()
+{
+  throw_error (NOT_AVAILABLE_ERROR, _("value is not available"));
+}
+
 void
 value::require_not_optimized_out () const
 {
@@ -1144,7 +1150,7 @@ void
 value::require_available () const
 {
   if (!m_unavailable.empty ())
-    throw_error (NOT_AVAILABLE_ERROR, _("value is not available"));
+    error_value_not_available ();
 }
 
 gdb::array_view<const gdb_byte>
index 201db773a84f06029911587e562385af9733e843..0267ee804e1180e0b9766f9e7b732b438505aae1 100644 (file)
@@ -987,6 +987,10 @@ struct lval_funcs
 
 [[noreturn]] extern void error_value_optimized_out ();
 
+/* Throw an error complaining that the value is not available.  */
+
+[[noreturn]] extern void error_value_not_available ();
+
 /* Pointer to internal variable.  */
 #define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ()))