From 10a2c479a7ced4d97b179bdf6cb2a12891d57c62 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 28 Jan 2005 19:56:01 +0000 Subject: [PATCH] 2005-01-28 Andrew Cagney * ada-lang.c (value_from_contents_and_address) (to_record_with_fixed_variant_part) (value_tag_from_contents_and_address, ada_to_fixed_type) (to_fixed_variant_branch_type, to_fixed_record_type) (ada_template_to_fixed_record_type, cond_offset_host) (ada_template_to_fixed_record_type_1): Make buffer a const bfd_byte. * ada-lang.h (ada_template_to_fixed_record_type_1) (value_from_contents_and_address, ada_to_fixed_type): Ditto. --- gdb/ChangeLog | 10 ++++++++++ gdb/ada-lang.c | 35 +++++++++++++++++++++-------------- gdb/ada-lang.h | 16 +++++++++------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 21d18dbc49b..3675a7942ba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2005-01-28 Andrew Cagney + * ada-lang.c (value_from_contents_and_address) + (to_record_with_fixed_variant_part) + (value_tag_from_contents_and_address, ada_to_fixed_type) + (to_fixed_variant_branch_type, to_fixed_record_type) + (ada_template_to_fixed_record_type, cond_offset_host) + (ada_template_to_fixed_record_type_1): Make buffer a const + bfd_byte. + * ada-lang.h (ada_template_to_fixed_record_type_1) + (value_from_contents_and_address, ada_to_fixed_type): Ditto. + * ada-valprint.c (char_at, printstr): Make buffer a const bfd_byte. * gdbtypes.h (print_scalar_formatted): Make buffer a const bfd_byte. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 18776230d0e..a04ee90c217 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1,6 +1,7 @@ /* Ada language support routines for GDB, the GNU debugger. Copyright - 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003, 2004. - Free Software Foundation, Inc. + + 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003, 2004, 2005 Free + Software Foundation, Inc. This file is part of GDB. @@ -161,7 +162,8 @@ static struct value *evaluate_subexp_type (struct expression *, int *); static int is_dynamic_field (struct type *, int); -static struct type *to_fixed_variant_branch_type (struct type *, char *, +static struct type *to_fixed_variant_branch_type (struct type *, + const bfd_byte *, CORE_ADDR, struct value *); static struct type *to_fixed_array_type (struct type *, struct value *, int); @@ -412,7 +414,8 @@ is_suffix (const char *str, const char *suffix) ADDRESS. */ struct value * -value_from_contents_and_address (struct type *type, char *valaddr, +value_from_contents_and_address (struct type *type, + const bfd_byte *valaddr, CORE_ADDR address) { struct value *v = allocate_value (type); @@ -458,8 +461,8 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) } } -static char * -cond_offset_host (char *valaddr, long offset) +static const bfd_byte * +cond_offset_host (const bfd_byte *valaddr, long offset) { if (valaddr == NULL) return NULL; @@ -4995,7 +4998,8 @@ ada_value_tag (struct value *val) ADDRESS. */ static struct value * -value_tag_from_contents_and_address (struct type *type, char *valaddr, +value_tag_from_contents_and_address (struct type *type, + const bfd_byte *valaddr, CORE_ADDR address) { int tag_byte_offset, dummy1, dummy2; @@ -5003,7 +5007,9 @@ value_tag_from_contents_and_address (struct type *type, char *valaddr, if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, &dummy1, &dummy2)) { - char *valaddr1 = (valaddr == NULL) ? NULL : valaddr + tag_byte_offset; + const bfd_byte *valaddr1 = ((valaddr == NULL) + ? NULL + : valaddr + tag_byte_offset); CORE_ADDR address1 = (address == 0) ? 0 : address + tag_byte_offset; return value_from_contents_and_address (tag_type, valaddr1, address1); @@ -6049,7 +6055,8 @@ empty_record (struct objfile *objfile) byte-aligned. */ struct type * -ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr, +ada_template_to_fixed_record_type_1 (struct type *type, + const bfd_byte *valaddr, CORE_ADDR address, struct value *dval0, int keep_dynamic_fields) { @@ -6209,7 +6216,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr, of 1. */ static struct type * -template_to_fixed_record_type (struct type *type, char *valaddr, +template_to_fixed_record_type (struct type *type, const bfd_byte *valaddr, CORE_ADDR address, struct value *dval0) { return ada_template_to_fixed_record_type_1 (type, valaddr, @@ -6276,7 +6283,7 @@ template_to_static_fixed_type (struct type *type0) contains the necessary discriminant values. */ static struct type * -to_record_with_fixed_variant_part (struct type *type, char *valaddr, +to_record_with_fixed_variant_part (struct type *type, const bfd_byte *valaddr, CORE_ADDR address, struct value *dval0) { struct value *mark = value_mark (); @@ -6354,7 +6361,7 @@ to_record_with_fixed_variant_part (struct type *type, char *valaddr, shortcut and suspect the compiler should be altered. FIXME. */ static struct type * -to_fixed_record_type (struct type *type0, char *valaddr, +to_fixed_record_type (struct type *type0, const bfd_byte *valaddr, CORE_ADDR address, struct value *dval) { struct type *templ_type; @@ -6389,7 +6396,7 @@ to_fixed_record_type (struct type *type0, char *valaddr, indicated in the union's type name. */ static struct type * -to_fixed_variant_branch_type (struct type *var_type0, char *valaddr, +to_fixed_variant_branch_type (struct type *var_type0, const bfd_byte *valaddr, CORE_ADDR address, struct value *dval) { int which; @@ -6495,7 +6502,7 @@ to_fixed_array_type (struct type *type0, struct value *dval, ADDRESS or in VALADDR contains these discriminants. */ struct type * -ada_to_fixed_type (struct type *type, char *valaddr, +ada_to_fixed_type (struct type *type, const bfd_byte *valaddr, CORE_ADDR address, struct value *dval) { type = ada_check_typedef (type); diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index 970ad474a37..7db9452960c 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -196,7 +196,8 @@ extern int ada_value_print (struct value *, struct ui_file *, int, /* Defined in ada-lang.c */ -extern struct value *value_from_contents_and_address (struct type *, char *, +extern struct value *value_from_contents_and_address (struct type *, + const bfd_byte *, CORE_ADDR); extern void ada_emit_char (int, struct ui_file *, int, int); @@ -339,13 +340,14 @@ extern struct type *ada_system_address_type (void); extern int ada_which_variant_applies (struct type *, struct type *, char *); -extern struct type *ada_to_fixed_type (struct type *, char *, CORE_ADDR, - struct value *); +extern struct type *ada_to_fixed_type (struct type *, const bfd_byte *, + CORE_ADDR, struct value *); -extern struct type * - ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr, - CORE_ADDR address, struct value *dval0, - int keep_dynamic_fields); +extern struct type *ada_template_to_fixed_record_type_1 (struct type *type, + const bfd_byte *valaddr, + CORE_ADDR address, + struct value *dval0, + int keep_dynamic_fields); extern int ada_name_prefix_len (const char *); -- 2.30.2