Introduce c_value_print_inner
authorTom Tromey <tom@tromey.com>
Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 14 Mar 2020 00:03:40 +0000 (18:03 -0600)
This introduces c_value_print_inner, which implements the
la_value_print_inner method for the C family of languages.  In this
patch, it is just a simple wrapper of c_val_print.  However,
subsequent patches will convert it to use the value API.  The
transformation is done this way to make each patch easier to review.

Future patches will apply this same treatment to other languages as
well.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

* opencl-lang.c (opencl_language_defn): Use c_value_print_inner.
* objc-lang.c (objc_language_defn): Use c_value_print_inner.
* c-valprint.c (c_value_print_inner): New function.
* c-lang.h (c_value_print_inner): Declare.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Use
c_value_print_inner.

gdb/ChangeLog
gdb/c-lang.c
gdb/c-lang.h
gdb/c-valprint.c
gdb/objc-lang.c
gdb/opencl-lang.c

index 734f77e1cc31abd22594a8bfedad9c622b2177ca..add19fe186f44ee7216bcb8eaf8b2b19eff70396 100644 (file)
@@ -1,3 +1,13 @@
+2020-03-13  Tom Tromey  <tom@tromey.com>
+
+       * opencl-lang.c (opencl_language_defn): Use c_value_print_inner.
+       * objc-lang.c (objc_language_defn): Use c_value_print_inner.
+       * c-valprint.c (c_value_print_inner): New function.
+       * c-lang.h (c_value_print_inner): Declare.
+       * c-lang.c (c_language_defn, cplus_language_defn)
+       (asm_language_defn, minimal_language_defn): Use
+       c_value_print_inner.
+
 2020-03-13  Tom Tromey  <tom@tromey.com>
 
        * p-valprint.c (pascal_object_print_value_fields): Now static.
index 3526674b2e6c074b66b86b60467da0c9896742d9..c919f02fa7215c2bd25621eb5eccc696ea4bf91f 100644 (file)
@@ -904,7 +904,7 @@ extern const struct language_defn c_language_defn =
   c_print_type,                        /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline */
@@ -1050,7 +1050,7 @@ extern const struct language_defn cplus_language_defn =
   c_print_type,                        /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   cplus_skip_trampoline,       /* Language specific skip_trampoline */
@@ -1105,7 +1105,7 @@ extern const struct language_defn asm_language_defn =
   c_print_type,                        /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline */
@@ -1160,7 +1160,7 @@ extern const struct language_defn minimal_language_defn =
   c_print_type,                        /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline */
index b8bc380486263ba9760c5d1436f9009ea16269fe..7638ccf6d520fea5c4b10616655c8fbc5feb3a47 100644 (file)
@@ -87,6 +87,11 @@ extern void c_val_print (struct type *,
                         struct value *,
                         const struct value_print_options *);
 
+/* Implement la_value_print_inner for the C family of languages.  */
+
+extern void c_value_print_inner (struct value *, struct ui_file *, int,
+                                const struct value_print_options *);
+
 extern void c_value_print (struct value *, struct ui_file *,
                           const struct value_print_options *);
 
index bee0c18abf8ea96aa0353d7347d4bb6b05935d8d..b5ae3fac48feb8b8014064e78f4c7c0b97febead 100644 (file)
@@ -557,6 +557,17 @@ c_val_print (struct type *type,
       break;
     }
 }
+
+/* See c-lang.h.  */
+
+void
+c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+                    const struct value_print_options *options)
+{
+  c_val_print (value_type (val), value_embedded_offset (val),
+              value_address (val), stream, recurse, val, options);
+}
+
 \f
 void
 c_value_print (struct value *val, struct ui_file *stream, 
index c277dc909476c7751cc31c7939e83b243a9a40f2..5126e9f4ca90eb613e2d1de362dfb5ed7e7d9ca3 100644 (file)
@@ -382,7 +382,7 @@ extern const struct language_defn objc_language_defn = {
   c_print_type,                        /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   objc_skip_trampoline,        /* Language specific skip_trampoline */
index c4afa3a2cd3d8f0a07e6b6ff280cf5c4947a6d5c..a48079881b557dba3fdbaf3cc73ef1eb2a452a3c 100644 (file)
@@ -1061,7 +1061,7 @@ extern const struct language_defn opencl_language_defn =
   opencl_print_type,           /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  nullptr,                     /* la_value_print_inner */
+  c_value_print_inner,         /* la_value_print_inner */
   c_value_print,               /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline */