mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
Turn value_non_lval and value_force_lval into methods
This changes value_non_lval and value_force_lval to be methods of value. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@ -111,7 +111,7 @@ expression::evaluate (struct type *expect_type, enum noside noside)
|
|||||||
|
|
||||||
if (stack_temporaries.has_value ()
|
if (stack_temporaries.has_value ()
|
||||||
&& value_in_thread_stack_temporaries (retval, inferior_thread ()))
|
&& value_in_thread_stack_temporaries (retval, inferior_thread ()))
|
||||||
retval = value_non_lval (retval);
|
retval = retval->non_lval ();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -1820,7 +1820,7 @@ eval_op_postinc (struct type *expect_type, struct expression *exp,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct value *arg3 = value_non_lval (arg1);
|
struct value *arg3 = arg1->non_lval ();
|
||||||
struct value *arg2;
|
struct value *arg2;
|
||||||
|
|
||||||
if (ptrmath_type_p (exp->language_defn, arg1->type ()))
|
if (ptrmath_type_p (exp->language_defn, arg1->type ()))
|
||||||
@ -1854,7 +1854,7 @@ eval_op_postdec (struct type *expect_type, struct expression *exp,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct value *arg3 = value_non_lval (arg1);
|
struct value *arg3 = arg1->non_lval ();
|
||||||
struct value *arg2;
|
struct value *arg2;
|
||||||
|
|
||||||
if (ptrmath_type_p (exp->language_defn, arg1->type ()))
|
if (ptrmath_type_p (exp->language_defn, arg1->type ()))
|
||||||
|
@ -492,7 +492,7 @@ get_call_return_value (struct call_return_meta_info *ri)
|
|||||||
requiring GDB to evaluate the "this" pointer. To evaluate
|
requiring GDB to evaluate the "this" pointer. To evaluate
|
||||||
the this pointer, GDB needs the memory address of the
|
the this pointer, GDB needs the memory address of the
|
||||||
value. */
|
value. */
|
||||||
value_force_lval (retval, ri->struct_addr);
|
retval->force_lval (ri->struct_addr);
|
||||||
push_thread_stack_temporary (thr, retval);
|
push_thread_stack_temporary (thr, retval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
gdb/value.c
30
gdb/value.c
@ -1567,35 +1567,35 @@ make_cv_value (int cnst, int voltl, struct value *v)
|
|||||||
return cv_val;
|
return cv_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a version of ARG that is non-lvalue. */
|
/* See value.h. */
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
value_non_lval (struct value *arg)
|
value::non_lval ()
|
||||||
{
|
{
|
||||||
if (VALUE_LVAL (arg) != not_lval)
|
if (VALUE_LVAL (this) != not_lval)
|
||||||
{
|
{
|
||||||
struct type *enc_type = arg->enclosing_type ();
|
struct type *enc_type = enclosing_type ();
|
||||||
struct value *val = value::allocate (enc_type);
|
struct value *val = value::allocate (enc_type);
|
||||||
|
|
||||||
gdb::copy (arg->contents_all (), val->contents_all_raw ());
|
gdb::copy (contents_all (), val->contents_all_raw ());
|
||||||
val->m_type = arg->m_type;
|
val->m_type = m_type;
|
||||||
val->set_embedded_offset (arg->embedded_offset ());
|
val->set_embedded_offset (embedded_offset ());
|
||||||
val->set_pointed_to_offset (arg->pointed_to_offset ());
|
val->set_pointed_to_offset (pointed_to_offset ());
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
return arg;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write contents of V at ADDR and set its lval type to be LVAL_MEMORY. */
|
/* See value.h. */
|
||||||
|
|
||||||
void
|
void
|
||||||
value_force_lval (struct value *v, CORE_ADDR addr)
|
value::force_lval (CORE_ADDR addr)
|
||||||
{
|
{
|
||||||
gdb_assert (VALUE_LVAL (v) == not_lval);
|
gdb_assert (VALUE_LVAL (this) == not_lval);
|
||||||
|
|
||||||
write_memory (addr, v->contents_raw ().data (), v->type ()->length ());
|
write_memory (addr, contents_raw ().data (), type ()->length ());
|
||||||
v->m_lval = lval_memory;
|
m_lval = lval_memory;
|
||||||
v->m_location.address = addr;
|
m_location.address = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
11
gdb/value.h
11
gdb/value.h
@ -532,6 +532,13 @@ public:
|
|||||||
for LENGTH bits as optimized out. */
|
for LENGTH bits as optimized out. */
|
||||||
void mark_bits_optimized_out (LONGEST offset, LONGEST length);
|
void mark_bits_optimized_out (LONGEST offset, LONGEST length);
|
||||||
|
|
||||||
|
/* Return a version of this that is non-lvalue. */
|
||||||
|
struct value *non_lval ();
|
||||||
|
|
||||||
|
/* Write contents of this value at ADDR and set its lval type to be
|
||||||
|
LVAL_MEMORY. */
|
||||||
|
void force_lval (CORE_ADDR);
|
||||||
|
|
||||||
|
|
||||||
/* Type of value; either not an lval, or one of the various
|
/* Type of value; either not an lval, or one of the various
|
||||||
different possible kinds of lval. */
|
different possible kinds of lval. */
|
||||||
@ -1446,10 +1453,6 @@ extern void preserve_values (struct objfile *);
|
|||||||
|
|
||||||
/* From values.c */
|
/* From values.c */
|
||||||
|
|
||||||
extern struct value *value_non_lval (struct value *);
|
|
||||||
|
|
||||||
extern void value_force_lval (struct value *, CORE_ADDR);
|
|
||||||
|
|
||||||
extern struct value *make_cv_value (int, int, struct value *);
|
extern struct value *make_cv_value (int, int, struct value *);
|
||||||
|
|
||||||
extern void preserve_one_value (struct value *, struct objfile *, htab_t);
|
extern void preserve_one_value (struct value *, struct objfile *, htab_t);
|
||||||
|
Reference in New Issue
Block a user