aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDavid Lecomber <david@lecomber.net>2003-09-15 15:14:12 +0000
committerDavid Lecomber <david@lecomber.net>2003-09-15 15:14:12 +0000
commitb3cacbee3f248b67ae6518c428aeea115a46a50a (patch)
tree06783ec168192ed015035b61897d19976748ef13 /gdb
parent739fea7ba8a3ff657e6d85ecc2389fa79885fb15 (diff)
downloadgdb-b3cacbee3f248b67ae6518c428aeea115a46a50a.zip
gdb-b3cacbee3f248b67ae6518c428aeea115a46a50a.tar.gz
gdb-b3cacbee3f248b67ae6518c428aeea115a46a50a.tar.bz2
2003-09-15 David Lecomber <dsl@sources.redhat.com>
* f-valprint.c: Apply array element printing limits to multi-dimensional arrays
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/f-valprint.c23
2 files changed, 19 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3edad9b..49e1dff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-15 David Lecomber <dsl@sources.redhat.com>
+
+ * f-valprint.c: Apply array element printing limits to multi-dimensional arrays
+
2003-09-14 Michael Chastain <mec@shout.net>
* config/m68k/nm-apollo68v.h: Delete.
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index c51d3f8..e4fcfc0 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -47,7 +47,8 @@ static void f77_print_array (struct type *, char *, CORE_ADDR,
enum val_prettyprint);
static void f77_print_array_1 (int, int, struct type *, char *,
CORE_ADDR, struct ui_file *, int, int, int,
- enum val_prettyprint);
+ enum val_prettyprint,
+ int *elts);
static void f77_create_arrayprint_offset_tbl (struct type *,
struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
@@ -271,31 +272,36 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
}
}
+
+
/* Actual function which prints out F77 arrays, Valaddr == address in
the superior. Address == the address in the inferior. */
-
static void
f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
CORE_ADDR address, struct ui_file *stream, int format,
- int deref_ref, int recurse, enum val_prettyprint pretty)
+ int deref_ref, int recurse, enum val_prettyprint pretty,
+ int *elts)
{
int i;
if (nss != ndimensions)
{
- for (i = 0; i < F77_DIM_SIZE (nss); i++)
+ for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++)
{
fprintf_filtered (stream, "( ");
f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
valaddr + i * F77_DIM_OFFSET (nss),
address + i * F77_DIM_OFFSET (nss),
- stream, format, deref_ref, recurse, pretty);
+ stream, format, deref_ref, recurse, pretty, elts);
fprintf_filtered (stream, ") ");
}
+ if (*elts >= print_max && i < F77_DIM_SIZE (nss)) {
+ fprintf_filtered (stream, "...");
+ }
}
else
{
- for (i = 0; (i < F77_DIM_SIZE (nss) && i < print_max); i++)
+ for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++, (*elts)++)
{
val_print (TYPE_TARGET_TYPE (type),
valaddr + i * F77_DIM_OFFSET (ndimensions),
@@ -306,7 +312,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
if (i != (F77_DIM_SIZE (nss) - 1))
fprintf_filtered (stream, ", ");
- if (i == print_max - 1)
+ if ((( *elts) == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1)))
fprintf_filtered (stream, "...");
}
}
@@ -321,6 +327,7 @@ f77_print_array (struct type *type, char *valaddr, CORE_ADDR address,
enum val_prettyprint pretty)
{
int ndimensions;
+ int elts = 0;
ndimensions = calc_f77_array_dims (type);
@@ -335,7 +342,7 @@ f77_print_array (struct type *type, char *valaddr, CORE_ADDR address,
f77_create_arrayprint_offset_tbl (type, stream);
f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format,
- deref_ref, recurse, pretty);
+ deref_ref, recurse, pretty, &elts);
}