/* Support for printing Pascal values for GDB, the GNU debugger.
- Copyright (C) 2000, 2001, 2003, 2005, 2006
+ Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This file is derived from c-valprint.c */
print_spaces_filtered (2 + 2 * recurse, stream);
}
/* For an array of chars, print with string syntax. */
- if (eltlen == 1 &&
- ((TYPE_CODE (elttype) == TYPE_CODE_INT)
- || ((current_language->la_language == language_m2)
+ if (eltlen == 1
+ && ((TYPE_CODE (elttype) == TYPE_CODE_INT)
+ || ((current_language->la_language == language_pascal)
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
&& (format == 0 || format == 's'))
{
if (addressprint && format != 's')
{
- deprecated_print_address_numeric (addr, 1, stream);
+ fputs_filtered (paddress (addr), stream);
}
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
- && TYPE_CODE (elttype) == TYPE_CODE_INT
+ && (TYPE_CODE (elttype) == TYPE_CODE_INT
+ || TYPE_CODE(elttype) == TYPE_CODE_CHAR)
&& (format == 0 || format == 's')
&& addr != 0)
{
int is_this_fld;
if (msymbol != NULL)
- wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block,
- VAR_DOMAIN, &is_this_fld, NULL);
+ wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
+ VAR_DOMAIN, &is_this_fld);
if (wsym)
{
}
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, format, deref_ref,
- recurse + 1, pretty);
+ recurse + 1, pretty, current_language);
if (pretty)
{
fprintf_filtered (stream, "\n");
{
fprintf_filtered (stream, "@");
/* Extract the address, assume that it is unsigned. */
- deprecated_print_address_numeric
- (extract_unsigned_integer (valaddr + embedded_offset,
- TARGET_PTR_BIT / HOST_CHAR_BIT),
- 1, stream);
+ fputs_filtered (paddress (
+ extract_unsigned_integer (valaddr + embedded_offset,
+ gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
if (deref_ref)
fputs_filtered (": ", stream);
}
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type),
- unpack_pointer (lookup_pointer_type (builtin_type_void),
- valaddr + embedded_offset));
+ unpack_pointer (type, valaddr + embedded_offset));
common_val_print (deref_val, stream, format, deref_ref,
- recurse + 1, pretty);
+ recurse + 1, pretty, current_language);
}
else
fputs_filtered ("???", stream);
Object pascal: if it is a member pointer, we will take care
of that when we print it. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR ||
- TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ || TYPE_CODE (type) == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR &&
- TYPE_NAME (type) == NULL &&
- TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_NAME (type) == NULL
+ && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
{
/* Print nothing */
fprintf_filtered (stream, ") ");
}
}
- return common_val_print (val, stream, format, 1, 0, pretty);
+ return common_val_print (val, stream, format, 1, 0, pretty,
+ current_language);
}
int dont_print_statmem)
{
int i, len, n_baseclasses;
- struct obstack tmp_obstack;
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
CHECK_TYPEDEF (type);
fprintf_filtered (stream, "<No data fields>");
else
{
+ struct obstack tmp_obstack = dont_print_statmem_obstack;
int fields_seen = 0;
if (dont_print_statmem == 0)
/* If we're at top level, carve out a completely fresh
chunk of the obstack and use that until this particular
invocation returns. */
- tmp_obstack = dont_print_statmem_obstack;
obstack_finish (&dont_print_statmem_obstack);
}
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
- common_val_print (v, stream, format, 0, recurse + 1, pretty);
+ common_val_print (v, stream, format, 0, recurse + 1,
+ pretty, current_language);
}
}
else
val_print (TYPE_FIELD_TYPE (type, i),
valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
address + TYPE_FIELD_BITPOS (type, i) / 8,
- stream, format, 0, recurse + 1, pretty);
+ stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
annotate_field_end ();
enum val_prettyprint pretty,
struct type **dont_print_vb)
{
- struct obstack tmp_obstack;
struct type **last_dont_print
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
+ struct obstack tmp_obstack = dont_print_vb_obstack;
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
if (dont_print_vb == 0)
/* If we're at top level, carve out a completely fresh
chunk of the obstack and use that until this particular
invocation returns. */
- tmp_obstack = dont_print_vb_obstack;
/* Bump up the high-water mark. Now alpha is omega. */
obstack_finish (&dont_print_vb_obstack);
}
{
int boffset;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- char *basename = TYPE_NAME (baseclass);
+ char *basename = type_name_no_tag (baseclass);
const gdb_byte *base_valaddr;
if (BASETYPE_VIA_VIRTUAL (type, i))
stream, format, recurse, pretty, NULL, 1);
return;
}
- common_val_print (val, stream, format, 0, recurse, pretty);
+ common_val_print (val, stream, format, 0, recurse, pretty,
+ current_language);
}
extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */