Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 08/12] Replace some value_optimized_out with value_entirely_available
Date: Mon, 12 Aug 2013 12:29:00 -0000	[thread overview]
Message-ID: <5208D50F.8020109@broadcom.com> (raw)
In-Reply-To: <5208D1DF.1090201@broadcom.com>

A few places where we use value_optimized_out to check that
the value is entirely available, this fails to take into
account the unavailable status of the value.

Fix by using value_entirely_available instead.

OK to apply?

thanks,
Andrew

gdb/ChangeLog

2013-08-09  Andrew Burgess  <aburgess@broadcom.com>

	* frame.c (frame_unwind_register_value): Use
	value_entirely_available rather than value_optimized_out.
	* infrun.c (insert_exception_resume_breakpoint): Likewise.
	* mips-tdep.c (mips_print_register): Likewise.
	* s390-tdep.c (s390_unwind_pseudo_register): Likewise.
	* stack.c (read_frame_arg): Likewise.
	* value.c (value_fetch_lazy): Likewise.

diff --git a/gdb/frame.c b/gdb/frame.c
index c5d85b4..edac6e7 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -44,6 +44,7 @@
 #include "inline-frame.h"
 #include "tracepoint.h"
 #include "hashtab.h"
+#include "valprint.h"
  static struct frame_info *get_prev_frame_1 (struct frame_info
*this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info
*this_frame);
@@ -1035,8 +1036,11 @@ frame_unwind_register_value (struct frame_info
*frame, int regnum)
   if (frame_debug)
     {
       fprintf_unfiltered (gdb_stdlog, "->");
-      if (value_optimized_out (value))
-	fprintf_unfiltered (gdb_stdlog, " optimized out");
+      if (!value_entirely_available (value))
+	{
+	  fprintf_unfiltered (gdb_stdlog, " ");
+	  val_print_unavailability_reason (value, gdb_stdlog);
+	}
       else
 	{
 	  if (VALUE_LVAL (value) == lval_register)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index dc1036d..eaa85b5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5547,7 +5547,7 @@ insert_exception_resume_breakpoint (struct
thread_info *tp,
       vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN,
NULL);
       value = read_var_value (vsym, frame);
       /* If the value was optimized out, revert to the old behavior.  */
-      if (! value_optimized_out (value))
+      if (value_entirely_available (value))
 	{
 	  handler = value_as_address (value);
 diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index bcbdcc5..ba73501 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6196,7 +6196,7 @@ mips_print_register (struct ui_file *file, struct
frame_info *frame,
     }
    val = get_frame_register_value (frame, regnum);
-  if (value_optimized_out (val))
+  if (!value_entirely_available (val))
     {
       fprintf_filtered (file, "%s: [Invalid]",
 			gdbarch_register_name (gdbarch, regnum));
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 72d5545..16b1779 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1689,7 +1689,7 @@ s390_unwind_pseudo_register (struct frame_info
*this_frame, int regnum)
       struct value *val;
        val = frame_unwind_register_value (this_frame, S390_PSWA_REGNUM);
-      if (!value_optimized_out (val))
+      if (value_entirely_available (val))
 	{
 	  LONGEST pswa = value_as_long (val);
 @@ -1706,7 +1706,7 @@ s390_unwind_pseudo_register (struct frame_info
*this_frame, int regnum)
       struct value *val;
        val = frame_unwind_register_value (this_frame, S390_PSWM_REGNUM);
-      if (!value_optimized_out (val))
+      if (value_entirely_available (val))
 	{
 	  LONGEST pswm = value_as_long (val);
 @@ -1727,7 +1727,7 @@ s390_unwind_pseudo_register (struct frame_info
*this_frame, int regnum)
       struct value *val;
        val = frame_unwind_register_value (this_frame, S390_R0_REGNUM +
reg);
-      if (!value_optimized_out (val))
+      if (value_entirely_available (val))
 	return value_cast (type, val);
     }
 diff --git a/gdb/stack.c b/gdb/stack.c
index af05f84..cec5df5 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -353,7 +353,7 @@ read_frame_arg (struct symbol *sym, struct
frame_info *frame,
       && SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
       && print_entry_values != print_entry_values_no
       && (print_entry_values != print_entry_values_if_needed
-	  || !val || value_optimized_out (val)))
+	  || !val || !value_entirely_available (val)))
     {
       TRY_CATCH (except, RETURN_MASK_ERROR)
 	{
@@ -369,7 +369,7 @@ read_frame_arg (struct symbol *sym, struct
frame_info *frame,
 	}
        if (except.error == NO_ENTRY_VALUE_ERROR
-	  || (entryval && value_optimized_out (entryval)))
+	  || (entryval && !value_entirely_available (entryval)))
 	{
 	  entryval = NULL;
 	  entryval_error = NULL;
@@ -468,13 +468,13 @@ read_frame_arg (struct symbol *sym, struct
frame_info *frame,
       if (print_entry_values == print_entry_values_only
 	  || print_entry_values == print_entry_values_both
 	  || (print_entry_values == print_entry_values_preferred
-	      && (!val || value_optimized_out (val))))
+	      && (!val || !value_entirely_available (val))))
 	entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym));
     }
   if ((print_entry_values == print_entry_values_compact
        || print_entry_values == print_entry_values_if_needed
        || print_entry_values == print_entry_values_preferred)
-      && (!val || value_optimized_out (val)) && entryval != NULL)
+      && (!val || !value_entirely_available (val)) && entryval != NULL)
     {
       val = NULL;
       val_error = NULL;
diff --git a/gdb/value.c b/gdb/value.c
index b9f5709..19ba16c 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3598,8 +3598,11 @@ value_fetch_lazy (struct value *val)
 			      user_reg_map_regnum_to_name (gdbarch, regnum));
  	  fprintf_unfiltered (gdb_stdlog, "->");
