diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-15 18:44:37 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-15 18:44:37 -0600 |
commit | 6b5a7bc768570edc15532759969cd9bff3f02c28 (patch) | |
tree | 59a29752067c8019fb858be4bc89a44e6c310be9 /gdb/c-valprint.c | |
parent | ce0e8d978314a2d7e45be442fa0bc76412110ad4 (diff) | |
download | binutils-gdb-6b5a7bc768570edc15532759969cd9bff3f02c28.tar.gz |
Handle member pointers directly in generic_value_print
TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR are only used for C++, so
it seems to me that the generic value-printing code ought to handle
these cases -- that way, printing these objects will work even when
the current language is not C++. This patch implements this idea.
gdb/ChangeLog
2020-09-15 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_value_print_inner): Remove TYPE_CODE_MEMBERPTR
and TYPE_CODE_METHODPTR cases.
* c-valprint.c (c_value_print_memberptr): Move to valprint.c.
(c_value_print_inner): Update.
* valprint.c (generic_value_print_memberptr): New function, from
c_value_print_memberptr.
(generic_value_print): Use it. Call cplus_print_method_ptr.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r-- | gdb/c-valprint.c | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index eefe6f106bb..01b1071cb70 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -416,23 +416,6 @@ c_value_print_int (struct value *val, struct ui_file *stream, } } -/* c_value_print helper for TYPE_CODE_MEMBERPTR. */ - -static void -c_value_print_memberptr (struct value *val, struct ui_file *stream, - int recurse, - const struct value_print_options *options) -{ - if (!options->format) - { - struct type *type = check_typedef (value_type (val)); - const gdb_byte *valaddr = value_contents_for_printing (val); - cp_print_class_member (valaddr, type, stream, "&"); - } - else - generic_value_print (val, stream, recurse, options, &c_decorations); -} - /* See c-lang.h. */ void @@ -440,7 +423,6 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) { struct type *type = value_type (val); - const gdb_byte *valaddr = value_contents_for_printing (val); type = check_typedef (type); switch (type->code ()) @@ -449,10 +431,6 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, c_value_print_array (val, stream, recurse, options); break; - case TYPE_CODE_METHODPTR: - cplus_print_method_ptr (valaddr, type, stream); - break; - case TYPE_CODE_PTR: c_value_print_ptr (val, stream, recurse, options); break; @@ -466,10 +444,8 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, c_value_print_int (val, stream, options); break; + case TYPE_CODE_METHODPTR: case TYPE_CODE_MEMBERPTR: - c_value_print_memberptr (val, stream, recurse, options); - break; - case TYPE_CODE_REF: case TYPE_CODE_RVALUE_REF: case TYPE_CODE_ENUM: |