2013-01-11 14:55:20 +00:00
|
|
|
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
|
|
|
|
Subject: [PATCH] Expand fortran array bounds sizes to LONGEST
|
|
|
|
|
|
|
|
|
|
|
|
--MP_/90J7bck2fqDySEX9JkZtaqL
|
|
|
|
Content-Type: text/plain; charset=US-ASCII
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Content-Disposition: inline
|
|
|
|
|
|
|
|
Hi,
|
|
|
|
|
|
|
|
Range bounds for a gdb type can have LONGEST values for low and high
|
|
|
|
bounds. Fortran range bounds functions however use only int. The larger
|
|
|
|
ranges don't compile by default on gcc, but it is possible to override
|
|
|
|
the check in the compiler by using -fno-range-check. As a result, this
|
|
|
|
check is necessary so that we don't print junk in case of an overflow.
|
|
|
|
|
|
|
|
Attached patch does this expansion and also includes a test case that
|
|
|
|
verifies that the problem is fixed. I have also verified on x86_64 that
|
|
|
|
this patch does not cause any regressions.
|
|
|
|
|
|
|
|
Regards,
|
|
|
|
Siddhesh
|
|
|
|
|
|
|
|
gdb/ChangeLog:
|
|
|
|
|
|
|
|
* f-lang.h (f77_get_upperbound): Return LONGEST.
|
|
|
|
(f77_get_lowerbound): Likewise.
|
|
|
|
* f-typeprint.c (f_type_print_varspec_suffix): Expand
|
|
|
|
UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format
|
|
|
|
print them.
|
|
|
|
(f_type_print_base): Expand UPPER_BOUND to LONGEST. Use
|
|
|
|
plongest to format print it.
|
|
|
|
* f-valprint.c (f77_get_lowerbound): Return LONGEST.
|
|
|
|
(f77_get_upperbound): Likewise.
|
|
|
|
(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
|
|
|
|
LOWER_BOUND to LONGEST.
|
|
|
|
(f77_create_arrayprint_offset_tbl): Likewise.
|
|
|
|
|
|
|
|
testsuite/ChangeLog:
|
|
|
|
|
|
|
|
* gdb.fortran/array-bounds.exp: New test case.
|
|
|
|
* gdb.fortran/array-bounds.f: New test case.
|
|
|
|
|
|
|
|
--MP_/90J7bck2fqDySEX9JkZtaqL
|
|
|
|
Content-Type: text/x-patch
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Content-Disposition: attachment; filename=f77-bounds.patch
|
|
|
|
|
2016-02-29 19:38:18 +00:00
|
|
|
Index: gdb-7.10.50.20151027/gdb/f-lang.h
|
2013-01-11 14:55:20 +00:00
|
|
|
===================================================================
|
2016-02-29 19:38:18 +00:00
|
|
|
--- gdb-7.10.50.20151027.orig/gdb/f-lang.h 2015-11-02 21:25:14.233161097 +0100
|
|
|
|
+++ gdb-7.10.50.20151027/gdb/f-lang.h 2015-11-02 21:25:22.404214860 +0100
|
2014-08-11 14:08:48 +00:00
|
|
|
@@ -62,9 +62,9 @@ struct common_block
|
2013-07-08 14:47:04 +00:00
|
|
|
struct symbol *contents[1];
|
|
|
|
};
|
2013-01-11 14:55:20 +00:00
|
|
|
|
|
|
|
-extern int f77_get_upperbound (struct type *);
|
|
|
|
+extern LONGEST f77_get_upperbound (struct type *);
|
|
|
|
|
|
|
|
-extern int f77_get_lowerbound (struct type *);
|
|
|
|
+extern LONGEST f77_get_lowerbound (struct type *);
|
|
|
|
|
|
|
|
extern void f77_get_dynamic_array_length (struct type *);
|
|
|
|
|
2016-02-29 19:38:18 +00:00
|
|
|
Index: gdb-7.10.50.20151027/gdb/f-typeprint.c
|
2013-01-11 14:55:20 +00:00
|
|
|
===================================================================
|
2016-02-29 19:38:18 +00:00
|
|
|
--- gdb-7.10.50.20151027.orig/gdb/f-typeprint.c 2015-11-02 21:25:14.234161104 +0100
|
|
|
|
+++ gdb-7.10.50.20151027/gdb/f-typeprint.c 2015-11-02 21:25:22.404214860 +0100
|
|
|
|
@@ -171,7 +171,7 @@ f_type_print_varspec_suffix (struct type
|
2013-01-11 14:55:20 +00:00
|
|
|
int show, int passed_a_ptr, int demangled_args,
|
|
|
|
int arrayprint_recurse_level)
|
|
|
|
{
|
|
|
|
- int upper_bound, lower_bound;
|
|
|
|
+ LONGEST upper_bound, lower_bound;
|
|
|
|
|
|
|
|
/* No static variables are permitted as an error call may occur during
|
|
|
|
execution of this function. */
|
2016-02-29 19:38:18 +00:00
|
|
|
@@ -204,7 +204,7 @@ f_type_print_varspec_suffix (struct type
|
2014-08-11 14:08:48 +00:00
|
|
|
|
|
|
|
lower_bound = f77_get_lowerbound (type);
|
|
|
|
if (lower_bound != 1) /* Not the default. */
|
|
|
|
- fprintf_filtered (stream, "%d:", lower_bound);
|
- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9.
The GDB 7.8 features are:
* Python Scripting
- You can now access frame registers from Python scripts.
- New attribute 'producer' for gdb.Symtab objects.
* New Python-based convenience functions:
- $_caller_is(name [, number_of_frames])
- $_caller_matches(regexp [, number_of_frames])
- $_any_caller_is(name [, number_of_frames])
- $_any_caller_matches(regexp [, number_of_frames])
* New commands
- queue-signal signal-name-or-number
Queue a signal to be delivered to the thread when it is resumed.
* On resume, GDB now always passes the signal the program had stopped
for to the thread the signal was sent to, even if the user changed
threads before resuming. Previously GDB would often (but not
always) deliver the signal to the thread that happens to be current
at resume time.
* Conversely, the "signal" command now consistently delivers the
requested signal to the current thread. GDB now asks for
confirmation if the program had stopped for a signal and the user
switched threads meanwhile.
* "breakpoint always-inserted" modes "off" and "auto" merged.
Now, when 'breakpoint always-inserted mode' is set to "off", GDB
won't remove breakpoints from the target until all threads stop,
even in non-stop mode. The "auto" mode has been removed, and "off"
is now the default mode.
* MI changes
- The -list-thread-groups command outputs an exit-code field for
inferiors that have exited.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
|
|
|
+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
|
2014-08-11 14:08:48 +00:00
|
|
|
|
|
|
|
/* Make sure that, if we have an assumed size array, we
|
|
|
|
print out a warning and print the upperbound as '*'. */
|
2016-02-29 19:38:18 +00:00
|
|
|
@@ -214,7 +214,7 @@ f_type_print_varspec_suffix (struct type
|
2014-08-11 14:08:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
upper_bound = f77_get_upperbound (type);
|
|
|
|
- fprintf_filtered (stream, "%d", upper_bound);
|
- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9.
The GDB 7.8 features are:
* Python Scripting
- You can now access frame registers from Python scripts.
- New attribute 'producer' for gdb.Symtab objects.
* New Python-based convenience functions:
- $_caller_is(name [, number_of_frames])
- $_caller_matches(regexp [, number_of_frames])
- $_any_caller_is(name [, number_of_frames])
- $_any_caller_matches(regexp [, number_of_frames])
* New commands
- queue-signal signal-name-or-number
Queue a signal to be delivered to the thread when it is resumed.
* On resume, GDB now always passes the signal the program had stopped
for to the thread the signal was sent to, even if the user changed
threads before resuming. Previously GDB would often (but not
always) deliver the signal to the thread that happens to be current
at resume time.
* Conversely, the "signal" command now consistently delivers the
requested signal to the current thread. GDB now asks for
confirmation if the program had stopped for a signal and the user
switched threads meanwhile.
* "breakpoint always-inserted" modes "off" and "auto" merged.
Now, when 'breakpoint always-inserted mode' is set to "off", GDB
won't remove breakpoints from the target until all threads stop,
even in non-stop mode. The "auto" mode has been removed, and "off"
is now the default mode.
* MI changes
- The -list-thread-groups command outputs an exit-code field for
inferiors that have exited.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
|
|
|
+ fprintf_filtered (stream, "%s", plongest (upper_bound));
|
2014-08-11 14:08:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
|
2016-02-29 19:38:18 +00:00
|
|
|
@@ -283,7 +283,7 @@ void
|
2013-01-11 14:55:20 +00:00
|
|
|
f_type_print_base (struct type *type, struct ui_file *stream, int show,
|
|
|
|
int level)
|
|
|
|
{
|
|
|
|
- int upper_bound;
|
|
|
|
+ LONGEST upper_bound;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
QUIT;
|
2016-02-29 19:38:18 +00:00
|
|
|
@@ -365,7 +365,7 @@ f_type_print_base (struct type *type, st
|
2013-01-11 14:55:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
upper_bound = f77_get_upperbound (type);
|
|
|
|
- fprintf_filtered (stream, "character*%d", upper_bound);
|
|
|
|
+ fprintf_filtered (stream, "character*%s", plongest (upper_bound));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-02-29 19:38:18 +00:00
|
|
|
Index: gdb-7.10.50.20151027/gdb/f-valprint.c
|
2013-01-11 14:55:20 +00:00
|
|
|
===================================================================
|
2016-02-29 19:38:18 +00:00
|
|
|
--- gdb-7.10.50.20151027.orig/gdb/f-valprint.c 2015-11-02 21:25:14.234161104 +0100
|
|
|
|
+++ gdb-7.10.50.20151027/gdb/f-valprint.c 2015-11-02 21:25:22.405214867 +0100
|
- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9.
The GDB 7.8 features are:
* Python Scripting
- You can now access frame registers from Python scripts.
- New attribute 'producer' for gdb.Symtab objects.
* New Python-based convenience functions:
- $_caller_is(name [, number_of_frames])
- $_caller_matches(regexp [, number_of_frames])
- $_any_caller_is(name [, number_of_frames])
- $_any_caller_matches(regexp [, number_of_frames])
* New commands
- queue-signal signal-name-or-number
Queue a signal to be delivered to the thread when it is resumed.
* On resume, GDB now always passes the signal the program had stopped
for to the thread the signal was sent to, even if the user changed
threads before resuming. Previously GDB would often (but not
always) deliver the signal to the thread that happens to be current
at resume time.
* Conversely, the "signal" command now consistently delivers the
requested signal to the current thread. GDB now asks for
confirmation if the program had stopped for a signal and the user
switched threads meanwhile.
* "breakpoint always-inserted" modes "off" and "auto" merged.
Now, when 'breakpoint always-inserted mode' is set to "off", GDB
won't remove breakpoints from the target until all threads stop,
even in non-stop mode. The "auto" mode has been removed, and "off"
is now the default mode.
* MI changes
- The -list-thread-groups command outputs an exit-code field for
inferiors that have exited.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
|
|
|
@@ -43,7 +43,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN
|
2014-08-11 14:08:48 +00:00
|
|
|
/* Array which holds offsets to be applied to get a row's elements
|
|
|
|
for a given array. Array also holds the size of each subarray. */
|
2013-01-11 14:55:20 +00:00
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
|
|
|
f77_get_lowerbound (struct type *type)
|
|
|
|
{
|
2014-08-11 14:08:48 +00:00
|
|
|
if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
|
- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9.
The GDB 7.8 features are:
* Python Scripting
- You can now access frame registers from Python scripts.
- New attribute 'producer' for gdb.Symtab objects.
* New Python-based convenience functions:
- $_caller_is(name [, number_of_frames])
- $_caller_matches(regexp [, number_of_frames])
- $_any_caller_is(name [, number_of_frames])
- $_any_caller_matches(regexp [, number_of_frames])
* New commands
- queue-signal signal-name-or-number
Queue a signal to be delivered to the thread when it is resumed.
* On resume, GDB now always passes the signal the program had stopped
for to the thread the signal was sent to, even if the user changed
threads before resuming. Previously GDB would often (but not
always) deliver the signal to the thread that happens to be current
at resume time.
* Conversely, the "signal" command now consistently delivers the
requested signal to the current thread. GDB now asks for
confirmation if the program had stopped for a signal and the user
switched threads meanwhile.
* "breakpoint always-inserted" modes "off" and "auto" merged.
Now, when 'breakpoint always-inserted mode' is set to "off", GDB
won't remove breakpoints from the target until all threads stop,
even in non-stop mode. The "auto" mode has been removed, and "off"
is now the default mode.
* MI changes
- The -list-thread-groups command outputs an exit-code field for
inferiors that have exited.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
|
|
|
@@ -52,7 +52,7 @@ f77_get_lowerbound (struct type *type)
|
2013-01-11 14:55:20 +00:00
|
|
|
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
|
|
|
f77_get_upperbound (struct type *type)
|
|
|
|
{
|
2014-08-11 14:08:48 +00:00
|
|
|
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|