[3/3] Restrict value_has_address
Commit Message
gdb:
2016-11-21 Yao Qi <yao.qi@linaro.org>
* value.c (value_has_address): Return true if lval is
either lval_memory or lval_register.
---
gdb/value.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On 11/22/2016 03:48 PM, Yao Qi wrote:
> gdb:
>
> 2016-11-21 Yao Qi <yao.qi@linaro.org>
>
> * value.c (value_has_address): Return true if lval is
> either lval_memory or lval_register.
> ---
> gdb/value.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/value.c b/gdb/value.c
> index a093a9a..5ac9123 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -1540,14 +1540,14 @@ value_lval_const (const struct value *value)
> return value->lval;
> }
>
> -/* Return true if VALUE has address, otherwise return false. */
> +/* Return true if VALUE->location.address is valid, otherwise return
> + false. */
I think it'd be clearer to say:
/* Return true if the VALUE's lval uses the value.location.address
union member as location. False otherwise. */
>
> static int
BTW, this could be bool (in patch #1).
Thanks,
Pedro Alves
@@ -1540,14 +1540,14 @@ value_lval_const (const struct value *value)
return value->lval;
}
-/* Return true if VALUE has address, otherwise return false. */
+/* Return true if VALUE->location.address is valid, otherwise return
+ false. */
static int
value_has_address (const struct value *value)
{
- return (value->lval != lval_internalvar
- && value->lval != lval_internalvar_component
- && value->lval != lval_xcallable);
+ return (value->lval == lval_memory
+ || value->lval == lval_register);
}
CORE_ADDR