[1/3] gdb: Update type of lower bound in value_subscripted_rvalue

Message ID f551323e576c16720dfc01b486434c1ffa22d427.1557088062.git.andrew.burgess@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess May 5, 2019, 8:57 p.m. UTC
  The dynamic lower (and upper) bounds of ranges are stored as type
LONGEST (see union dynamic_prop_data in gdbtypes.h).  In most places
that range bounds are handled they are held in a LONGEST, however in
value_subscripted_rvalue the bound is placed into an int.

This commit changes value_subscripted_rvalue to use LONGEST, there
should be no user visible changes after this commit.

gdb/ChangeLog:

	* valarith.c (value_subscripted_rvalue): Change lowerbound
	parameter type from int to LONGEST.
	* value.h (value_subscripted_rvalue): Likewise in declaration.
---
 gdb/ChangeLog  | 6 ++++++
 gdb/valarith.c | 2 +-
 gdb/value.h    | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)
  

Comments

Tom Tromey May 6, 2019, 1:57 p.m. UTC | #1
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> The dynamic lower (and upper) bounds of ranges are stored as type
Andrew> LONGEST (see union dynamic_prop_data in gdbtypes.h).  In most places
Andrew> that range bounds are handled they are held in a LONGEST, however in
Andrew> value_subscripted_rvalue the bound is placed into an int.

Andrew> This commit changes value_subscripted_rvalue to use LONGEST, there
Andrew> should be no user visible changes after this commit.

Andrew> gdb/ChangeLog:

Andrew> 	* valarith.c (value_subscripted_rvalue): Change lowerbound
Andrew> 	parameter type from int to LONGEST.
Andrew> 	* value.h (value_subscripted_rvalue): Likewise in declaration.

Thanks, this looks good to me.

Tom
  

Patch

diff --git a/gdb/valarith.c b/gdb/valarith.c
index 8d310b504a2..f4372123e67 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -182,7 +182,7 @@  value_subscript (struct value *array, LONGEST index)
    to doubles, but no longer does.  */
 
 struct value *
-value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
+value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound)
 {
   struct type *array_type = check_typedef (value_type (array));
   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
diff --git a/gdb/value.h b/gdb/value.h
index 0756d13b6d7..d505dc9af06 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1149,7 +1149,8 @@  extern struct value *find_function_in_inferior (const char *,
 extern struct value *value_allocate_space_in_inferior (int);
 
 extern struct value *value_subscripted_rvalue (struct value *array,
-					       LONGEST index, int lowerbound);
+					       LONGEST index,
+					       LONGEST lowerbound);
 
 /* User function handler.  */