Blame SOURCES/gdb-rhbz795424-bitpos-25of25.patch

6240d7
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
6240d7
From: Fedora GDB patches <invalid@email.com>
6240d7
Date: Fri, 27 Oct 2017 21:07:50 +0200
6240d7
Subject: gdb-rhbz795424-bitpos-25of25.patch
6240d7
6240d7
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
6240d7
;; (RH BZ 795424).
6240d7
;;=push
6240d7
6240d7
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
6240d7
6240d7
--MP_/90J7bck2fqDySEX9JkZtaqL
6240d7
Content-Type: text/plain; charset=US-ASCII
6240d7
Content-Transfer-Encoding: 7bit
6240d7
Content-Disposition: inline
6240d7
6240d7
Hi,
6240d7
6240d7
Range bounds for a gdb type can have LONGEST values for low and high
6240d7
bounds. Fortran range bounds functions however use only int. The larger
6240d7
ranges don't compile by default on gcc, but it is possible to override
6240d7
the check in the compiler by using -fno-range-check. As a result, this
6240d7
check is necessary so that we don't print junk in case of an overflow.
6240d7
6240d7
Attached patch does this expansion and also includes a test case that
6240d7
verifies that the problem is fixed. I have also verified on x86_64 that
6240d7
this patch does not cause any regressions.
6240d7
6240d7
Regards,
6240d7
Siddhesh
6240d7
6240d7
gdb/ChangeLog:
6240d7
6240d7
	* f-lang.h (f77_get_upperbound): Return LONGEST.
6240d7
	(f77_get_lowerbound): Likewise.
6240d7
	* f-typeprint.c (f_type_print_varspec_suffix): Expand
6240d7
	UPPER_BOUND and LOWER_BOUND to LONGEST.  Use plongest to format
6240d7
	print them.
6240d7
	(f_type_print_base): Expand UPPER_BOUND to LONGEST.  Use
6240d7
	plongest to format print it.
6240d7
	* f-valprint.c (f77_get_lowerbound): Return LONGEST.
6240d7
	(f77_get_upperbound): Likewise.
6240d7
	(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
6240d7
	LOWER_BOUND to LONGEST.
6240d7
	(f77_create_arrayprint_offset_tbl): Likewise.
6240d7
6240d7
testsuite/ChangeLog:
6240d7
6240d7
	* gdb.fortran/array-bounds.exp: New test case.
6240d7
	* gdb.fortran/array-bounds.f: New test case.
6240d7
6240d7
--MP_/90J7bck2fqDySEX9JkZtaqL
6240d7
Content-Type: text/x-patch
6240d7
Content-Transfer-Encoding: 7bit
6240d7
Content-Disposition: attachment; filename=f77-bounds.patch
6240d7
6240d7
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
6240d7
--- a/gdb/f-lang.h
6240d7
+++ b/gdb/f-lang.h
6240d7
@@ -50,9 +50,9 @@ struct common_block
6240d7
   struct symbol *contents[1];
6240d7
 };
6240d7
 
6240d7
-extern int f77_get_upperbound (struct type *);
6240d7
+extern LONGEST f77_get_upperbound (struct type *);
6240d7
 
6240d7
-extern int f77_get_lowerbound (struct type *);
6240d7
+extern LONGEST f77_get_lowerbound (struct type *);
6240d7
 
6240d7
 extern void f77_get_dynamic_array_length (struct type *);
6240d7
 
6240d7
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
6240d7
--- a/gdb/f-typeprint.c
6240d7
+++ b/gdb/f-typeprint.c
6240d7
@@ -149,7 +149,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
6240d7
 			     int show, int passed_a_ptr, int demangled_args,
6240d7
 			     int arrayprint_recurse_level, int print_rank_only)
6240d7
 {
6240d7
-  int upper_bound, lower_bound;
6240d7
+  LONGEST upper_bound, lower_bound;
6240d7
 
6240d7
   /* No static variables are permitted as an error call may occur during
6240d7
      execution of this function.  */
6240d7
@@ -196,7 +196,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
6240d7
 	{
6240d7
 	  lower_bound = f77_get_lowerbound (type);
6240d7
 	  if (lower_bound != 1)	/* Not the default.  */
6240d7
-	    fprintf_filtered (stream, "%d:", lower_bound);
6240d7
+	    fprintf_filtered (stream, "%s:", plongest (lower_bound));
6240d7
 
6240d7
 	  /* Make sure that, if we have an assumed size array, we
6240d7
 	       print out a warning and print the upperbound as '*'.  */
6240d7
@@ -206,7 +206,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
6240d7
 	  else
6240d7
 	    {
6240d7
 	      upper_bound = f77_get_upperbound (type);
6240d7
-	      fprintf_filtered (stream, "%d", upper_bound);
6240d7
+	      fprintf_filtered (stream, "%s", plongest (upper_bound));
6240d7
 	    }
6240d7
 	}
6240d7
 
6240d7
@@ -278,7 +278,7 @@ void
6240d7
 f_type_print_base (struct type *type, struct ui_file *stream, int show,
6240d7
 		   int level)
6240d7
 {
6240d7
-  int upper_bound;
6240d7
+  LONGEST upper_bound;
6240d7
   int index;
6240d7
 
6240d7
   QUIT;
6240d7
@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
6240d7
       else
6240d7
 	{
6240d7
 	  upper_bound = f77_get_upperbound (type);
6240d7
-	  fprintf_filtered (stream, "character*%d", upper_bound);
6240d7
+	  fprintf_filtered (stream, "character*%s", plongest (upper_bound));
6240d7
 	}
6240d7
       break;
6240d7
 
6240d7
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
6240d7
--- a/gdb/f-valprint.c
6240d7
+++ b/gdb/f-valprint.c
6240d7
@@ -41,7 +41,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
6240d7
 /* Array which holds offsets to be applied to get a row's elements
6240d7
    for a given array.  Array also holds the size of each subarray.  */
6240d7
 
6240d7
-int
6240d7
+LONGEST
6240d7
 f77_get_lowerbound (struct type *type)
6240d7
 {
6240d7
   if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
6240d7
@@ -50,7 +50,7 @@ f77_get_lowerbound (struct type *type)
6240d7
   return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
6240d7
 }
6240d7
 
6240d7
-int
6240d7
+LONGEST
6240d7
 f77_get_upperbound (struct type *type)
6240d7
 {
6240d7
   if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))