[04/11] gdb/fortran: Add new function to evaluate Fortran expressions

Message ID 5c5ee058f80a793f7861fa465c4c6ca4b73c222c.1549986233.git.andrew.burgess@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess Feb. 12, 2019, 4:10 p.m. UTC
  This is an initial restructure, it adds a new function in which
Fortran specific expressions can be evaluated.  No Fortran specific
expressions are added with this commit though, so for now, the new
function just forwards all expressions to the default expression
handler, as such, there should be no user visible changes after this
commit.  However, the new function will be useful in later commits.

gdb/ChangeLog:

	* f-lang.c (evaluate_subexp_f): New function.
	(exp_descriptor_f): New global.
	(f_language_defn): Use exp_descriptor_f instead of
	exp_descriptor_standard.
---
 gdb/ChangeLog |  7 +++++++
 gdb/f-lang.c  | 22 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 4ff828ba753..779fb1e67fb 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -238,6 +238,15 @@  f_collect_symbol_completion_matches (completion_tracker &tracker,
 						      text, word, ":", code);
 }
 
+/* Special expression evaluation cases for Fortran.  */
+struct value *
+evaluate_subexp_f (struct type *expect_type, struct expression *exp,
+		   int *pos, enum noside noside)
+{
+  /* Currently no special handling is required. */
+  return evaluate_subexp_standard (expect_type, exp, pos, noside);
+}
+
 static const char *f_extensions[] =
 {
   ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
@@ -245,6 +254,17 @@  static const char *f_extensions[] =
   NULL
 };
 
+/* Expression processing for Fortran.  */
+static const struct exp_descriptor exp_descriptor_f =
+{
+  print_subexp_standard,
+  operator_length_standard,
+  operator_check_standard,
+  op_name_standard,
+  dump_subexp_body_standard,
+  evaluate_subexp_f
+};
+
 extern const struct language_defn f_language_defn =
 {
   "fortran",
@@ -255,7 +275,7 @@  extern const struct language_defn f_language_defn =
   array_column_major,
   macro_expansion_no,
   f_extensions,
-  &exp_descriptor_standard,
+  &exp_descriptor_f,
   f_parse,			/* parser */
   null_post_parser,
   f_printchar,			/* Print character constant */