Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] New OPTIMIZED_OUT_ERROR error code.
Date: Fri, 29 Nov 2013 20:39:00 -0000	[thread overview]
Message-ID: <1385756149-534-2-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1385756149-534-1-git-send-email-palves@redhat.com>

In order to catch <optimized out> errors like we catch <unavailable>
errors, this adds a new OPTIMIZED_OUT_ERROR error code, and throws it
in various places.

gdb/ChangeLog
2013-11-29  Andrew Burgess  <aburgess@broadcom.com>
	    Pedro Alves  <palves@redhat.com>

	* exceptions.h (errors): Add OPTIMIZED_OUT_ERROR.
	* dwarf2loc.c (write_pieced_value): Throw OPTIMIZED_OUT_ERROR.
	* frame.c (frame_unwind_register): Throw OPTIMIZED_OUT_ERROR.
	* spu-tdep.c (spu_software_single_step): Throw
	OPTIMIZED_OUT_ERROR.
	* valops.c (value_assign): Throw OPTIMIZED_OUT_ERROR.
---
 gdb/dwarf2loc.c  | 7 ++++---
 gdb/exceptions.h | 4 ++++
 gdb/frame.c      | 3 ++-
 gdb/spu-tdep.c   | 5 +++--
 gdb/valops.c     | 3 ++-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 2d15546..2b1f323 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1893,9 +1893,10 @@ write_pieced_value (struct value *to, struct value *from)
 						   &optim, &unavail))
 		      {
 			if (optim)
-			  error (_("Can't do read-modify-write to "
-				   "update bitfield; containing word has been "
-				   "optimized out"));
+			  throw_error (OPTIMIZED_OUT_ERROR,
+				       _("Can't do read-modify-write to "
+					 "update bitfield; containing word "
+					 "has been optimized out"));
 			if (unavail)
 			  throw_error (NOT_AVAILABLE_ERROR,
 				       _("Can't do read-modify-write to update "
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index 129d29a..237764d 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -86,6 +86,10 @@ enum errors {
      traceframe.  */
   NOT_AVAILABLE_ERROR,
 
+  /* Value was optimized out.  Note: if the value was a register, this
+     means the register was not saved in the frame.  */
+  OPTIMIZED_OUT_ERROR,
+
   /* DW_OP_GNU_entry_value resolving failed.  */
   NO_ENTRY_VALUE_ERROR,
 
diff --git a/gdb/frame.c b/gdb/frame.c
index db94d98..69a8059 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1007,7 +1007,8 @@ frame_unwind_register (struct frame_info *frame, int regnum, gdb_byte *buf)
 			 &lval, &addr, &realnum, buf);
 
   if (optimized)
-    error (_("Register %d was not saved"), regnum);
+    throw_error (OPTIMIZED_OUT_ERROR,
+		 _("Register %d was not saved"), regnum);
   if (unavailable)
     throw_error (NOT_AVAILABLE_ERROR,
 		 _("Register %d is not available"), regnum);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index fd54b1e..fdf435e 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1614,8 +1614,9 @@ spu_software_single_step (struct frame_info *frame)
 	  else
 	    {
 	      if (optim)
-		error (_("Could not determine address of "
-			 "single-step breakpoint."));
+		throw_error (OPTIMIZED_OUT_ERROR,
+			     _("Could not determine address of "
+			       "single-step breakpoint."));
 	      if (unavail)
 		throw_error (NOT_AVAILABLE_ERROR,
 			     _("Could not determine address of "
diff --git a/gdb/valops.c b/gdb/valops.c
index 8e7b16f..d43c758 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1188,7 +1188,8 @@ value_assign (struct value *toval, struct value *fromval)
 					       &optim, &unavail))
 		  {
 		    if (optim)
-		      error (_("value has been optimized out"));
+		      throw_error (OPTIMIZED_OUT_ERROR,
+				   _("value has been optimized out"));
 		    if (unavail)
 		      throw_error (NOT_AVAILABLE_ERROR,
 				   _("value is not available"));
-- 
1.7.11.7


  parent reply	other threads:[~2013-11-29 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 20:16 [PATCH 0/2] Fix "info frame" in the outermost frame Pedro Alves
2013-11-29 20:20 ` [PATCH 2/2] " Pedro Alves
2013-12-02  9:04   ` Yao Qi
2013-12-02 10:05     ` Pedro Alves
     [not found]   ` <52A3DBA6.6060706@codesourcery.com>
2013-12-09 10:58     ` Pedro Alves
2013-11-29 20:39 ` Pedro Alves [this message]
2013-12-02 13:53   ` [PATCH 1/2] New OPTIMIZED_OUT_ERROR error code Andrew Burgess
2013-12-06 20:01 ` [PATCH 0/2] Fix "info frame" in the outermost frame Pedro Alves

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=1385756149-534-2-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --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