gdb: Convert dwarf2_evaluate_property to return bool

Convert dwarf2_evaluate_property to return a bool, there should be no
user visible change after this commit.

gdb/ChangeLog:

	* dwarf2loc.c (dwarf2_evaluate_property): Change return type, and
	update return statements.
	* dwarf2loc.h (dwarf2_evaluate_property): Update return type on
	declaration, and update comment to match.
	* gdbtypes.c (resolve_dynamic_array): Update call to
	dwarf2_evaluate_property to match new return type.
This commit is contained in:
Andrew Burgess 2019-05-05 00:15:07 +01:00
parent 592f9d271c
commit 603490bf53
4 changed files with 23 additions and 17 deletions

View file

@ -1,3 +1,12 @@
2019-07-12 Andrew Burgess <andrew.burgess@embecosm.com>
* dwarf2loc.c (dwarf2_evaluate_property): Change return type, and
update return statements.
* dwarf2loc.h (dwarf2_evaluate_property): Update return type on
declaration, and update comment to match.
* gdbtypes.c (resolve_dynamic_array): Update call to
dwarf2_evaluate_property to match new return type.
2019-07-12 Andrew Burgess <andrew.burgess@embecosm.com> 2019-07-12 Andrew Burgess <andrew.burgess@embecosm.com>
* valarith.c (value_subscripted_rvalue): Change lowerbound * valarith.c (value_subscripted_rvalue): Change lowerbound

View file

@ -2425,14 +2425,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
/* See dwarf2loc.h. */ /* See dwarf2loc.h. */
int bool
dwarf2_evaluate_property (const struct dynamic_prop *prop, dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct frame_info *frame, struct frame_info *frame,
struct property_addr_info *addr_stack, struct property_addr_info *addr_stack,
CORE_ADDR *value) CORE_ADDR *value)
{ {
if (prop == NULL) if (prop == NULL)
return 0; return false;
if (frame == NULL && has_stack_frames ()) if (frame == NULL && has_stack_frames ())
frame = get_selected_frame (NULL); frame = get_selected_frame (NULL);
@ -2454,7 +2454,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
*value = value_as_address (val); *value = value_as_address (val);
} }
return 1; return true;
} }
} }
break; break;
@ -2476,7 +2476,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
if (!value_optimized_out (val)) if (!value_optimized_out (val))
{ {
*value = value_as_address (val); *value = value_as_address (val);
return 1; return true;
} }
} }
} }
@ -2484,7 +2484,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
case PROP_CONST: case PROP_CONST:
*value = prop->data.const_val; *value = prop->data.const_val;
return 1; return true;
case PROP_ADDR_OFFSET: case PROP_ADDR_OFFSET:
{ {
@ -2510,11 +2510,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
val = value_at (baton->offset_info.type, val = value_at (baton->offset_info.type,
pinfo->addr + baton->offset_info.offset); pinfo->addr + baton->offset_info.offset);
*value = value_as_address (val); *value = value_as_address (val);
return 1; return true;
} }
} }
return 0; return false;
} }
/* See dwarf2loc.h. */ /* See dwarf2loc.h. */

View file

@ -135,13 +135,13 @@ struct property_addr_info
property. When evaluating a property that is not related to a type, it can property. When evaluating a property that is not related to a type, it can
be NULL. be NULL.
Returns 1 if PROP could be converted and the static value is passed back Returns true if PROP could be converted and the static value is passed
into VALUE, otherwise returns 0. */ back into VALUE, otherwise returns false. */
int dwarf2_evaluate_property (const struct dynamic_prop *prop, bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
struct frame_info *frame, struct frame_info *frame,
struct property_addr_info *addr_stack, struct property_addr_info *addr_stack,
CORE_ADDR *value); CORE_ADDR *value);
/* A helper for the compiler interface that compiles a single dynamic /* A helper for the compiler interface that compiles a single dynamic
property to C code. property to C code.

View file

@ -2065,10 +2065,7 @@ resolve_dynamic_array (struct type *type,
prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type); prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
if (prop != NULL) if (prop != NULL)
{ {
int prop_eval_ok if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
= dwarf2_evaluate_property (prop, NULL, addr_stack, &value);
if (prop_eval_ok)
{ {
remove_dyn_prop (DYN_PROP_BYTE_STRIDE, type); remove_dyn_prop (DYN_PROP_BYTE_STRIDE, type);
bit_stride = (unsigned int) (value * 8); bit_stride = (unsigned int) (value * 8);