/* Support for printing Pascal values for GDB, the GNU debugger.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of GDB.
#include "cp-abi.h"
#include "cp-support.h"
#include "objfiles.h"
+#include "common/byte-vector.h"
\f
/* Decorations for Pascal. */
function; they are identical. */
void
-pascal_val_print (struct type *type, const gdb_byte *valaddr,
+pascal_val_print (struct type *type,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
- const struct value *original_value,
+ struct value *original_value,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = get_type_arch (type);
struct type *char_type;
CORE_ADDR addr;
int want_space = 0;
+ const gdb_byte *valaddr = value_contents_for_printing (original_value);
type = check_typedef (type);
switch (TYPE_CODE (type))
{
i = 0;
}
- val_print_array_elements (type, valaddr, embedded_offset,
+ val_print_array_elements (type, embedded_offset,
address, stream, recurse,
original_value, options, i);
fprintf_filtered (stream, "}");
case TYPE_CODE_PTR:
if (options->format && options->format != 's')
{
- val_print_scalar_formatted (type, valaddr, embedded_offset,
+ val_print_scalar_formatted (type, embedded_offset,
original_value, options, 0, stream);
break;
}
struct symbol *wsym = NULL;
struct type *wtype;
struct block *block = NULL;
- struct field_of_this_result is_this_fld;
if (want_space)
fputs_filtered (" ", stream);
if (msymbol.minsym != NULL)
- wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME (msymbol.minsym),
- block,
- VAR_DOMAIN, &is_this_fld).symbol;
+ {
+ const char *search_name
+ = MSYMBOL_SEARCH_NAME (msymbol.minsym);
+ wsym = lookup_symbol_search_name (search_name, block,
+ VAR_DOMAIN).symbol;
+ }
if (wsym)
{
case TYPE_CODE_UNDEF:
case TYPE_CODE_BOOL:
case TYPE_CODE_CHAR:
- generic_val_print (type, valaddr, embedded_offset, address,
+ generic_val_print (type, embedded_offset, address,
stream, recurse, original_value, options,
&p_decorations);
break;
static void pascal_object_print_value (struct type *, const gdb_byte *,
LONGEST,
CORE_ADDR, struct ui_file *, int,
- const struct value *,
+ struct value *,
const struct value_print_options *,
struct type **);
int
pascal_object_is_vtbl_ptr_type (struct type *type)
{
- const char *type_name = type_name_no_tag (type);
+ const char *type_name = TYPE_NAME (type);
return (type_name != NULL
&& strcmp (type_name, pascal_vtbl_ptr_name) == 0);
LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
- const struct value *val,
+ struct value *val,
const struct value_print_options *options,
struct type **dont_print_vb,
int dont_print_statmem)
fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
fputs_filtered ("members of ", stream);
- fputs_filtered (type_name_no_tag (type), stream);
+ fputs_filtered (TYPE_NAME (type), stream);
fputs_filtered (": ", stream);
}
}
address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
stream, format, 0, recurse + 1, pretty); */
val_print (TYPE_FIELD_TYPE (type, i),
- valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
+ offset + TYPE_FIELD_BITPOS (type, i) / 8,
address, stream, recurse + 1, val, &opts,
current_language);
}
LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
- const struct value *val,
+ struct value *val,
const struct value_print_options *options,
struct type **dont_print_vb)
{
{
LONGEST boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = type_name_no_tag (baseclass);
+ const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr = NULL;
LONGEST thisoffset;
int skip = 0;
+ gdb::byte_vector buf;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
if (boffset < 0 || boffset >= TYPE_LENGTH (type))
{
- gdb_byte *buf;
- struct cleanup *back_to;
+ buf.resize (TYPE_LENGTH (baseclass));
- buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
- back_to = make_cleanup (xfree, buf);
-
- base_valaddr = buf;
- if (target_read_memory (address + boffset, buf,
+ base_valaddr = buf.data ();
+ if (target_read_memory (address + boffset, buf.data (),
TYPE_LENGTH (baseclass)) != 0)
skip = 1;
address = address + boffset;
thisoffset = 0;
boffset = 0;
- do_cleanups (back_to);
}
else
base_valaddr = valaddr;
common_val_print (val, stream, recurse, &opts, current_language);
}
-/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_pascal_valprint;
-
void
_initialize_pascal_valprint (void)
{