[binutils-gdb] Call error_value_optimized_out from value_assign

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=989ac09520f7d421a6be515ea6b346c597111eab

commit 989ac09520f7d421a6be515ea6b346c597111eab
Author: Tom Tromey <[email protected]>
Date:   Tue Apr 21 08:25:04 2026 -0600

    Call error_value_optimized_out from value_assign
    
    value_assign will throw an exception indicating that the value is
    optimized out, but it seemed better to me for it to use the utility
    function error_value_optimized_out.
    
    Approved-By: Tom de Vries <[email protected]>

Diff:
---
 gdb/valops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/valops.c b/gdb/valops.c
index 515e43ccdfa..fccadae6cf6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1225,8 +1225,7 @@ value_assign (struct value *toval, struct value *fromval)
 					   &unavail))
 	      {
 		if (optim)
-		  throw_error (OPTIMIZED_OUT_ERROR,
-			       _("value has been optimized out"));
+		  error_value_optimized_out ();
 		if (unavail)
 		  throw_error (NOT_AVAILABLE_ERROR,
 			       _("value is not available"));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.