Factor out reference printing code from generic_val_print
gdb/ChangeLog: * valprint.c (generic_val_print): Factor out reference printing code to ... (generic_val_print_ref): ... this new function.
This commit is contained in:
parent
45000ea2f3
commit
fe43fede47
|
@ -1,3 +1,9 @@
|
|||
2015-07-27 Simon Marchi <simon.marchi@ericsson.com>
|
||||
|
||||
* valprint.c (generic_val_print): Factor out reference
|
||||
printing code to ...
|
||||
(generic_val_print_ref): ... this new function.
|
||||
|
||||
2015-07-27 Simon Marchi <simon.marchi@ericsson.com>
|
||||
|
||||
* valprint.c (generic_val_print): Factor out memberptr
|
||||
|
|
|
@ -461,52 +461,17 @@ generic_val_print_memberptr (struct type *type, const gdb_byte *valaddr,
|
|||
original_value, options, 0, stream);
|
||||
}
|
||||
|
||||
/* A generic val_print that is suitable for use by language
|
||||
implementations of the la_val_print method. This function can
|
||||
handle most type codes, though not all, notably exception
|
||||
TYPE_CODE_UNION and TYPE_CODE_STRUCT, which must be implemented by
|
||||
the caller.
|
||||
/* generic_val_print helper for TYPE_CODE_REF. */
|
||||
|
||||
Most arguments are as to val_print.
|
||||
|
||||
The additional DECORATIONS argument can be used to customize the
|
||||
output in some small, language-specific ways. */
|
||||
|
||||
void
|
||||
generic_val_print (struct type *type, const gdb_byte *valaddr,
|
||||
int embedded_offset, CORE_ADDR address,
|
||||
struct ui_file *stream, int recurse,
|
||||
static void
|
||||
generic_val_print_ref (struct type *type, const gdb_byte *valaddr,
|
||||
int embedded_offset, struct ui_file *stream, int recurse,
|
||||
const struct value *original_value,
|
||||
const struct value_print_options *options,
|
||||
const struct generic_val_print_decorations *decorations)
|
||||
const struct value_print_options *options)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_type_arch (type);
|
||||
unsigned int i = 0; /* Number of characters printed. */
|
||||
unsigned len;
|
||||
struct type *elttype;
|
||||
struct type *unresolved_type = type;
|
||||
LONGEST val;
|
||||
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
|
||||
type = check_typedef (type);
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
generic_val_print_array (type, valaddr, embedded_offset, address, stream,
|
||||
recurse, original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_MEMBERPTR:
|
||||
generic_val_print_memberptr (type, valaddr, embedded_offset, stream,
|
||||
original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_PTR:
|
||||
generic_val_print_ptr (type, valaddr, embedded_offset, stream,
|
||||
original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_REF:
|
||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||
if (options->addressprint)
|
||||
{
|
||||
CORE_ADDR addr
|
||||
|
@ -542,6 +507,54 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
|
|||
else
|
||||
fputs_filtered ("???", stream);
|
||||
}
|
||||
}
|
||||
|
||||
/* A generic val_print that is suitable for use by language
|
||||
implementations of the la_val_print method. This function can
|
||||
handle most type codes, though not all, notably exception
|
||||
TYPE_CODE_UNION and TYPE_CODE_STRUCT, which must be implemented by
|
||||
the caller.
|
||||
|
||||
Most arguments are as to val_print.
|
||||
|
||||
The additional DECORATIONS argument can be used to customize the
|
||||
output in some small, language-specific ways. */
|
||||
|
||||
void
|
||||
generic_val_print (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,
|
||||
const struct generic_val_print_decorations *decorations)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_type_arch (type);
|
||||
unsigned int i = 0; /* Number of characters printed. */
|
||||
unsigned len;
|
||||
struct type *unresolved_type = type;
|
||||
LONGEST val;
|
||||
|
||||
type = check_typedef (type);
|
||||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
generic_val_print_array (type, valaddr, embedded_offset, address, stream,
|
||||
recurse, original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_MEMBERPTR:
|
||||
generic_val_print_memberptr (type, valaddr, embedded_offset, stream,
|
||||
original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_PTR:
|
||||
generic_val_print_ptr (type, valaddr, embedded_offset, stream,
|
||||
original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_REF:
|
||||
generic_val_print_ref (type, valaddr, embedded_offset, stream, recurse,
|
||||
original_value, options);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_ENUM:
|
||||
|
|
Loading…
Reference in New Issue