X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fp-valprint.c;h=fa0ec6c40a10ef7a6ad80c630b88ff34c5fc70f3;hb=d8ca156b0e90ca9549bde4a88c2c2f27127f71a7;hp=79519b437a5c9cff3e4f910bc8d65be1fb546ebd;hpb=819844ad98d84ef944ff721239ba2b55c2a34061;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 79519b437a..fa0ec6c40a 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -1,13 +1,13 @@ /* Support for printing Pascal values for GDB, the GNU debugger. - Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007 + 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, @@ -16,9 +16,7 @@ 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 . */ /* This file is derived from c-valprint.c */ @@ -87,9 +85,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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')) { @@ -166,13 +164,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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) { @@ -219,7 +218,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, int is_this_fld; if (msymbol != NULL) - wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block, + wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block, VAR_DOMAIN, &is_this_fld, NULL); if (wsym) @@ -232,7 +231,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, } 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"); @@ -254,11 +253,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, { fprintf_filtered (stream, "@"); /* Extract the address, assume that it is unsigned. */ - deprecated_print_address_numeric - (extract_unsigned_integer (valaddr + embedded_offset, - gdbarch_ptr_bit (current_gdbarch) - / 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); } @@ -273,7 +270,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr + embedded_offset)); common_val_print (deref_val, stream, format, deref_ref, - recurse + 1, pretty); + recurse + 1, pretty, current_language); } else fputs_filtered ("???", stream); @@ -532,14 +529,14 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format, 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 */ @@ -551,7 +548,8 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format, 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); } @@ -746,7 +744,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 @@ -777,7 +776,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 (); @@ -944,7 +944,8 @@ pascal_object_print_static_field (struct value *val, 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 */