Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb] Add error_value_not_available
Date: Fri, 24 Apr 2026 19:31:29 +0200	[thread overview]
Message-ID: <20260424173129.2127495-1-tdevries@suse.de> (raw)

Add error_value_not_available, and use it.
---
 gdb/valops.c | 3 +--
 gdb/value.c  | 8 +++++++-
 gdb/value.h  | 4 ++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gdb/valops.c b/gdb/valops.c
index fccadae6cf6..c8b27868a8c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -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),
diff --git a/gdb/value.c b/gdb/value.c
index 2d90780f57a..7213afa8147 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -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>
diff --git a/gdb/value.h b/gdb/value.h
index 201db773a84..0267ee804e1 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -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 ()))
 

base-commit: 989ac09520f7d421a6be515ea6b346c597111eab
-- 
2.51.0


                 reply	other threads:[~2026-04-24 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260424173129.2127495-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox