2000-06-14 14:27:59 +02:00
|
|
|
|
/* Support for printing Pascal values for GDB, the GNU debugger.
|
2005-01-29 01:52:02 +01:00
|
|
|
|
|
2008-01-01 23:53:26 +01:00
|
|
|
|
Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008
|
2006-01-18 22:24:19 +01:00
|
|
|
|
Free Software Foundation, Inc.
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
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
|
2007-08-23 20:08:50 +02:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2000-06-14 14:27:59 +02:00
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
/* This file is derived from c-valprint.c */
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
2002-07-29 Andrew Cagney <ac131313@redhat.com>
* gdb_obstack.h: New file.
* symtab.h: Include "gdb_obstack.h" instead of "obstack.h".
(obstack_chunk_alloc, obstack_chunk_free): Delete macros.
* objfiles.h: Include "gdb_obstack.h".
* Makefile.in (gdb_obstack_h): Define.
(symtab_h): Add $(gdb_obstack_h).
(objfiles_h): Add $(gdb_obstack_h).
* objfiles.c: Include "gdb_obstack.h" instead of "obstack.h".
* macrotab.c, cp-valprint.c, dbxread.c: Ditto.
* ch-typeprint.c, ch-valprint.c, dstread.c: Ditto.
* macroexp.c, p-typeprint.c, stabsread.c: Ditto.
* symtab.c, f-typeprint.c, mdebugread.c: Ditto.
* p-valprint.c, symmisc.c, typeprint.c: Ditto.
* symfile.c, coffread.c, c-typeprint.c: Ditto.
* buildsym.c, bcache.c, ada-typeprint.c: Ditto.
* Makefile.in (bcache.o): Update dependencies.
(buildsym.o, c-typeprint.o, ch-typeprint.o): Ditto.
(ch-valprint.o, coffread.o, cp-valprint.o): Ditto.
(dbxread.o, dstread.o, f-typeprint.o): Ditto.
(objfiles.o, p-typeprint.o, p-valprint.o): Ditto.
(stabsread.o, symfile.o, symmisc.o): Ditto.
(symtab.o, typeprint.o, macroexp.o): Ditto.
(macrotab.o, mdebugread.o): Ditto.
(f_lang_h, coff_sym_h, coff_symconst_h): Define.
(coff_ecoff_h, aout_aout64_h): Define.
(aout_stabs_gnu_h, libaout_h): Define.
2002-07-30 00:55:26 +02:00
|
|
|
|
#include "gdb_obstack.h"
|
2000-06-14 14:27:59 +02:00
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "command.h"
|
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
#include "demangle.h"
|
|
|
|
|
#include "valprint.h"
|
2001-03-27 22:36:24 +02:00
|
|
|
|
#include "typeprint.h"
|
2000-06-14 14:27:59 +02:00
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "annotate.h"
|
|
|
|
|
#include "p-lang.h"
|
2002-01-04 20:16:28 +01:00
|
|
|
|
#include "cp-abi.h"
|
2005-02-09 01:04:29 +01:00
|
|
|
|
#include "cp-support.h"
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
|
|
|
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
|
|
|
|
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
|
|
|
|
target byte order.
|
|
|
|
|
|
|
|
|
|
If the data are a string pointer, returns the number of string characters
|
|
|
|
|
printed.
|
|
|
|
|
|
|
|
|
|
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
|
|
|
them like pointers.
|
|
|
|
|
|
|
|
|
|
The PRETTY parameter controls prettyprinting. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
2005-01-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_defn): Make la_val_print's buffer
parameter a const bfd_byte.
* cp-valprint.c (cp_print_value_fields, cp_print_value): Update.
* ada-lang.c (ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* valprint.c (val_print_array_elements): Update.
* valprint.h (val_print_array_elements): Update.
* ada-lang.h (ada_val_print, ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* ada-valprint.c (ada_val_print, struct ada_val_print_args)
(ada_val_print_1, ada_print_floating, printable_val_type)
(print_record, val_print_packed_array_elements)
(print_field_values, print_variant_part): Update.
* c-lang.h (c_val_print, cp_print_value_fields): Update.
* c-valprint.c (c_val_print): Update.
* f-lang.h (f_val_print): Update.
* f-valprint.c (f_val_print, f77_print_array_1)
(f77_print_array): Update.
* jv-lang.h (java_val_print): Update.
* jv-valprint.c (java_print_value_fields, java_val_print): Update.
* language.c (unk_lang_val_print): Update.
* m2-lang.h (m2_val_print): Update.
* m2-valprint.c (m2_val_print): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* p-valprint.c (pascal_val_print)
(pascal_object_print_value_fields, pascal_object_print_value)
(pascal_object_print_value): Update.
* scm-lang.h (scm_val_print): Update.
* scm-valprint.c (scm_val_print): Update.
* value.h (val_print): Update.
2005-01-29 02:59:31 +01:00
|
|
|
|
int embedded_offset, CORE_ADDR address,
|
|
|
|
|
struct ui_file *stream, int format, int deref_ref,
|
|
|
|
|
int recurse, enum val_prettyprint pretty)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2003-09-14 Andrew Cagney <cagney@redhat.com>
* alpha-nat.c: Remove some occurances of "register".
* alpha-tdep.c, arm-tdep.c, blockframe.c, breakpoint.c: Ditto.
* buildsym.c, c-typeprint.c, c-valprint.c, coffread.c: Ditto.
* corefile.c, cp-support.c, cp-valprint.c, cris-tdep.c: Ditto.
* dbxread.c, dcache.c, dwarf2read.c, elfread.c: Ditto.
* environ.c, eval.c, event-top.c, f-typeprint.c: Ditto.
* f-valprint.c, findvar.c, frame.c, gdbtypes.c: Ditto.
* h8300-tdep.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c: Ditto.
* hppam3-nat.c, hpread.c, ia64-aix-nat.c, ia64-linux-nat.c: Ditto.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Ditto.
* infttrace.c, irix5-nat.c, jv-typeprint.c: Ditto.
* jv-valprint.c, m68k-tdep.c, m68klinux-nat.c, main.c: Ditto.
* mdebugread.c, minsyms.c, mips-linux-tdep.c: Ditto.
* mips-nat.c, mips-tdep.c, mipsread.c, mipsv4-nat.c: Ditto.
* ns32k-tdep.c, objfiles.c, p-typeprint.c: Ditto.
* p-valprint.c, ppc-linux-nat.c, printcmd.c: Ditto.
* remote-mips.c, remote-vx.c, rs6000-nat.c: Ditto.
* rs6000-tdep.c, scm-exp.c, sh-tdep.c, sh64-tdep.c: Ditto.
* solib.c, somread.c, source.c, sparc-tdep.c: Ditto.
* stabsread.c, stack.c, standalone.c, symfile.c: Ditto.
* symmisc.c, symtab.c, top.c, tracepoint.c: Ditto.
* typeprint.c, utils.c, valarith.c, valops.c: Ditto.
* values.c, vax-tdep.c, xcoffread.c: Ditto.
2003-09-14 18:32:14 +02:00
|
|
|
|
unsigned int i = 0; /* Number of characters printed */
|
2000-06-14 14:27:59 +02:00
|
|
|
|
unsigned len;
|
|
|
|
|
struct type *elttype;
|
|
|
|
|
unsigned eltlen;
|
2001-11-09 10:48:09 +01:00
|
|
|
|
int length_pos, length_size, string_pos;
|
|
|
|
|
int char_size;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
LONGEST val;
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
|
|
|
|
|
CHECK_TYPEDEF (type);
|
|
|
|
|
switch (TYPE_CODE (type))
|
|
|
|
|
{
|
|
|
|
|
case TYPE_CODE_ARRAY:
|
|
|
|
|
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
|
|
|
|
|
{
|
|
|
|
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
|
eltlen = TYPE_LENGTH (elttype);
|
|
|
|
|
len = TYPE_LENGTH (type) / eltlen;
|
|
|
|
|
if (prettyprint_arrays)
|
|
|
|
|
{
|
|
|
|
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
|
|
|
|
}
|
|
|
|
|
/* For an array of chars, print with string syntax. */
|
2007-09-07 14:34:55 +02:00
|
|
|
|
if (eltlen == 1
|
|
|
|
|
&& ((TYPE_CODE (elttype) == TYPE_CODE_INT)
|
2007-09-26 14:25:16 +02:00
|
|
|
|
|| ((current_language->la_language == language_pascal)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
|
|
|
|
|
&& (format == 0 || format == 's'))
|
|
|
|
|
{
|
|
|
|
|
/* If requested, look for the first null char and only print
|
|
|
|
|
elements up to it. */
|
|
|
|
|
if (stop_print_at_null)
|
|
|
|
|
{
|
|
|
|
|
unsigned int temp_len;
|
|
|
|
|
|
|
|
|
|
/* Look for a NULL char. */
|
|
|
|
|
for (temp_len = 0;
|
|
|
|
|
(valaddr + embedded_offset)[temp_len]
|
|
|
|
|
&& temp_len < len && temp_len < print_max;
|
|
|
|
|
temp_len++);
|
|
|
|
|
len = temp_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
|
|
|
|
|
i = len;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "{");
|
|
|
|
|
/* If this is a virtual function table, print the 0th
|
|
|
|
|
entry specially, and the rest of the members normally. */
|
|
|
|
|
if (pascal_object_is_vtbl_ptr_type (elttype))
|
|
|
|
|
{
|
|
|
|
|
i = 1;
|
|
|
|
|
fprintf_filtered (stream, "%d vtable entries", len - 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
i = 0;
|
|
|
|
|
}
|
|
|
|
|
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
|
|
|
|
format, deref_ref, recurse, pretty, i);
|
|
|
|
|
fprintf_filtered (stream, "}");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Array of unspecified length: treat like pointer to first elt. */
|
|
|
|
|
addr = address;
|
|
|
|
|
goto print_unpacked_pointer;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_PTR:
|
|
|
|
|
if (format && format != 's')
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
|
|
|
|
{
|
|
|
|
|
/* Print the unmangled name if desired. */
|
|
|
|
|
/* Print vtable entry - we only get here if we ARE using
|
|
|
|
|
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
|
2003-05-24 05:21:42 +02:00
|
|
|
|
/* Extract the address, assume that it is unsigned. */
|
|
|
|
|
print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)),
|
2000-06-14 14:27:59 +02:00
|
|
|
|
stream, demangle);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
|
{
|
|
|
|
|
addr = unpack_pointer (type, valaddr + embedded_offset);
|
|
|
|
|
print_unpacked_pointer:
|
|
|
|
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
|
|
|
|
{
|
|
|
|
|
/* Try to print what function it points to. */
|
|
|
|
|
print_address_demangle (addr, stream, demangle);
|
|
|
|
|
/* Return value is irrelevant except for string pointers. */
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (addressprint && format != 's')
|
|
|
|
|
{
|
2007-09-07 14:34:55 +02:00
|
|
|
|
fputs_filtered (paddress (addr), stream);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For a pointer to char or unsigned char, also print the string
|
|
|
|
|
pointed to, unless pointer is null. */
|
|
|
|
|
if (TYPE_LENGTH (elttype) == 1
|
2007-09-26 14:25:16 +02:00
|
|
|
|
&& (TYPE_CODE (elttype) == TYPE_CODE_INT
|
|
|
|
|
|| TYPE_CODE(elttype) == TYPE_CODE_CHAR)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
&& (format == 0 || format == 's')
|
|
|
|
|
&& addr != 0)
|
|
|
|
|
{
|
|
|
|
|
/* no wide string yet */
|
|
|
|
|
i = val_print_string (addr, -1, 1, stream);
|
|
|
|
|
}
|
|
|
|
|
/* also for pointers to pascal strings */
|
|
|
|
|
/* Note: this is Free Pascal specific:
|
|
|
|
|
as GDB does not recognize stabs pascal strings
|
|
|
|
|
Pascal strings are mapped to records
|
|
|
|
|
with lowercase names PM */
|
2002-05-02 13:18:07 +02:00
|
|
|
|
if (is_pascal_string_type (elttype, &length_pos, &length_size,
|
|
|
|
|
&string_pos, &char_size, NULL)
|
2001-11-09 10:48:09 +01:00
|
|
|
|
&& addr != 0)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2001-11-09 10:48:09 +01:00
|
|
|
|
ULONGEST string_length;
|
|
|
|
|
void *buffer;
|
|
|
|
|
buffer = xmalloc (length_size);
|
|
|
|
|
read_memory (addr + length_pos, buffer, length_size);
|
|
|
|
|
string_length = extract_unsigned_integer (buffer, length_size);
|
|
|
|
|
xfree (buffer);
|
|
|
|
|
i = val_print_string (addr + string_pos, string_length, char_size, stream);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
else if (pascal_object_is_vtbl_member (type))
|
|
|
|
|
{
|
|
|
|
|
/* print vtbl's nicely */
|
|
|
|
|
CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
|
|
|
|
|
|
|
|
|
|
struct minimal_symbol *msymbol =
|
|
|
|
|
lookup_minimal_symbol_by_pc (vt_address);
|
2001-11-09 10:48:09 +01:00
|
|
|
|
if ((msymbol != NULL)
|
|
|
|
|
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
fputs_filtered (" <", stream);
|
2003-02-20 David Carlton <carlton@math.stanford.edu>
* symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME;
expand comment.
* ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace
SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME.
* ada-typeprint.c (ada_typedef_print): Ditto.
* ax-gdb.c (gen_var_ref): Ditto.
* breakpoint.c (print_one_breakpoint): Ditto.
* buildsym.c (finish_block): Ditto.
* c-valprint.c (c_val_print): Ditto.
* expprint.c (print_subexp): Ditto.
* findvar.c (locate_var_value): Ditto.
* infcmd.c (jump_command): Ditto.
* linespec.c (decode_line_2, decode_compound): Ditto.
* maint.c (maintenance_translate_address): Ditto.
* objc-lang.c (compare_selectors, compare_classes): Ditto.
* printcmd.c (build_address_symbolic, sym_info, print_frame_args):
Ditto.
* p-valprint.c (pascal_val_print): Ditto.
* stabsread.c (define_symbol): Ditto.
* stack.c (print_frame, frame_info, print_block_frame_locals)
(print_frame_arg_vars, return_command): Ditto.
* symfile.c (compare_symbols, compare_psymbols): Ditto.
* symmisc.c (print_symbol): Ditto.
* symtab.c (lookup_partial_symbol, lookup_block_symbol)
(compare_search_syms, print_symbol_info, print_msymbol_info)
(rbreak_command): Ditto.
* tracepoint.c (tracepoints_info): Ditto.
* typeprint.c (typedef_print): Ditto.
* valops.c (value_of_variable, hand_function_call): Ditto.
* cli/cli-cmds.c (edit_command, list_command): Ditto.
* ada-typeprint.c: Update Copyright.
* infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto.
* tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
|
|
|
|
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
fputs_filtered (">", stream);
|
|
|
|
|
}
|
|
|
|
|
if (vt_address && vtblprint)
|
|
|
|
|
{
|
2001-11-10 21:44:38 +01:00
|
|
|
|
struct value *vt_val;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
struct symbol *wsym = (struct symbol *) NULL;
|
|
|
|
|
struct type *wtype;
|
|
|
|
|
struct block *block = (struct block *) NULL;
|
|
|
|
|
int is_this_fld;
|
|
|
|
|
|
|
|
|
|
if (msymbol != NULL)
|
2007-09-07 14:34:55 +02:00
|
|
|
|
wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
|
* symtab.h (lookup_symbol_in_language): Remove SYMTAB parameter.
(lookup_symbol): Likewise.
* symtab.c (lookup_symbol_in_language): Remove SYMTAB parameter.
(lookup_symbol): Likewise.
(search_symbols): Update.
* linespec.c (find_methods, collect_methods): Update.
(add_matching_methods, add_constructors): Update.
(decode_compound, decode_dollar, decode_variable): Update.
(lookup_prefix_sym): Update.
(symbol_found): Remove SYM_SYMTAB parameter.
Use SYMBOL_SYMTAB (sym) instead.
* gdbtypes.c (lookup_typename): Update.
(lookup_struct, lookup_union, lookup_enum): Update.
(lookup_template_type): Update.
(check_typedef): Update.
* language.c (lang_bool_type): Update.
* mdebugread.c (parse_procedure): Update.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* parse.c (write_dollar_variable): Update.
* printcmd.c (address_info): Update.
* source.c (select_source_symtab): Update.
* stack.c (print_frame_args, print_frame_arg_vars): Update.
* valops.c (find_function_in_inferior): Update.
(value_struct_elt_for_reference): Update.
* value.c (value_static_field, value_fn_field): Update.
* alpha-mdebug-tdep.c (find_proc_desc): Update.
* arm-tdep.c (arm_skip_prologue): Update.
* mt-tdep.c (mt_skip_prologue): Update.
* xstormy16-tdep.c (xstormy16_skip_prologue): Update.
* ada-lang.h (struct ada_symbol_info): Remove SYMTAB member.
* ada-lang.c (ada_add_block_symbols): Remove SYMTAB parameter.
(add_defn_to_vec): Likewise.
(ada_add_block_symbols): Likewise.
(lookup_cached_symbol, cache_symbol): Likewise.
(standard_lookup): Update.
(ada_lookup_symbol_list): Update.
* c-valprint.c (c_val_print): Update.
* cp-support.c (cp_lookup_rtti_type): Update.
* jv-lang.c (java_lookup_class, get_java_object_type): Update.
* objc-lang.c (lookup_struct_typedef, find_imps): Update.
* p-valprint.c (pascal_val_print): Update.
* scm-lang.c (scm_lookup_name): Update.
* c-exp.y: Update.
* f-exp.y: Update.
* jv-exp.y: Update.
* m2-exp.y: Update.
* objc-exp.y: Update.
* p-exp.y: Update.
2008-05-19 17:50:10 +02:00
|
|
|
|
VAR_DOMAIN, &is_this_fld);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
if (wsym)
|
|
|
|
|
{
|
|
|
|
|
wtype = SYMBOL_TYPE (wsym);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wtype = TYPE_TARGET_TYPE (type);
|
|
|
|
|
}
|
2004-11-09 Andrew Cagney <cagney@gnu.org>
* value.h (struct value): Delete field bfd_section.
(VALUE_BFD_SECTION): Delete macro.
(COERCE_REF): Update.
(value_at, value_at_lazy): Delete asection parameter.
* printcmd.c (print_formatted, x_command): Update.
(do_examine): Delete asection parameter.
(next_section): Delete variable.
* valops.c (value_cast, value_at, value_at_lazy)
(value_coerce_function, value_addr, value_ind, value_string)
(find_rt_vbase_offset, value_full_object): Update.
* hpacc-abi.c (hpacc_virtual_fn_field)
(hpacc_value_rtti_type): Update.
* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_virtual_fn_field)
(gnuv3_baseclass_offset): Update.
* f-valprint.c (f_val_print): Update.
* c-valprint.c (c_val_print): Update.
* p-valprint.c (pascal_val_print): Update.
* jv-valprint.c (java_value_print): Update.
* jv-lang.c (java_class_from_object, evaluate_subexp_java): Update.
* ada-lang.c (ada_value_primitive_packed_val)
(ada_evaluate_subexp): Update.
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Update.
* expprint.c (print_subexp_standard): Update.
* infcall.c (call_function_by_hand): Update.
* valarith.c (value_add): Update.
* eval.c (evaluate_subexp_standard): Update.
* values.c (allocate_value, value_copy, value_static_field): Update.
* findvar.c (read_var_value, locate_var_value): Update.
2004-11-09 15:43:27 +01:00
|
|
|
|
vt_val = value_at (wtype, vt_address);
|
2005-02-28 18:00:49 +01:00
|
|
|
|
common_val_print (vt_val, stream, format, deref_ref,
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
recurse + 1, pretty, current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
if (pretty)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "\n");
|
|
|
|
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return number of characters printed, including the terminating
|
|
|
|
|
'\0' if we reached the end. val_print_string takes care including
|
|
|
|
|
the terminating '\0' if necessary. */
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_REF:
|
|
|
|
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
|
if (addressprint)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "@");
|
2003-05-24 05:21:42 +02:00
|
|
|
|
/* Extract the address, assume that it is unsigned. */
|
2007-09-07 14:34:55 +02:00
|
|
|
|
fputs_filtered (paddress (
|
|
|
|
|
extract_unsigned_integer (valaddr + embedded_offset,
|
|
|
|
|
gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
if (deref_ref)
|
|
|
|
|
fputs_filtered (": ", stream);
|
|
|
|
|
}
|
|
|
|
|
/* De-reference the reference. */
|
|
|
|
|
if (deref_ref)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
|
|
|
|
{
|
2001-11-10 21:44:38 +01:00
|
|
|
|
struct value *deref_val =
|
2000-06-14 14:27:59 +02:00
|
|
|
|
value_at
|
|
|
|
|
(TYPE_TARGET_TYPE (type),
|
2008-09-11 16:17:24 +02:00
|
|
|
|
unpack_pointer (type, valaddr + embedded_offset));
|
2005-02-28 18:00:49 +01:00
|
|
|
|
common_val_print (deref_val, stream, format, deref_ref,
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
recurse + 1, pretty, current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("???", stream);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_UNION:
|
|
|
|
|
if (recurse && !unionprint)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "{...}");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Fall through. */
|
|
|
|
|
case TYPE_CODE_STRUCT:
|
|
|
|
|
if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
|
|
|
|
{
|
|
|
|
|
/* Print the unmangled name if desired. */
|
|
|
|
|
/* Print vtable entry - we only get here if NOT using
|
|
|
|
|
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
|
2003-05-24 05:21:42 +02:00
|
|
|
|
/* Extract the address, assume that it is unsigned. */
|
|
|
|
|
print_address_demangle
|
|
|
|
|
(extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
|
|
|
|
|
TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
|
|
|
|
|
stream, demangle);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-11-09 10:48:09 +01:00
|
|
|
|
if (is_pascal_string_type (type, &length_pos, &length_size,
|
2002-05-02 13:18:07 +02:00
|
|
|
|
&string_pos, &char_size, NULL))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2001-11-09 10:48:09 +01:00
|
|
|
|
len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
|
|
|
|
|
LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream, format,
|
|
|
|
|
recurse, pretty, NULL, 0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_ENUM:
|
|
|
|
|
if (format)
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
len = TYPE_NFIELDS (type);
|
|
|
|
|
val = unpack_long (type, valaddr + embedded_offset);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
QUIT;
|
|
|
|
|
if (val == TYPE_FIELD_BITPOS (type, i))
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i < len)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print_longest (stream, 'd', 0, val);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2006-01-18 22:24:19 +01:00
|
|
|
|
case TYPE_CODE_FLAGS:
|
|
|
|
|
if (format)
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
else
|
|
|
|
|
val_print_type_code_flags (type, valaddr + embedded_offset, stream);
|
|
|
|
|
break;
|
|
|
|
|
|
2000-06-14 14:27:59 +02:00
|
|
|
|
case TYPE_CODE_FUNC:
|
|
|
|
|
if (format)
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
|
|
|
|
the distinction made between FUNCs and POINTERs to FUNCs. */
|
|
|
|
|
fprintf_filtered (stream, "{");
|
|
|
|
|
type_print (type, "", stream, -1);
|
|
|
|
|
fprintf_filtered (stream, "} ");
|
|
|
|
|
/* Try to print what function it points to, and its address. */
|
|
|
|
|
print_address_demangle (address, stream, demangle);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_BOOL:
|
|
|
|
|
format = format ? format : output_format;
|
|
|
|
|
if (format)
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
val = unpack_long (type, valaddr + embedded_offset);
|
|
|
|
|
if (val == 0)
|
|
|
|
|
fputs_filtered ("false", stream);
|
|
|
|
|
else if (val == 1)
|
|
|
|
|
fputs_filtered ("true", stream);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("true (", stream);
|
|
|
|
|
fprintf_filtered (stream, "%ld)", (long int) val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_RANGE:
|
|
|
|
|
/* FIXME: create_range_type does not set the unsigned bit in a
|
|
|
|
|
range type (I think it probably should copy it from the target
|
|
|
|
|
type), so we won't print values which are too large to
|
|
|
|
|
fit in a signed integer correctly. */
|
|
|
|
|
/* FIXME: Doesn't handle ranges of enums correctly. (Can't just
|
|
|
|
|
print with the target type, though, because the size of our type
|
|
|
|
|
and the target type might differ). */
|
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_INT:
|
|
|
|
|
format = format ? format : output_format;
|
|
|
|
|
if (format)
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
val_print_type_code_int (type, valaddr + embedded_offset, stream);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_CHAR:
|
|
|
|
|
format = format ? format : output_format;
|
|
|
|
|
if (format)
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
val = unpack_long (type, valaddr + embedded_offset);
|
|
|
|
|
if (TYPE_UNSIGNED (type))
|
|
|
|
|
fprintf_filtered (stream, "%u", (unsigned int) val);
|
|
|
|
|
else
|
|
|
|
|
fprintf_filtered (stream, "%d", (int) val);
|
|
|
|
|
fputs_filtered (" ", stream);
|
|
|
|
|
LA_PRINT_CHAR ((unsigned char) val, stream);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_FLT:
|
|
|
|
|
if (format)
|
|
|
|
|
{
|
|
|
|
|
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print_floating (valaddr + embedded_offset, type, stream);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_BITSTRING:
|
|
|
|
|
case TYPE_CODE_SET:
|
|
|
|
|
elttype = TYPE_INDEX_TYPE (type);
|
|
|
|
|
CHECK_TYPEDEF (elttype);
|
2001-12-12 03:11:52 +01:00
|
|
|
|
if (TYPE_STUB (elttype))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "<incomplete type>");
|
|
|
|
|
gdb_flush (stream);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct type *range = elttype;
|
|
|
|
|
LONGEST low_bound, high_bound;
|
|
|
|
|
int i;
|
|
|
|
|
int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
|
|
|
|
|
int need_comma = 0;
|
|
|
|
|
|
|
|
|
|
if (is_bitstring)
|
|
|
|
|
fputs_filtered ("B'", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("[", stream);
|
|
|
|
|
|
|
|
|
|
i = get_discrete_bounds (range, &low_bound, &high_bound);
|
|
|
|
|
maybe_bad_bstring:
|
|
|
|
|
if (i < 0)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("<error value>", stream);
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = low_bound; i <= high_bound; i++)
|
|
|
|
|
{
|
|
|
|
|
int element = value_bit_index (type, valaddr + embedded_offset, i);
|
|
|
|
|
if (element < 0)
|
|
|
|
|
{
|
|
|
|
|
i = element;
|
|
|
|
|
goto maybe_bad_bstring;
|
|
|
|
|
}
|
|
|
|
|
if (is_bitstring)
|
|
|
|
|
fprintf_filtered (stream, "%d", element);
|
|
|
|
|
else if (element)
|
|
|
|
|
{
|
|
|
|
|
if (need_comma)
|
|
|
|
|
fputs_filtered (", ", stream);
|
|
|
|
|
print_type_scalar (range, i, stream);
|
|
|
|
|
need_comma = 1;
|
|
|
|
|
|
|
|
|
|
if (i + 1 <= high_bound && value_bit_index (type, valaddr + embedded_offset, ++i))
|
|
|
|
|
{
|
|
|
|
|
int j = i;
|
|
|
|
|
fputs_filtered ("..", stream);
|
|
|
|
|
while (i + 1 <= high_bound
|
|
|
|
|
&& value_bit_index (type, valaddr + embedded_offset, ++i))
|
|
|
|
|
j = i;
|
|
|
|
|
print_type_scalar (range, j, stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
done:
|
|
|
|
|
if (is_bitstring)
|
|
|
|
|
fputs_filtered ("'", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("]", stream);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_VOID:
|
|
|
|
|
fprintf_filtered (stream, "void");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_ERROR:
|
|
|
|
|
fprintf_filtered (stream, "<error type>");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPE_CODE_UNDEF:
|
|
|
|
|
/* This happens (without TYPE_FLAG_STUB set) on systems which don't use
|
|
|
|
|
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
|
|
|
|
|
and no complete type for struct foo in that file. */
|
|
|
|
|
fprintf_filtered (stream, "<incomplete type>");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
|
error (_("Invalid pascal type code %d in symbol table."), TYPE_CODE (type));
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
gdb_flush (stream);
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-11-10 21:44:38 +01:00
|
|
|
|
pascal_value_print (struct value *val, struct ui_file *stream, int format,
|
2000-07-30 03:48:28 +02:00
|
|
|
|
enum val_prettyprint pretty)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-12 22:45:08 +01:00
|
|
|
|
struct type *type = value_type (val);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
/* If it is a pointer, indicate what it points to.
|
|
|
|
|
|
|
|
|
|
Print type also if it is a reference.
|
|
|
|
|
|
|
|
|
|
Object pascal: if it is a member pointer, we will take care
|
|
|
|
|
of that when we print it. */
|
2007-09-07 14:34:55 +02:00
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR
|
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_REF)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
/* Hack: remove (char *) for char strings. Their
|
|
|
|
|
type is indicated by the quoted string anyway. */
|
2007-09-07 14:34:55 +02:00
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR
|
|
|
|
|
&& TYPE_NAME (type) == NULL
|
|
|
|
|
&& TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
|
2003-11-08 01:13:03 +01:00
|
|
|
|
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
/* Print nothing */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "(");
|
|
|
|
|
type_print (type, "", stream, -1);
|
|
|
|
|
fprintf_filtered (stream, ") ");
|
|
|
|
|
}
|
|
|
|
|
}
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
return common_val_print (val, stream, format, 1, 0, pretty,
|
|
|
|
|
current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
Inserted from cp-valprint
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern int vtblprint; /* Controls printing of vtbl's */
|
|
|
|
|
extern int objectprint; /* Controls looking up an object's derived type
|
|
|
|
|
using what we find in its vtables. */
|
|
|
|
|
static int pascal_static_field_print; /* Controls printing of static fields. */
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
|
|
|
|
static void
|
|
|
|
|
show_pascal_static_field_print (struct ui_file *file, int from_tty,
|
|
|
|
|
struct cmd_list_element *c, const char *value)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (file, _("Printing of pascal static members is %s.\n"),
|
|
|
|
|
value);
|
|
|
|
|
}
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
static struct obstack dont_print_vb_obstack;
|
|
|
|
|
static struct obstack dont_print_statmem_obstack;
|
|
|
|
|
|
2005-02-28 18:00:49 +01:00
|
|
|
|
static void pascal_object_print_static_field (struct value *,
|
2001-11-10 21:44:38 +01:00
|
|
|
|
struct ui_file *, int, int,
|
|
|
|
|
enum val_prettyprint);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
static void pascal_object_print_value (struct type *, const gdb_byte *,
|
2005-01-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_defn): Make la_val_print's buffer
parameter a const bfd_byte.
* cp-valprint.c (cp_print_value_fields, cp_print_value): Update.
* ada-lang.c (ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* valprint.c (val_print_array_elements): Update.
* valprint.h (val_print_array_elements): Update.
* ada-lang.h (ada_val_print, ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* ada-valprint.c (ada_val_print, struct ada_val_print_args)
(ada_val_print_1, ada_print_floating, printable_val_type)
(print_record, val_print_packed_array_elements)
(print_field_values, print_variant_part): Update.
* c-lang.h (c_val_print, cp_print_value_fields): Update.
* c-valprint.c (c_val_print): Update.
* f-lang.h (f_val_print): Update.
* f-valprint.c (f_val_print, f77_print_array_1)
(f77_print_array): Update.
* jv-lang.h (java_val_print): Update.
* jv-valprint.c (java_print_value_fields, java_val_print): Update.
* language.c (unk_lang_val_print): Update.
* m2-lang.h (m2_val_print): Update.
* m2-valprint.c (m2_val_print): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* p-valprint.c (pascal_val_print)
(pascal_object_print_value_fields, pascal_object_print_value)
(pascal_object_print_value): Update.
* scm-lang.h (scm_val_print): Update.
* scm-valprint.c (scm_val_print): Update.
* value.h (val_print): Update.
2005-01-29 02:59:31 +01:00
|
|
|
|
CORE_ADDR, struct ui_file *,
|
|
|
|
|
int, int, enum val_prettyprint,
|
|
|
|
|
struct type **);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
/* It was changed to this after 2.4.5. */
|
|
|
|
|
const char pascal_vtbl_ptr_name[] =
|
|
|
|
|
{'_', '_', 'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 't', 'y', 'p', 'e', 0};
|
|
|
|
|
|
|
|
|
|
/* Return truth value for assertion that TYPE is of the type
|
|
|
|
|
"pointer to virtual function". */
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
|
pascal_object_is_vtbl_ptr_type (struct type *type)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
char *typename = type_name_no_tag (type);
|
|
|
|
|
|
|
|
|
|
return (typename != NULL
|
2003-11-08 01:13:03 +01:00
|
|
|
|
&& strcmp (typename, pascal_vtbl_ptr_name) == 0);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return truth value for the assertion that TYPE is of the type
|
|
|
|
|
"pointer to virtual function table". */
|
|
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
|
pascal_object_is_vtbl_member (struct type *type)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
|
|
|
{
|
|
|
|
|
type = TYPE_TARGET_TYPE (type);
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
|
|
|
|
|
{
|
|
|
|
|
type = TYPE_TARGET_TYPE (type);
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using thunks */
|
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */
|
|
|
|
|
{
|
|
|
|
|
/* Virtual functions tables are full of pointers
|
|
|
|
|
to virtual functions. */
|
|
|
|
|
return pascal_object_is_vtbl_ptr_type (type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_defn): Make la_val_print's buffer
parameter a const bfd_byte.
* cp-valprint.c (cp_print_value_fields, cp_print_value): Update.
* ada-lang.c (ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* valprint.c (val_print_array_elements): Update.
* valprint.h (val_print_array_elements): Update.
* ada-lang.h (ada_val_print, ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* ada-valprint.c (ada_val_print, struct ada_val_print_args)
(ada_val_print_1, ada_print_floating, printable_val_type)
(print_record, val_print_packed_array_elements)
(print_field_values, print_variant_part): Update.
* c-lang.h (c_val_print, cp_print_value_fields): Update.
* c-valprint.c (c_val_print): Update.
* f-lang.h (f_val_print): Update.
* f-valprint.c (f_val_print, f77_print_array_1)
(f77_print_array): Update.
* jv-lang.h (java_val_print): Update.
* jv-valprint.c (java_print_value_fields, java_val_print): Update.
* language.c (unk_lang_val_print): Update.
* m2-lang.h (m2_val_print): Update.
* m2-valprint.c (m2_val_print): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* p-valprint.c (pascal_val_print)
(pascal_object_print_value_fields, pascal_object_print_value)
(pascal_object_print_value): Update.
* scm-lang.h (scm_val_print): Update.
* scm-valprint.c (scm_val_print): Update.
* value.h (val_print): Update.
2005-01-29 02:59:31 +01:00
|
|
|
|
/* Mutually recursive subroutines of pascal_object_print_value and
|
|
|
|
|
c_val_print to print out a structure's fields:
|
|
|
|
|
pascal_object_print_value_fields and pascal_object_print_value.
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
|
|
|
|
|
same meanings as in pascal_object_print_value and c_val_print.
|
|
|
|
|
|
|
|
|
|
DONT_PRINT is an array of baseclass types that we
|
|
|
|
|
should not print, or zero if called from top level. */
|
|
|
|
|
|
|
|
|
|
void
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
2000-07-30 03:48:28 +02:00
|
|
|
|
CORE_ADDR address, struct ui_file *stream,
|
|
|
|
|
int format, int recurse,
|
|
|
|
|
enum val_prettyprint pretty,
|
|
|
|
|
struct type **dont_print_vb,
|
|
|
|
|
int dont_print_statmem)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
int i, len, n_baseclasses;
|
|
|
|
|
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
|
|
|
|
|
|
|
|
|
|
CHECK_TYPEDEF (type);
|
|
|
|
|
|
|
|
|
|
fprintf_filtered (stream, "{");
|
|
|
|
|
len = TYPE_NFIELDS (type);
|
|
|
|
|
n_baseclasses = TYPE_N_BASECLASSES (type);
|
|
|
|
|
|
|
|
|
|
/* Print out baseclasses such that we don't print
|
|
|
|
|
duplicates of virtual baseclasses. */
|
|
|
|
|
if (n_baseclasses > 0)
|
|
|
|
|
pascal_object_print_value (type, valaddr, address, stream,
|
|
|
|
|
format, recurse + 1, pretty, dont_print_vb);
|
|
|
|
|
|
|
|
|
|
if (!len && n_baseclasses == 1)
|
|
|
|
|
fprintf_filtered (stream, "<No data fields>");
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-02-08 15:20:56 +01:00
|
|
|
|
struct obstack tmp_obstack = dont_print_statmem_obstack;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
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. */
|
|
|
|
|
obstack_finish (&dont_print_statmem_obstack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = n_baseclasses; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
/* If requested, skip printing of static fields. */
|
Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
2008-10-08 14:49:13 +02:00
|
|
|
|
if (!pascal_static_field_print
|
|
|
|
|
&& field_is_static (&TYPE_FIELD (type, i)))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
continue;
|
|
|
|
|
if (fields_seen)
|
|
|
|
|
fprintf_filtered (stream, ", ");
|
|
|
|
|
else if (n_baseclasses > 0)
|
|
|
|
|
{
|
|
|
|
|
if (pretty)
|
|
|
|
|
{
|
|
|
|
|
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 (": ", stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fields_seen = 1;
|
|
|
|
|
|
|
|
|
|
if (pretty)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "\n");
|
|
|
|
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wrap_here (n_spaces (2 + 2 * recurse));
|
|
|
|
|
}
|
|
|
|
|
if (inspect_it)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
|
|
|
|
fputs_filtered ("\"( ptr \"", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("\"( nodef \"", stream);
|
Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
2008-10-08 14:49:13 +02:00
|
|
|
|
if (field_is_static (&TYPE_FIELD (type, i)))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
fputs_filtered ("static ", stream);
|
|
|
|
|
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
|
|
|
|
language_cplus,
|
|
|
|
|
DMGL_PARAMS | DMGL_ANSI);
|
|
|
|
|
fputs_filtered ("\" \"", stream);
|
|
|
|
|
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
|
|
|
|
language_cplus,
|
|
|
|
|
DMGL_PARAMS | DMGL_ANSI);
|
|
|
|
|
fputs_filtered ("\") \"", stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
|
|
|
|
|
|
Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
2008-10-08 14:49:13 +02:00
|
|
|
|
if (field_is_static (&TYPE_FIELD (type, i)))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
fputs_filtered ("static ", stream);
|
|
|
|
|
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
|
|
|
|
|
language_cplus,
|
|
|
|
|
DMGL_PARAMS | DMGL_ANSI);
|
|
|
|
|
annotate_field_name_end ();
|
|
|
|
|
fputs_filtered (" = ", stream);
|
|
|
|
|
annotate_field_value ();
|
|
|
|
|
}
|
|
|
|
|
|
Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
2008-10-08 14:49:13 +02:00
|
|
|
|
if (!field_is_static (&TYPE_FIELD (type, i))
|
|
|
|
|
&& TYPE_FIELD_PACKED (type, i))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2001-11-10 21:44:38 +01:00
|
|
|
|
struct value *v;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
/* Bitfields require special handling, especially due to byte
|
|
|
|
|
order problems. */
|
|
|
|
|
if (TYPE_FIELD_IGNORE (type, i))
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("<optimized out or zero length>", stream);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
unpack_field_as_long (type, valaddr, i));
|
|
|
|
|
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
common_val_print (v, stream, format, 0, recurse + 1,
|
|
|
|
|
pretty, current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_FIELD_IGNORE (type, i))
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("<optimized out or zero length>", stream);
|
|
|
|
|
}
|
Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.
2008-10-08 14:49:13 +02:00
|
|
|
|
else if (field_is_static (&TYPE_FIELD (type, i)))
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2001-11-10 21:44:38 +01:00
|
|
|
|
/* struct value *v = value_static_field (type, i); v4.17 specific */
|
|
|
|
|
struct value *v;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
unpack_field_as_long (type, valaddr, i));
|
|
|
|
|
|
|
|
|
|
if (v == NULL)
|
|
|
|
|
fputs_filtered ("<optimized out>", stream);
|
|
|
|
|
else
|
2005-02-28 18:00:49 +01:00
|
|
|
|
pascal_object_print_static_field (v, stream, format,
|
|
|
|
|
recurse + 1, pretty);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* val_print (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
|
|
|
|
|
address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
|
|
|
|
stream, format, 0, recurse + 1, pretty); */
|
|
|
|
|
val_print (TYPE_FIELD_TYPE (type, i),
|
|
|
|
|
valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
|
|
|
|
|
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
stream, format, 0, recurse + 1, pretty,
|
|
|
|
|
current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
annotate_field_end ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dont_print_statmem == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Free the space used to deal with the printing
|
|
|
|
|
of the members from top level. */
|
|
|
|
|
obstack_free (&dont_print_statmem_obstack, last_dont_print);
|
|
|
|
|
dont_print_statmem_obstack = tmp_obstack;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pretty)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "\n");
|
|
|
|
|
print_spaces_filtered (2 * recurse, stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fprintf_filtered (stream, "}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Special val_print routine to avoid printing multiple copies of virtual
|
|
|
|
|
baseclasses. */
|
|
|
|
|
|
2006-10-25 23:26:41 +02:00
|
|
|
|
static void
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
2005-01-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_defn): Make la_val_print's buffer
parameter a const bfd_byte.
* cp-valprint.c (cp_print_value_fields, cp_print_value): Update.
* ada-lang.c (ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* valprint.c (val_print_array_elements): Update.
* valprint.h (val_print_array_elements): Update.
* ada-lang.h (ada_val_print, ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* ada-valprint.c (ada_val_print, struct ada_val_print_args)
(ada_val_print_1, ada_print_floating, printable_val_type)
(print_record, val_print_packed_array_elements)
(print_field_values, print_variant_part): Update.
* c-lang.h (c_val_print, cp_print_value_fields): Update.
* c-valprint.c (c_val_print): Update.
* f-lang.h (f_val_print): Update.
* f-valprint.c (f_val_print, f77_print_array_1)
(f77_print_array): Update.
* jv-lang.h (java_val_print): Update.
* jv-valprint.c (java_print_value_fields, java_val_print): Update.
* language.c (unk_lang_val_print): Update.
* m2-lang.h (m2_val_print): Update.
* m2-valprint.c (m2_val_print): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* p-valprint.c (pascal_val_print)
(pascal_object_print_value_fields, pascal_object_print_value)
(pascal_object_print_value): Update.
* scm-lang.h (scm_val_print): Update.
* scm-valprint.c (scm_val_print): Update.
* value.h (val_print): Update.
2005-01-29 02:59:31 +01:00
|
|
|
|
CORE_ADDR address, struct ui_file *stream,
|
|
|
|
|
int format, int recurse,
|
2000-07-30 03:48:28 +02:00
|
|
|
|
enum val_prettyprint pretty,
|
|
|
|
|
struct type **dont_print_vb)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
|
|
|
|
struct type **last_dont_print
|
|
|
|
|
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
|
2007-02-08 15:20:56 +01:00
|
|
|
|
struct obstack tmp_obstack = dont_print_vb_obstack;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
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. */
|
|
|
|
|
/* Bump up the high-water mark. Now alpha is omega. */
|
|
|
|
|
obstack_finish (&dont_print_vb_obstack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_baseclasses; i++)
|
|
|
|
|
{
|
|
|
|
|
int boffset;
|
|
|
|
|
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
|
2007-03-22 00:57:14 +01:00
|
|
|
|
char *basename = type_name_no_tag (baseclass);
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
const gdb_byte *base_valaddr;
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
if (BASETYPE_VIA_VIRTUAL (type, i))
|
|
|
|
|
{
|
|
|
|
|
struct type **first_dont_print
|
|
|
|
|
= (struct type **) obstack_base (&dont_print_vb_obstack);
|
|
|
|
|
|
|
|
|
|
int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
|
|
|
|
|
- first_dont_print;
|
|
|
|
|
|
|
|
|
|
while (--j >= 0)
|
|
|
|
|
if (baseclass == first_dont_print[j])
|
|
|
|
|
goto flush_it;
|
|
|
|
|
|
|
|
|
|
obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boffset = baseclass_offset (type, i, valaddr, address);
|
|
|
|
|
|
|
|
|
|
if (pretty)
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (stream, "\n");
|
|
|
|
|
print_spaces_filtered (2 * recurse, stream);
|
|
|
|
|
}
|
|
|
|
|
fputs_filtered ("<", stream);
|
|
|
|
|
/* Not sure what the best notation is in the case where there is no
|
|
|
|
|
baseclass name. */
|
|
|
|
|
|
|
|
|
|
fputs_filtered (basename ? basename : "", stream);
|
|
|
|
|
fputs_filtered ("> = ", stream);
|
|
|
|
|
|
|
|
|
|
/* The virtual base class pointer might have been clobbered by the
|
|
|
|
|
user program. Make sure that it still points to a valid memory
|
|
|
|
|
location. */
|
|
|
|
|
|
|
|
|
|
if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type)))
|
|
|
|
|
{
|
2002-01-08 03:09:31 +01:00
|
|
|
|
/* FIXME (alloc): not safe is baseclass is really really big. */
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
|
gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
|
2005-01-28 Andrew Cagney <cagney@gnu.org>
* language.h (struct language_defn): Make la_val_print's buffer
parameter a const bfd_byte.
* cp-valprint.c (cp_print_value_fields, cp_print_value): Update.
* ada-lang.c (ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* valprint.c (val_print_array_elements): Update.
* valprint.h (val_print_array_elements): Update.
* ada-lang.h (ada_val_print, ada_aligned_value_addr)
(ada_value_primitive_packed_val, ada_which_variant_applies): Update.
* ada-valprint.c (ada_val_print, struct ada_val_print_args)
(ada_val_print_1, ada_print_floating, printable_val_type)
(print_record, val_print_packed_array_elements)
(print_field_values, print_variant_part): Update.
* c-lang.h (c_val_print, cp_print_value_fields): Update.
* c-valprint.c (c_val_print): Update.
* f-lang.h (f_val_print): Update.
* f-valprint.c (f_val_print, f77_print_array_1)
(f77_print_array): Update.
* jv-lang.h (java_val_print): Update.
* jv-valprint.c (java_print_value_fields, java_val_print): Update.
* language.c (unk_lang_val_print): Update.
* m2-lang.h (m2_val_print): Update.
* m2-valprint.c (m2_val_print): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* p-valprint.c (pascal_val_print)
(pascal_object_print_value_fields, pascal_object_print_value)
(pascal_object_print_value): Update.
* scm-lang.h (scm_val_print): Update.
* scm-valprint.c (scm_val_print): Update.
* value.h (val_print): Update.
2005-01-29 02:59:31 +01:00
|
|
|
|
base_valaddr = buf;
|
|
|
|
|
if (target_read_memory (address + boffset, buf,
|
2000-06-14 14:27:59 +02:00
|
|
|
|
TYPE_LENGTH (baseclass)) != 0)
|
|
|
|
|
boffset = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
base_valaddr = valaddr + boffset;
|
|
|
|
|
|
|
|
|
|
if (boffset == -1)
|
|
|
|
|
fprintf_filtered (stream, "<invalid address>");
|
|
|
|
|
else
|
|
|
|
|
pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
|
|
|
|
|
stream, format, recurse, pretty,
|
|
|
|
|
(struct type **) obstack_base (&dont_print_vb_obstack),
|
|
|
|
|
0);
|
|
|
|
|
fputs_filtered (", ", stream);
|
|
|
|
|
|
|
|
|
|
flush_it:
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dont_print_vb == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Free the space used to deal with the printing
|
|
|
|
|
of this type from top level. */
|
|
|
|
|
obstack_free (&dont_print_vb_obstack, last_dont_print);
|
|
|
|
|
/* Reset watermark so that we can continue protecting
|
|
|
|
|
ourselves from whatever we were protecting ourselves. */
|
|
|
|
|
dont_print_vb_obstack = tmp_obstack;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print value of a static member.
|
|
|
|
|
To avoid infinite recursion when printing a class that contains
|
|
|
|
|
a static instance of the class, we keep the addresses of all printed
|
|
|
|
|
static member classes in an obstack and refuse to print them more
|
|
|
|
|
than once.
|
|
|
|
|
|
2005-02-28 18:00:49 +01:00
|
|
|
|
VAL contains the value to print, STREAM, RECURSE, and PRETTY
|
2000-06-14 14:27:59 +02:00
|
|
|
|
have the same meanings as in c_val_print. */
|
|
|
|
|
|
|
|
|
|
static void
|
2005-02-28 18:00:49 +01:00
|
|
|
|
pascal_object_print_static_field (struct value *val,
|
2000-07-30 03:48:28 +02:00
|
|
|
|
struct ui_file *stream, int format,
|
|
|
|
|
int recurse, enum val_prettyprint pretty)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2005-02-28 18:00:49 +01:00
|
|
|
|
struct type *type = value_type (val);
|
|
|
|
|
|
2000-06-14 14:27:59 +02:00
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR *first_dont_print;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
first_dont_print
|
|
|
|
|
= (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
|
|
|
|
|
i = (CORE_ADDR *) obstack_next_free (&dont_print_statmem_obstack)
|
|
|
|
|
- first_dont_print;
|
|
|
|
|
|
|
|
|
|
while (--i >= 0)
|
|
|
|
|
{
|
|
|
|
|
if (VALUE_ADDRESS (val) == first_dont_print[i])
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("<same as static member of an already seen type>",
|
|
|
|
|
stream);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obstack_grow (&dont_print_statmem_obstack, (char *) &VALUE_ADDRESS (val),
|
|
|
|
|
sizeof (CORE_ADDR));
|
|
|
|
|
|
|
|
|
|
CHECK_TYPEDEF (type);
|
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-07 01:09:56 +01:00
|
|
|
|
pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
|
2000-06-14 14:27:59 +02:00
|
|
|
|
stream, format, recurse, pretty, NULL, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
* valprint.c (val_print): Add new language parameter and use it
instead of using the current_language. Update calls to val_print
throughout.
(common_val_print): Add new langauge parameter and pass it to
val_print.
* value.h (struct language_defn): Add opaque declaration.
(val_print, common_val_print): Update declarations.
* stack.c (print_frame_args): Update call to common_val_print
using the appropriate language.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
#include "language.h" if necessary.
Update calls to val_print and common_val_print.
* Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
Update dependencies.
2008-05-06 23:35:01 +02:00
|
|
|
|
common_val_print (val, stream, format, 0, recurse, pretty,
|
|
|
|
|
current_language);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
|
extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */
|
2000-06-14 14:27:59 +02:00
|
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
|
_initialize_pascal_valprint (void)
|
2000-06-14 14:27:59 +02:00
|
|
|
|
{
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_boolean_command through out. Delete #ifdef 0'ed
code adding set/show boolean commands.
* cp-valprint.c, dcache.c, exec.c, gdbtypes.c, infrun.c: Update.
* monitor.c, p-valprint.c, pa64solib.c, printcmd.c: Update.
* proc-api.c, remote-mips.c, remote.c, solib.c: Update.
* somsolib.c, symfile.c, top.c, utils.c, valops.c: Update.
* valprint.c, win32-nat.c, wince.c, xcoffsolib.c: Update.
* cli/cli-cmds.c: Update.
2005-02-18 16:25:32 +01:00
|
|
|
|
add_setshow_boolean_cmd ("pascal_static-members", class_support,
|
|
|
|
|
&pascal_static_field_print, _("\
|
|
|
|
|
Set printing of pascal static members."), _("\
|
|
|
|
|
Show printing of pascal static members."), NULL,
|
|
|
|
|
NULL,
|
2005-02-24 Andrew Cagney <cagney@gnu.org>
Add show_VARIABLE functions, update add_setshow call.
* varobj.c (_initialize_varobj, show_varobjdebug): Add and update.
* valprint.c (_initialize_valprint, show_print_max)
(show_stop_print_at_null, show_repeat_count_threshold)
(show_prettyprint_structs, show_unionprint)
(show_prettyprint_arrays, show_addressprint, show_input_radix)
(show_output_radix): Ditto.
* valops.c (_initialize_valops, show_overload_resolution): Ditto.
* utils.c (initialize_utils, show_chars_per_line)
(show_lines_per_page, show_demangle, show_pagination_enabled)
(show_sevenbit_strings, show_asm_demangle): Ditto
* tui/tui-win.c (_initialize_tui_win, show_tui_border_kind)
(show_tui_border_mode, show_tui_active_border_mode): Ditto.
* top.c (init_main, show_new_async_prompt)
(show_async_command_editing_p, show_write_history_p)
(show_history_size, show_history_filename, show_caution)
(show_annotation_level, init_main): Ditto.
* target.c (initialize_targets, show_targetdebug)
(show_trust_readonly): Ditto.
* symfile.c (_initialize_symfile, show_symbol_reloading)
(show_ext_args, show_download_write_size)
(show_debug_file_directory): Ditto.
* source.c (_initialize_source, show_lines_to_list): Ditto.
* solib.c (_initialize_solib, show_auto_solib_add)
(show_solib_search_path): Ditto.
* p-valprint.c (_initialize_pascal_valprint)
(show_pascal_static_field_print): Ditto.
* printcmd.c (_initialize_printcmd, show_max_symbolic_offset)
(show_print_symbol_filename): Add and update.
* parse.c (_initialize_parse, show_expressiondebug): Dito.
* observer.c (_initialize_observer, show_observer_debug): Dito.
* maint.c (_initialize_maint_cmds, show_watchdog)
(show_maintenance_profile_p): Dito.
* linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito.
* infrun.c (_initialize_infrun, show_debug_infrun)
(show_stop_on_solib_events, show_follow_fork_mode_string)
(show_scheduler_mode, show_step_stop_if_no_debug): Ditto.
* infcall.c (_initialize_infcall, show_coerce_float_to_double_p)
(show_unwind_on_signal_p): Ditto.
* gdbtypes.c (build_gdbtypes, show_opaque_type_resolution)
(_initialize_gdbtypes, show_overload_debug): Ditto.
* gdb-events.c, gdb-events.sh (_initialize_gdb_events)
(show_gdb_events_debug): Ditto.
* gdbarch.c, gdbarch.sh (show_gdbarch_debug)
(_initialize_gdbarch): Ditto.
* frame.c (_initialize_frame, show_backtrace_past_main)
(show_backtrace_past_entry, show_backtrace_limit)
(show_frame_debug): Ditto.
* exec.c (_initialize_exec, show_write_files): Ditto.
* dwarf2read.c (_initialize_dwarf2_read)
(show_dwarf2_max_cache_age): Ditto.
* demangle.c (_initialize_demangler)
(show_demangling_style_names): Ditto.
* dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto.
* cp-valprint.c (show_static_field_print)
(_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto.
* corefile.c (_initialize_core, show_gnutarget_string): Ditto.
* cli/cli-logging.c (_initialize_cli_logging)
(show_logging_overwrite, show_logging_redirect)
(show_logging_filename): Ditto.
* cli/cli-cmds.c (show_info_verbose, show_history_expansion_p)
(init_cli_cmds, show_baud_rate, show_remote_debug)
(show_remote_timeout, show_max_user_call_depth): Ditto.
* charset.c (show_host_charset_name, show_target_charset_name)
(initialize_charset): Ditto.
* breakpoint.c (show_can_use_hw_watchpoints)
(show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
|
|
|
|
show_pascal_static_field_print,
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_boolean_command through out. Delete #ifdef 0'ed
code adding set/show boolean commands.
* cp-valprint.c, dcache.c, exec.c, gdbtypes.c, infrun.c: Update.
* monitor.c, p-valprint.c, pa64solib.c, printcmd.c: Update.
* proc-api.c, remote-mips.c, remote.c, solib.c: Update.
* somsolib.c, symfile.c, top.c, utils.c, valops.c: Update.
* valprint.c, win32-nat.c, wince.c, xcoffsolib.c: Update.
* cli/cli-cmds.c: Update.
2005-02-18 16:25:32 +01:00
|
|
|
|
&setprintlist, &showprintlist);
|
2000-06-14 14:27:59 +02:00
|
|
|
|
/* Turn on printing of static fields. */
|
|
|
|
|
pascal_static_field_print = 1;
|
|
|
|
|
|
|
|
|
|
}
|