From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [FYI v3 2/8] Make gdb expression debugging handle OP_F90_RANGE
Date: Tue, 17 May 2016 20:18:00 -0000 [thread overview]
Message-ID: <1463516288-26778-3-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1463516288-26778-1-git-send-email-tom@tromey.com>
print_subexp_standard and dump_subexp_body_standard did not handle
OP_F90_RANGE. Attempting to dump an expression using this opcode
would fail.
This patch adds support for this opcode to these functions.
2016-05-17 Tom Tromey <tom@tromey.com>
* expprint.c: Include f-lang.h.
(print_subexp_standard, dump_subexp_body_standard): Handle
OP_F90_RANGE.
---
gdb/ChangeLog | 6 ++++++
gdb/expprint.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4b0c44b..6bed450 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2016-05-17 Tom Tromey <tom@tromey.com>
+ * expprint.c: Include f-lang.h.
+ (print_subexp_standard, dump_subexp_body_standard): Handle
+ OP_F90_RANGE.
+
+2016-05-17 Tom Tromey <tom@tromey.com>
+
* Makefile.in (init.c): Search .y files for initialization
functions.
diff --git a/gdb/expprint.c b/gdb/expprint.c
index b3337cd..db196a1 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -29,6 +29,7 @@
#include "block.h"
#include "objfiles.h"
#include "valprint.h"
+#include "f-lang.h"
#include <ctype.h>
@@ -559,6 +560,26 @@ print_subexp_standard (struct expression *exp, int *pos,
return;
}
+ case OP_F90_RANGE:
+ {
+ enum f90_range_type range_type;
+
+ range_type = (enum f90_range_type)
+ longest_to_int (exp->elts[pc + 1].longconst);
+ *pos += 2;
+
+ fputs_filtered ("RANGE(", stream);
+ if (range_type == HIGH_BOUND_DEFAULT
+ || range_type == NONE_BOUND_DEFAULT)
+ print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+ fputs_filtered ("..", stream);
+ if (range_type == LOW_BOUND_DEFAULT
+ || range_type == NONE_BOUND_DEFAULT)
+ print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+ fputs_filtered (")", stream);
+ return;
+ }
+
/* Default ops */
default:
@@ -1025,6 +1046,42 @@ dump_subexp_body_standard (struct expression *exp,
elt += 2;
}
break;
+ case OP_F90_RANGE:
+ {
+ enum f90_range_type range_type;
+
+ range_type = (enum f90_range_type)
+ longest_to_int (exp->elts[elt].longconst);
+ elt += 2;
+
+ switch (range_type)
+ {
+ case BOTH_BOUND_DEFAULT:
+ fputs_filtered ("Range '..'", stream);
+ break;
+ case LOW_BOUND_DEFAULT:
+ fputs_filtered ("Range '..EXP'", stream);
+ break;
+ case HIGH_BOUND_DEFAULT:
+ fputs_filtered ("Range 'EXP..'", stream);
+ break;
+ case NONE_BOUND_DEFAULT:
+ fputs_filtered ("Range 'EXP..EXP'", stream);
+ break;
+ default:
+ fputs_filtered ("Invalid Range!", stream);
+ break;
+ }
+
+ if (range_type == HIGH_BOUND_DEFAULT
+ || range_type == NONE_BOUND_DEFAULT)
+ elt = dump_subexp (exp, stream, elt);
+ if (range_type == LOW_BOUND_DEFAULT
+ || range_type == NONE_BOUND_DEFAULT)
+ elt = dump_subexp (exp, stream, elt);
+ }
+ break;
+
default:
case OP_NULL:
case MULTI_SUBSCRIPT:
--
2.5.5
next prev parent reply other threads:[~2016-05-17 20:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 20:18 [FYI v3 0/8] Add Rust language support Tom Tromey
2016-05-17 20:18 ` [FYI v3 1/8] Fix latent yacc-related bug in gdb/Makefile.in init.c rule Tom Tromey
2016-05-17 20:18 ` [FYI v3 3/8] Add self-test framework to gdb Tom Tromey
2016-05-17 20:32 ` Eli Zaretskii
2016-05-17 20:18 ` [FYI v3 7/8] Add Rust documentation Tom Tromey
2016-05-17 20:32 ` Eli Zaretskii
2016-05-17 20:18 ` [FYI v3 4/8] Add array start and end strings to generic_val_print_decorations Tom Tromey
2016-05-17 20:18 ` [FYI v3 8/8] Rename OP_F90_RANGE to OP_RANGE Tom Tromey
2016-05-18 2:31 ` Joel Brobecker
2016-05-17 20:18 ` Tom Tromey [this message]
2016-05-17 20:19 ` [FYI v3 6/8] Update gdb test suite for Rust Tom Tromey
2016-05-17 20:19 ` [FYI v3 5/8] Add support for the Rust language Tom Tromey
2016-05-18 13:46 ` Ulrich Weigand
2016-05-18 16:17 ` Tom Tromey
2016-05-18 16:21 ` Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463516288-26778-3-git-send-email-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).