/* Support for printing Go values for GDB, the GNU debugger.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2022 Free Software Foundation, Inc.
This file is part of GDB.
struct value *val,
const struct value_print_options *options)
{
- struct gdbarch *gdbarch = get_type_arch (type);
- struct type *elt_ptr_type = TYPE_FIELD_TYPE (type, 0);
+ struct gdbarch *gdbarch = type->arch ();
+ struct type *elt_ptr_type = type->field (0).type ();
struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
LONGEST length;
/* TODO(dje): The encapsulation of what a pointer is belongs in value.c.
unpack_value_field_as_pointer. Do this until we can get
unpack_value_field_as_pointer. */
LONGEST addr;
- const gdb_byte *valaddr = value_contents_for_printing (val);
+ const gdb_byte *valaddr = value_contents_for_printing (val).data ();
if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,
val_print_string (elt_type, NULL, addr, length, stream, options);
}
-/* Implements the la_val_print routine for language Go. */
-
-void
-go_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
-{
- type = check_typedef (type);
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_STRUCT:
- {
- enum go_type go_type = go_classify_struct_type (type);
-
- switch (go_type)
- {
- case GO_TYPE_STRING:
- if (! options->raw)
- {
- print_go_string (type, embedded_offset, address,
- stream, recurse, val, options);
- return;
- }
- break;
- default:
- break;
- }
- }
- /* Fall through. */
-
- default:
- c_val_print (type, embedded_offset, address, stream,
- recurse, val, options);
- break;
- }
-}
-
/* See go-lang.h. */
void
-go_value_print_inner (struct value *val, struct ui_file *stream,
- int recurse, const struct value_print_options *options)
+go_language::value_print_inner (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options) const
{
struct type *type = check_typedef (value_type (val));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
{