diff options
author | Tom Tromey <tom@tromey.com> | 2020-03-13 17:39:52 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-03-13 18:03:39 -0600 |
commit | 2b4e573d62be3a59057895054b1b5faa67557ce6 (patch) | |
tree | ad488a86ece918a596682abee9dc414ad57fe2af /gdb | |
parent | a1f6a07c3d1d3a34d36d4e49f0fd3c66554e41b2 (diff) | |
download | gdb-2b4e573d62be3a59057895054b1b5faa67557ce6.zip gdb-2b4e573d62be3a59057895054b1b5faa67557ce6.tar.gz gdb-2b4e573d62be3a59057895054b1b5faa67557ce6.tar.bz2 |
Introduce la_value_print_inner
The plan for removing val_print is, essentially, to first duplicate
printing code as needed to use the value API; and then remove the
val_print code. This makes it possible to do the changes
incrementally while keeping everything working.
This adds a new la_value_print_inner function pointer to struct
language_defn. Eventually this will replace la_val_print. This patch
also changes printing to prefer this API, when available -- but no
language defines it yet.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (do_val_print): Call la_value_print_inner, if
available.
* rust-lang.c (rust_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.h (struct language_defn) <la_value_print_inner>: New
member.
* language.c (unknown_language_defn, auto_language_defn): Update.
* go-lang.c (go_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* ada-lang.c (ada_language_defn): Update.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 19 | ||||
-rw-r--r-- | gdb/ada-lang.c | 1 | ||||
-rw-r--r-- | gdb/c-lang.c | 4 | ||||
-rw-r--r-- | gdb/d-lang.c | 1 | ||||
-rw-r--r-- | gdb/f-lang.c | 1 | ||||
-rw-r--r-- | gdb/go-lang.c | 1 | ||||
-rw-r--r-- | gdb/language.c | 2 | ||||
-rw-r--r-- | gdb/language.h | 7 | ||||
-rw-r--r-- | gdb/m2-lang.c | 1 | ||||
-rw-r--r-- | gdb/objc-lang.c | 1 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 1 | ||||
-rw-r--r-- | gdb/rust-lang.c | 1 | ||||
-rw-r--r-- | gdb/valprint.c | 10 |
14 files changed, 48 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a66a918..acd5bf0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,24 @@ 2020-03-13 Tom Tromey <tom@tromey.com> + * valprint.c (do_val_print): Call la_value_print_inner, if + available. + * rust-lang.c (rust_language_defn): Update. + * p-lang.c (pascal_language_defn): Update. + * opencl-lang.c (opencl_language_defn): Update. + * objc-lang.c (objc_language_defn): Update. + * m2-lang.c (m2_language_defn): Update. + * language.h (struct language_defn) <la_value_print_inner>: New + member. + * language.c (unknown_language_defn, auto_language_defn): Update. + * go-lang.c (go_language_defn): Update. + * f-lang.c (f_language_defn): Update. + * d-lang.c (d_language_defn): Update. + * c-lang.c (c_language_defn, cplus_language_defn) + (asm_language_defn, minimal_language_defn): Update. + * ada-lang.c (ada_language_defn): Update. + +2020-03-13 Tom Tromey <tom@tromey.com> + * c-valprint.c (c_value_print): Use common_val_print. 2020-03-13 Tom Tromey <tom@tromey.com> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 316eaf5..fb3bfa5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -14110,6 +14110,7 @@ extern const struct language_defn ada_language_defn = { ada_print_type, /* Print a type using appropriate syntax */ ada_print_typedef, /* Print a typedef using appropriate syntax */ ada_val_print, /* Print a value using appropriate syntax */ + nullptr, /* la_value_print_inner */ ada_value_print, /* Print a top-level value */ ada_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index cd3e1ff..3526674 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -904,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ @@ -1049,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ cplus_skip_trampoline, /* Language specific skip_trampoline */ @@ -1103,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ @@ -1157,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 76d173b..71dc4c6 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -225,6 +225,7 @@ extern const struct language_defn d_language_defn = c_print_typedef, /* Print a typedef using appropriate syntax. */ d_val_print, /* Print a value using appropriate syntax. */ + nullptr, /* 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. */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index e767f52..4f4e8ae 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -647,6 +647,7 @@ extern const struct language_defn f_language_defn = f_print_type, /* Print a type using appropriate syntax */ f_print_typedef, /* Print a typedef using appropriate syntax */ f_val_print, /* Print a value using appropriate syntax */ + nullptr, /* la_value_print_inner */ c_value_print, /* FIXME */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 9ad456f..314c281 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -596,6 +596,7 @@ extern const struct language_defn go_language_defn = c_print_typedef, /* Print a typedef using appropriate syntax. */ go_val_print, /* Print a value using appropriate syntax. */ + nullptr, /* 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. */ diff --git a/gdb/language.c b/gdb/language.c index 03985d3..d1dfd2d 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -860,6 +860,7 @@ const struct language_defn unknown_language_defn = unk_lang_print_type, /* Print a type using appropriate syntax */ default_print_typedef, /* Print a typedef using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ + nullptr, /* la_value_print_inner */ unk_lang_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ unk_lang_trampoline, /* Language specific skip_trampoline */ @@ -911,6 +912,7 @@ const struct language_defn auto_language_defn = unk_lang_print_type, /* Print a type using appropriate syntax */ default_print_typedef, /* Print a typedef using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ + nullptr, /* la_value_print_inner */ unk_lang_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ unk_lang_trampoline, /* Language specific skip_trampoline */ diff --git a/gdb/language.h b/gdb/language.h index b344a4a..c6d5496 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -272,6 +272,13 @@ struct language_defn struct value *val, const struct value_print_options *options); + /* Print a value using syntax appropriate for this language. + RECURSE is the recursion depth. It is zero-based. */ + + void (*la_value_print_inner) (struct value *, struct ui_file *, + int recurse, + const struct value_print_options *); + /* Print a top-level value using syntax appropriate for this language. */ void (*la_value_print) (struct value *, struct ui_file *, diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 1a97a58..31c248d 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -394,6 +394,7 @@ extern const struct language_defn m2_language_defn = m2_print_type, /* Print a type using appropriate syntax */ m2_print_typedef, /* Print a typedef using appropriate syntax */ m2_val_print, /* Print a value using appropriate syntax */ + nullptr, /* 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 */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 5adf913..c277dc9 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -382,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ objc_skip_trampoline, /* Language specific skip_trampoline */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 1763590..c4afa3a 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1061,6 +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, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index c17d1f3..bf74b80 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -448,6 +448,7 @@ extern const struct language_defn pascal_language_defn = pascal_print_type, /* Print a type using appropriate syntax */ pascal_print_typedef, /* Print a typedef using appropriate syntax */ pascal_val_print, /* Print a value using appropriate syntax */ + nullptr, /* la_value_print_inner */ pascal_value_print, /* Print a top-level value */ default_read_var_value, /* la_read_var_value */ NULL, /* Language specific skip_trampoline */ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index fc48e34..881698a 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2154,6 +2154,7 @@ extern const struct language_defn rust_language_defn = rust_print_type, /* Print a type using appropriate syntax */ rust_print_typedef, /* Print a typedef using appropriate syntax */ rust_val_print, /* Print a value using appropriate syntax */ + nullptr, /* 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 */ diff --git a/gdb/valprint.c b/gdb/valprint.c index aab43d4..e0a3424 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1092,9 +1092,13 @@ do_val_print (struct value *full_value, try { - language->la_val_print (type, embedded_offset, address, - stream, recurse, val, - &local_opts); + if (full_value != nullptr && language->la_value_print_inner != nullptr) + language->la_value_print_inner (full_value, stream, recurse, + &local_opts); + else + language->la_val_print (type, embedded_offset, address, + stream, recurse, val, + &local_opts); } catch (const gdb_exception_error &except) { |