diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2015-07-09 11:19:25 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2015-07-09 11:24:57 -0400 |
commit | 938c69a11897acea85275b93b5bb376b589564fa (patch) | |
tree | bf921d33a896edf0dbb3b082dc0e231d2f6e8b0d /gdb | |
parent | 49f7fe2880dc08ae701d9cdb84c8217642ef637a (diff) | |
download | gdb-938c69a11897acea85275b93b5bb376b589564fa.zip gdb-938c69a11897acea85275b93b5bb376b589564fa.tar.gz gdb-938c69a11897acea85275b93b5bb376b589564fa.tar.bz2 |
Factor out memberptr printing code from c_val_print
gdb/ChangeLog:
* c-valprint.c (c_val_print): Factor out memberptr printing code
from c_val_print to ...
(c_val_print_memberptr): ... this new function.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/c-valprint.c | 29 |
2 files changed, 29 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8a6a2ac..b5b80a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-07-09 Simon Marchi <simon.marchi@ericsson.com> + * c-valprint.c (c_val_print): Factor out memberptr printing code + from c_val_print to ... + (c_val_print_memberptr): ... this new function. + +2015-07-09 Simon Marchi <simon.marchi@ericsson.com> + * c-valprint.c (c_val_print): Factor out int printing code to ... (c_val_print_int): ... this new function. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 0a61d7a..d76a206 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -456,6 +456,26 @@ c_val_print_int (struct type *type, struct type *unresolved_type, } } +/* c_val_print helper for TYPE_CODE_MEMBERPTR. */ + +static void +c_val_print_memberptr (struct type *type, const gdb_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) +{ + if (!options->format) + { + cp_print_class_member (valaddr + embedded_offset, type, stream, "&"); + } + else + { + generic_val_print (type, valaddr, embedded_offset, address, stream, + recurse, original_value, options, &c_decorations); + } +} + /* See val_print for a description of the various parameters of this function; they are identical. */ @@ -501,12 +521,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, break; case TYPE_CODE_MEMBERPTR: - if (!options->format) - { - cp_print_class_member (valaddr + embedded_offset, type, stream, "&"); - break; - } - /* FALLTHROUGH */ + c_val_print_memberptr (type, valaddr, embedded_offset, address, stream, + recurse, original_value, options); + break; case TYPE_CODE_REF: case TYPE_CODE_ENUM: |