From: Andrew Cagney Date: Sat, 29 Jan 2005 01:59:31 +0000 (+0000) Subject: 2005-01-28 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2bd3dcdac2e47cdb50de67313175fb8b9ce88fa;p=binutils-gdb.git 2005-01-28 Andrew Cagney * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8c64b53070a..f48b080ef18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,37 @@ 2005-01-28 Andrew Cagney + * 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. + * p-lang.h (pascal_object_print_class_member) (pascal_object_print_class_method): Make buffer a const bfd_byte. * p-valprint.c (pascal_object_print_class_method) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a04ee90c217..2fa5e0b1b31 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1783,8 +1783,8 @@ has_negatives (struct type *type) Assumes 0 <= BIT_OFFSET < HOST_CHAR_BIT. */ struct value * -ada_value_primitive_packed_val (struct value *obj, char *valaddr, long offset, - int bit_offset, int bit_size, +ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr, + long offset, int bit_offset, int bit_size, struct type *type) { struct value *v; @@ -5705,7 +5705,7 @@ BadName: int ada_which_variant_applies (struct type *var_type, struct type *outer_type, - char *outer_valaddr) + const bfd_byte *outer_valaddr) { int others_clause; int i; @@ -6854,8 +6854,8 @@ ada_aligned_type (struct type *type) /* The address of the aligned value in an object at address VALADDR having type TYPE. Assumes ada_is_aligner_type (TYPE). */ -char * -ada_aligned_value_addr (struct type *type, char *valaddr) +const bfd_byte * +ada_aligned_value_addr (struct type *type, const bfd_byte *valaddr) { if (ada_is_aligner_type (type)) return ada_aligned_value_addr (TYPE_FIELD_TYPE (type, 0), diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index 57816cbb6ab..9979376dd50 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -1,6 +1,7 @@ /* Ada language support definitions for GDB, the GNU debugger. - Copyright 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + + Copyright 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -187,7 +188,7 @@ extern void ada_error (char *); /* Defined in ada-exp.y */ extern void ada_print_type (struct type *, char *, struct ui_file *, int, int); -extern int ada_val_print (struct type *, char *, int, CORE_ADDR, +extern int ada_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); @@ -277,7 +278,8 @@ extern int ada_is_ignored_field (struct type *, int); extern int ada_is_packed_array_type (struct type *); -extern struct value *ada_value_primitive_packed_val (struct value *, char *, +extern struct value *ada_value_primitive_packed_val (struct value *, + const bfd_byte *, long, int, int, struct type *); @@ -317,7 +319,8 @@ extern int ada_is_aligner_type (struct type *); extern struct type *ada_aligned_type (struct type *); -extern char *ada_aligned_value_addr (struct type *, char *); +extern const bfd_byte *ada_aligned_value_addr (struct type *, + const bfd_byte *); extern const char *ada_attribute_name (enum exp_opcode); @@ -339,7 +342,8 @@ extern struct value *ada_vax_float_print_function (struct type *); extern struct type *ada_system_address_type (void); -extern int ada_which_variant_applies (struct type *, struct type *, char *); +extern int ada_which_variant_applies (struct type *, struct type *, + const bfd_byte *); extern struct type *ada_to_fixed_type (struct type *, const bfd_byte *, CORE_ADDR, struct value *); diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 040a6261a5c..a6e30f2287c 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -39,7 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ struct ada_val_print_args { struct type *type; - char *valaddr0; + const bfd_byte *valaddr0; int embedded_offset; CORE_ADDR address; struct ui_file *stream; @@ -49,30 +49,21 @@ struct ada_val_print_args enum val_prettyprint pretty; }; -static void print_record (struct type *, char *, struct ui_file *, int, - int, enum val_prettyprint); +static void print_record (struct type *, const bfd_byte *, struct ui_file *, + int, int, enum val_prettyprint); -static int print_field_values (struct type *, char *, struct ui_file *, - int, int, enum val_prettyprint, - int, struct type *, char *); - -static int print_variant_part (struct type *, int, char *, +static int print_field_values (struct type *, const bfd_byte *, struct ui_file *, int, int, enum val_prettyprint, int, struct type *, - char *); - -static void val_print_packed_array_elements (struct type *, char *valaddr, - int, struct ui_file *, int, int, - enum val_prettyprint); + const bfd_byte *); static void adjust_type_signedness (struct type *); static int ada_val_print_stub (void *args0); -static int ada_val_print_1 (struct type *, char *, int, CORE_ADDR, +static int ada_val_print_1 (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); -static void ada_print_floating (char *, struct type *, struct ui_file *); /* Make TYPE unsigned if its range of values includes no negatives. */ @@ -138,7 +129,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type) by ada_coerce_to_simple_array). */ static void -val_print_packed_array_elements (struct type *type, char *valaddr, +val_print_packed_array_elements (struct type *type, const bfd_byte *valaddr, int bitoffset, struct ui_file *stream, int format, int recurse, enum val_prettyprint pretty) @@ -246,7 +237,7 @@ val_print_packed_array_elements (struct type *type, char *valaddr, } static struct type * -printable_val_type (struct type *type, char *valaddr) +printable_val_type (struct type *type, const bfd_byte *valaddr) { return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL); } @@ -299,7 +290,8 @@ ui_memcpy (void *dest, const char *buffer, long len) a decimal point, and at least one digit before and after the point. We use GNAT format for NaNs and infinities. */ static void -ada_print_floating (char *valaddr, struct type *type, struct ui_file *stream) +ada_print_floating (const bfd_byte *valaddr, struct type *type, + struct ui_file *stream) { char buffer[64]; char *s, *result; @@ -555,9 +547,10 @@ ada_printstr (struct ui_file *stream, const bfd_byte *string, arrays.) */ int -ada_val_print (struct type *type, char *valaddr0, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, - int deref_ref, int recurse, enum val_prettyprint pretty) +ada_val_print (struct type *type, const bfd_byte *valaddr0, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, + int recurse, enum val_prettyprint pretty) { struct ada_val_print_args args; args.type = type; @@ -589,8 +582,9 @@ ada_val_print_stub (void *args0) * does not catch evaluation errors (leaving that to ada_val_print). */ static int -ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, +ada_val_print_1 (struct type *type, const bfd_byte *valaddr0, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty) { unsigned int len; @@ -598,7 +592,7 @@ ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset, struct type *elttype; unsigned int eltlen; LONGEST val; - char *valaddr = valaddr0 + embedded_offset; + const bfd_byte *valaddr = valaddr0 + embedded_offset; type = ada_check_typedef (type); @@ -879,10 +873,10 @@ ada_val_print_1 (struct type *type, char *valaddr0, int embedded_offset, } static int -print_variant_part (struct type *type, int field_num, char *valaddr, +print_variant_part (struct type *type, int field_num, const bfd_byte *valaddr, struct ui_file *stream, int format, int recurse, enum val_prettyprint pretty, int comma_needed, - struct type *outer_type, char *outer_valaddr) + struct type *outer_type, const bfd_byte *outer_valaddr) { struct type *var_type = TYPE_FIELD_TYPE (type, field_num); int which = ada_which_variant_applies (var_type, outer_type, outer_valaddr); @@ -958,8 +952,9 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format, } static void -print_record (struct type *type, char *valaddr, struct ui_file *stream, - int format, int recurse, enum val_prettyprint pretty) +print_record (struct type *type, const bfd_byte *valaddr, + struct ui_file *stream, int format, int recurse, + enum val_prettyprint pretty) { type = ada_check_typedef (type); @@ -990,10 +985,10 @@ print_record (struct type *type, char *valaddr, struct ui_file *stream, Returns 1 if COMMA_NEEDED or any fields were printed. */ static int -print_field_values (struct type *type, char *valaddr, struct ui_file *stream, - int format, int recurse, enum val_prettyprint pretty, - int comma_needed, struct type *outer_type, - char *outer_valaddr) +print_field_values (struct type *type, const bfd_byte *valaddr, + struct ui_file *stream, int format, int recurse, + enum val_prettyprint pretty, int comma_needed, + struct type *outer_type, const bfd_byte *outer_valaddr) { int i, len; diff --git a/gdb/c-lang.h b/gdb/c-lang.h index 1ecee2cbdd1..0ff90ef730d 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -39,7 +39,7 @@ extern void c_error (char *); /* Defined in c-exp.y */ extern void c_print_type (struct type *, char *, struct ui_file *, int, int); -extern int c_val_print (struct type *, char *, int, CORE_ADDR, +extern int c_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); @@ -82,8 +82,9 @@ extern void cp_print_class_member (const bfd_byte *, struct type *, extern void cp_print_class_method (const bfd_byte *, struct type *, struct ui_file *); -extern void cp_print_value_fields (struct type *, struct type *, char *, - int, CORE_ADDR, struct ui_file *, int, +extern void cp_print_value_fields (struct type *, struct type *, + const bfd_byte *, int, CORE_ADDR, + struct ui_file *, int, int, enum val_prettyprint, struct type **, int); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index f0f1663667f..0871bce5036 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -69,7 +69,7 @@ print_function_pointer_address (CORE_ADDR address, struct ui_file *stream) The PRETTY parameter controls prettyprinting. */ int -c_val_print (struct type *type, char *valaddr, int embedded_offset, +c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty) { diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 0438e436121..a4aef464a9f 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -1,7 +1,7 @@ /* Support for printing C++ values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + + Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -50,8 +50,8 @@ static void cp_print_static_field (struct type *, struct value *, struct ui_file *, int, int, enum val_prettyprint); -static void cp_print_value (struct type *, struct type *, char *, int, - CORE_ADDR, struct ui_file *, int, int, +static void cp_print_value (struct type *, struct type *, const bfd_byte *, + int, CORE_ADDR, struct ui_file *, int, int, enum val_prettyprint, struct type **); static void cp_print_hpacc_virtual_table_entries (struct type *, int *, @@ -227,10 +227,11 @@ cp_is_vtbl_member (struct type *type) should not print, or zero if called from top level. */ void -cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr, - int offset, CORE_ADDR address, struct ui_file *stream, - int format, int recurse, enum val_prettyprint pretty, - struct type **dont_print_vb, int dont_print_statmem) +cp_print_value_fields (struct type *type, struct type *real_type, + const bfd_byte *valaddr, int offset, CORE_ADDR address, + struct ui_file *stream, int format, int recurse, + enum val_prettyprint pretty, + struct type **dont_print_vb,int dont_print_statmem) { int i, len, n_baseclasses; struct obstack tmp_obstack; @@ -489,10 +490,10 @@ cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr, baseclasses. */ static void -cp_print_value (struct type *type, struct type *real_type, char *valaddr, - int offset, CORE_ADDR address, struct ui_file *stream, - int format, int recurse, enum val_prettyprint pretty, - struct type **dont_print_vb) +cp_print_value (struct type *type, struct type *real_type, + const bfd_byte *valaddr, int offset, CORE_ADDR address, + struct ui_file *stream, int format, int recurse, + enum val_prettyprint pretty, struct type **dont_print_vb) { struct obstack tmp_obstack; struct type **last_dont_print @@ -517,7 +518,7 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr, int skip; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); char *basename = TYPE_NAME (baseclass); - char *base_valaddr; + const bfd_byte *base_valaddr; if (BASETYPE_VIA_VIRTUAL (type, i)) { @@ -564,8 +565,9 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr, || (boffset + offset) >= TYPE_LENGTH (type))) { /* FIXME (alloca): unsafe if baseclass is really really large. */ - base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); - if (target_read_memory (address + boffset, base_valaddr, + bfd_byte *buf = alloca (TYPE_LENGTH (baseclass)); + base_valaddr = buf; + if (target_read_memory (address + boffset, buf, TYPE_LENGTH (baseclass)) != 0) skip = 1; address = address + boffset; diff --git a/gdb/f-lang.h b/gdb/f-lang.h index d929b919fc0..2c4ae12b545 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -1,6 +1,8 @@ /* Fortran language support definitions for GDB, the GNU debugger. - Copyright 1992, 1993, 1994, 1995, 1998, 2000 - Free Software Foundation, Inc. + + Copyright 1992, 1993, 1994, 1995, 1998, 2000, 2005 Free Software + Foundation, Inc. + Contributed by Motorola. Adapted from the C definitions by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -28,7 +30,7 @@ extern void f_error (char *); /* Defined in f-exp.y */ extern void f_print_type (struct type *, char *, struct ui_file *, int, int); -extern int f_val_print (struct type *, char *, int, CORE_ADDR, +extern int f_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 24f7b3d345b..fcbe44b9790 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -1,6 +1,8 @@ /* Support for printing Fortran values for GDB, the GNU debugger. - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003 - Free Software Foundation, Inc. + + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2005 Free + Software Foundation, Inc. + Contributed by Motorola. Adapted from the C definitions by Farooq Butt (fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs. @@ -42,13 +44,6 @@ static int there_is_a_visible_common_named (char *); extern void _initialize_f_valprint (void); static void info_common_command (char *, int); static void list_all_visible_commons (char *); -static void f77_print_array (struct type *, char *, CORE_ADDR, - struct ui_file *, int, int, int, - enum val_prettyprint); -static void f77_print_array_1 (int, int, struct type *, char *, - CORE_ADDR, struct ui_file *, int, int, int, - enum val_prettyprint, - int *elts); static void f77_create_arrayprint_offset_tbl (struct type *, struct ui_file *); static void f77_get_dynamic_length_of_aggregate (struct type *); @@ -278,8 +273,9 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) the superior. Address == the address in the inferior. */ static void -f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, - CORE_ADDR address, struct ui_file *stream, int format, +f77_print_array_1 (int nss, int ndimensions, struct type *type, + const bfd_byte *valaddr, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty, int *elts) { @@ -323,8 +319,9 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, stuff and then immediately call f77_print_array_1() */ static void -f77_print_array (struct type *type, char *valaddr, CORE_ADDR address, - struct ui_file *stream, int format, int deref_ref, int recurse, +f77_print_array (struct type *type, const bfd_byte *valaddr, + CORE_ADDR address, struct ui_file *stream, + int format, int deref_ref, int recurse, enum val_prettyprint pretty) { int ndimensions; @@ -361,7 +358,7 @@ f77_print_array (struct type *type, char *valaddr, CORE_ADDR address, The PRETTY parameter controls prettyprinting. */ int -f_val_print (struct type *type, char *valaddr, int embedded_offset, +f_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty) { diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h index 61fb9430aed..1ba6747d65e 100644 --- a/gdb/jv-lang.h +++ b/gdb/jv-lang.h @@ -1,5 +1,7 @@ /* Java language support definitions for GDB, the GNU debugger. - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + + Copyright 1997, 1998, 1999, 2000, 2005 Free Software Foundation, + Inc. This file is part of GDB. @@ -40,7 +42,7 @@ extern struct type *java_float_type; extern struct type *java_double_type; extern struct type *java_void_type; -extern int java_val_print (struct type *, char *, int, CORE_ADDR, +extern int java_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 3de15ec164d..95823438667 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -1,6 +1,6 @@ /* Support for printing Java values for GDB, the GNU debugger. - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -36,13 +36,6 @@ /* Local functions */ -static void java_print_value_fields (struct type * type, char *valaddr, - CORE_ADDR address, - struct ui_file *stream, int format, - int recurse, - enum val_prettyprint pretty); - - int java_value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty) @@ -253,9 +246,9 @@ java_value_print (struct value *val, struct ui_file *stream, int format, should not print, or zero if called from top level. */ static void -java_print_value_fields (struct type *type, char *valaddr, CORE_ADDR address, - struct ui_file *stream, int format, int recurse, - enum val_prettyprint pretty) +java_print_value_fields (struct type *type, const bfd_byte *valaddr, + CORE_ADDR address, struct ui_file *stream, + int format, int recurse, enum val_prettyprint pretty) { int i, len, n_baseclasses; @@ -274,7 +267,7 @@ java_print_value_fields (struct type *type, char *valaddr, CORE_ADDR address, int boffset; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); char *basename = TYPE_NAME (baseclass); - char *base_valaddr; + const bfd_byte *base_valaddr; if (BASETYPE_VIA_VIRTUAL (type, i)) continue; @@ -452,9 +445,10 @@ java_print_value_fields (struct type *type, char *valaddr, CORE_ADDR address, The PRETTY parameter controls prettyprinting. */ int -java_val_print (struct type *type, char *valaddr, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, - int deref_ref, int recurse, enum val_prettyprint pretty) +java_val_print (struct type *type, const bfd_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, + int recurse, enum val_prettyprint pretty) { unsigned int i = 0; /* Number of characters printed */ struct type *target_type; diff --git a/gdb/language.c b/gdb/language.c index ba7b80cb4b7..eb853d1b45a 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -91,10 +91,6 @@ static struct type *unk_lang_create_fundamental_type (struct objfile *, int); static void unk_lang_print_type (struct type *, char *, struct ui_file *, int, int); -static int unk_lang_val_print (struct type *, char *, int, CORE_ADDR, - struct ui_file *, int, int, int, - enum val_prettyprint); - static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint); static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc); @@ -1114,8 +1110,9 @@ unk_lang_print_type (struct type *type, char *varstring, struct ui_file *stream, } static int -unk_lang_val_print (struct type *type, char *valaddr, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, +unk_lang_val_print (struct type *type, const bfd_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty) { error ("internal error - unimplemented function unk_lang_val_print called."); diff --git a/gdb/language.h b/gdb/language.h index e9698b71391..6fd0958820f 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -208,7 +208,7 @@ struct language_defn /* Print a value using syntax appropriate for this language. */ - int (*la_val_print) (struct type *, char *, int, CORE_ADDR, + int (*la_val_print) (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h index a31c5ae3084..94d0abf220b 100644 --- a/gdb/m2-lang.h +++ b/gdb/m2-lang.h @@ -1,5 +1,6 @@ /* Modula 2 language support definitions for GDB, the GNU debugger. - Copyright 1992, 1998, 2000 Free Software Foundation, Inc. + + Copyright 1992, 1998, 2000, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -26,6 +27,6 @@ extern void m2_error (char *); /* Defined in m2-exp.y */ extern void m2_print_type (struct type *, char *, struct ui_file *, int, int); -extern int m2_val_print (struct type *, char *, int, CORE_ADDR, +extern int m2_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index 648aba235e1..d822b8ed48e 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -27,7 +27,7 @@ #include "c-lang.h" int -m2_val_print (struct type *type, char *valaddr, int embedded_offset, +m2_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int format, int deref_ref, int recurse, enum val_prettyprint pretty) { diff --git a/gdb/p-lang.h b/gdb/p-lang.h index fff46664264..0043f5be248 100644 --- a/gdb/p-lang.h +++ b/gdb/p-lang.h @@ -29,7 +29,8 @@ extern void pascal_error (char *); /* Defined in p-exp.y */ /* Defined in p-typeprint.c */ extern void pascal_print_type (struct type *, char *, struct ui_file *, int, int); -extern int pascal_val_print (struct type *, char *, int, CORE_ADDR, struct ui_file *, int, int, +extern int pascal_val_print (struct type *, const bfd_byte *, int, + CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); extern int pascal_value_print (struct value *, struct ui_file *, int, enum val_prettyprint); @@ -71,8 +72,9 @@ extern void pascal_object_print_class_member (const bfd_byte *, struct type *, extern void pascal_object_print_class_method (const bfd_byte *, struct type *, struct ui_file *); -extern void pascal_object_print_value_fields (struct type *, char *, CORE_ADDR, - struct ui_file *, int, int, enum val_prettyprint, +extern void pascal_object_print_value_fields (struct type *, const bfd_byte *, + CORE_ADDR, struct ui_file *, + int, int, enum val_prettyprint, struct type **, int); extern int pascal_object_is_vtbl_ptr_type (struct type *); diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 21d21104338..336c1dfaada 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -56,9 +56,10 @@ int -pascal_val_print (struct type *type, char *valaddr, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, - int deref_ref, int recurse, enum val_prettyprint pretty) +pascal_val_print (struct type *type, const bfd_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, + int recurse, enum val_prettyprint pretty) { unsigned int i = 0; /* Number of characters printed */ unsigned len; @@ -586,9 +587,10 @@ static void pascal_object_print_static_field (struct type *, struct value *, struct ui_file *, int, int, enum val_prettyprint); -static void - pascal_object_print_value (struct type *, char *, CORE_ADDR, struct ui_file *, - int, int, enum val_prettyprint, struct type **); +static void pascal_object_print_value (struct type *, const bfd_byte *, + CORE_ADDR, struct ui_file *, + int, int, enum val_prettyprint, + struct type **); void pascal_object_print_class_method (const bfd_byte *valaddr, struct type *type, @@ -720,8 +722,9 @@ pascal_object_is_vtbl_member (struct type *type) return 0; } -/* 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. +/* 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. TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the same meanings as in pascal_object_print_value and c_val_print. @@ -730,7 +733,7 @@ pascal_object_is_vtbl_member (struct type *type) should not print, or zero if called from top level. */ void -pascal_object_print_value_fields (struct type *type, char *valaddr, +pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr, CORE_ADDR address, struct ui_file *stream, int format, int recurse, enum val_prettyprint pretty, @@ -903,8 +906,9 @@ pascal_object_print_value_fields (struct type *type, char *valaddr, baseclasses. */ void -pascal_object_print_value (struct type *type, char *valaddr, CORE_ADDR address, - struct ui_file *stream, int format, int recurse, +pascal_object_print_value (struct type *type, const bfd_byte *valaddr, + CORE_ADDR address, struct ui_file *stream, + int format, int recurse, enum val_prettyprint pretty, struct type **dont_print_vb) { @@ -928,7 +932,7 @@ pascal_object_print_value (struct type *type, char *valaddr, CORE_ADDR address, int boffset; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); char *basename = TYPE_NAME (baseclass); - char *base_valaddr; + const bfd_byte *base_valaddr; if (BASETYPE_VIA_VIRTUAL (type, i)) { @@ -966,8 +970,9 @@ pascal_object_print_value (struct type *type, char *valaddr, CORE_ADDR address, if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type))) { /* FIXME (alloc): not safe is baseclass is really really big. */ - base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); - if (target_read_memory (address + boffset, base_valaddr, + bfd_byte *buf = alloca (TYPE_LENGTH (baseclass)); + base_valaddr = buf; + if (target_read_memory (address + boffset, buf, TYPE_LENGTH (baseclass)) != 0) boffset = -1; } diff --git a/gdb/scm-lang.h b/gdb/scm-lang.h index 6e24be56c90..1bf963f46af 100644 --- a/gdb/scm-lang.h +++ b/gdb/scm-lang.h @@ -1,6 +1,6 @@ /* Scheme/Guile language support routines for GDB, the GNU debugger. - Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software + Copyright 1995, 1996, 1998, 1999, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -50,7 +50,7 @@ struct value; extern int scm_value_print (struct value *, struct ui_file *, int, enum val_prettyprint); -extern int scm_val_print (struct type *, char *, int, CORE_ADDR, +extern int scm_val_print (struct type *, const bfd_byte *, int, CORE_ADDR, struct ui_file *, int, int, int, enum val_prettyprint); diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index e796653d960..b62e5feea19 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -359,9 +359,10 @@ taloop: } int -scm_val_print (struct type *type, char *valaddr, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, - int deref_ref, int recurse, enum val_prettyprint pretty) +scm_val_print (struct type *type, const bfd_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int format, int deref_ref, + int recurse, enum val_prettyprint pretty) { if (is_scmvalue_type (type)) { diff --git a/gdb/valprint.c b/gdb/valprint.c index b3e4443dd93..9285906dc21 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -123,9 +123,9 @@ int addressprint; /* Controls printing of machine addresses */ int -val_print (struct type *type, char *valaddr, int embedded_offset, - CORE_ADDR address, struct ui_file *stream, int format, int deref_ref, - int recurse, enum val_prettyprint pretty) +val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset, + CORE_ADDR address, struct ui_file *stream, int format, + int deref_ref, int recurse, enum val_prettyprint pretty) { struct type *real_type = check_typedef (type); if (pretty == Val_pretty_default) @@ -761,8 +761,9 @@ print_char_chars (struct ui_file *stream, const bfd_byte *valaddr, */ void -val_print_array_elements (struct type *type, char *valaddr, CORE_ADDR address, - struct ui_file *stream, int format, int deref_ref, +val_print_array_elements (struct type *type, const bfd_byte *valaddr, + CORE_ADDR address, struct ui_file *stream, + int format, int deref_ref, int recurse, enum val_prettyprint pretty, unsigned int i) { diff --git a/gdb/valprint.h b/gdb/valprint.h index 89ae2700ffa..3a923a4d45f 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -50,9 +50,10 @@ extern int output_format; extern int stop_print_at_null; /* Stop printing at null char? */ -extern void val_print_array_elements (struct type *, char *, CORE_ADDR, - struct ui_file *, int, int, int, - enum val_prettyprint, unsigned int); +extern void val_print_array_elements (struct type *, const bfd_byte *, + CORE_ADDR, struct ui_file *, int, + int, int, enum val_prettyprint, + unsigned int); extern void val_print_type_code_int (struct type *, const bfd_byte *, struct ui_file *); diff --git a/gdb/value.h b/gdb/value.h index 50b0932a146..f071b55f2a6 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -479,7 +479,7 @@ extern void value_print_array_elements (struct value *val, extern struct value *value_release_to_mark (struct value *mark); -extern int val_print (struct type *type, char *valaddr, +extern int val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int format, int deref_ref, int recurse,