[PATCH 08/12] Replace some value_optimized_out with value_entirely_available

Andrew Burgess
2013-08-12T12:29:15Z

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;