-	  if (value_optimized_out (new_val))
-	    fprintf_unfiltered (gdb_stdlog, " optimized out");
+	  if (!value_entirely_available (new_val))
+	    {
+	      fprintf_unfiltered (gdb_stdlog, " ");
+	      val_print_unavailability_reason (new_val, gdb_stdlog);
+	    }
 	  else
 	    {
 	      int i;



  parent reply	other threads:[~2013-08-12 12:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 12:15 [RFC 00/12] Merge value optimized_out and unavailable Andrew Burgess
2013-08-12 12:16 ` [PATCH 01/12] Introduce is_unavailable_error Andrew Burgess
2013-08-12 12:18 ` [PATCH 02/12]: Remove set_value_optimized_out Andrew Burgess
2013-08-12 12:20 ` [PATCH 03/12] Mark optimized out values as non-lazy Andrew Burgess
2013-11-26 16:38   ` Pedro Alves
2013-11-26 19:19     ` Andrew Burgess
2013-08-12 12:22 ` [PATCH 04/12] Introduce OPTIMIZED_OUT_ERROR Andrew Burgess
2013-08-12 12:24 ` [PATCH 05/12] Convert the unavailable to be bit based Andrew Burgess
2013-08-12 12:27 ` [PATCH 06/12] Delete value_bits_valid Andrew Burgess
2013-11-25 21:41   ` [PATCH] Print entirely unavailable struct/union values as a single <unavailable>. (Re: [PATCH 06/12] Delete value_bits_valid.) Pedro Alves
2013-11-26 10:13     ` Andrew Burgess
2013-11-28 20:14       ` Pedro Alves
2013-08-12 12:28 ` [PATCH 07/12] Generic print unavailable or optimized out function Andrew Burgess
2013-08-12 12:29 ` Andrew Burgess [this message]
2013-11-27 17:52   ` [COMMITTED PATCH 0/2] "set debug frame 1" and not saved registers (was: Re: [PATCH 08/12] Replace some value_optimized_out with value_entirely_available) Pedro Alves
2013-11-27 18:14     ` [PATCH 1/2] Make "set debug frame 1" use the standard print routine for optimized out values Pedro Alves
2013-11-27 18:35     ` [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out> Pedro Alves
2013-11-27 18:41       ` Pedro Alves
2013-11-27 18:53         ` [pushed] Fix type of not saved registers. (was: Re: [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out>.) Pedro Alves
2013-08-12 12:30 ` [PATCH 09/12] DWARF value, mark unavailable in bits not bytes Andrew Burgess
2013-08-12 12:31 ` [PATCH 10/12] Merge optimized_out into unavailable vector Andrew Burgess
2013-08-12 12:32 ` [PATCH 11/12] Add test mechanism for value " Andrew Burgess
2013-08-12 12:33 ` [PATCH 12/12] Remove old lval check valid functions Andrew Burgess
2013-08-29 17:21 ` PING: Re: [RFC 00/12] Merge value optimized_out and unavailable Andrew Burgess
2013-11-12  9:37   ` Andrew Burgess
2013-11-29 22:31 ` Pedro Alves
2013-12-04 14:54   ` Andrew Burgess

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=5208D50F.8020109@broadcom.com \
    --to=aburgess@broadcom.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