This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [commit] Ada-valprint.c const tweaks
Mark Kettenis wrote:
Date: Fri, 28 Jan 2005 14:19:48 -0500
From: Andrew Cagney <cagney@gnu.org>
FYI,
Andrew
This patch must be wrong! In C a string has type 'char *' and the
type of a single character is 'int'. If your compiler is warning
about incompatible types here, it's got a bug. This proves that
mindless replacement of 'char' with 'bfd_byte' is a stupid thing to
do.
I've attached exibit A, the full patch that I'm merging.
If you look carefully at printstr, you'll see that it's receiving in raw
byte buffer _buffer_ and a _length_; not a null terminated "char *"
string. That language code, such as scheme, print it using %s is well
"somebody elses problem".
Andrew
? ChangeLog.new
? autom4te.cache
? diff.html
? diffs
? fail.html
? index.html
? new-gdbarch.c
? new-gdbarch.h
? new-gdbarch.log
? pass.html
? ppc-linux-tdep.c.new
? testsuite/diffs
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.67
diff -p -u -r1.67 ada-lang.c
--- ada-lang.c 28 Jan 2005 19:56:00 -0000 1.67
+++ ada-lang.c 28 Jan 2005 20:21:13 -0000
@@ -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),
Index: ada-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.h,v
retrieving revision 1.16
diff -p -u -r1.16 ada-lang.h
--- ada-lang.h 28 Jan 2005 19:56:01 -0000 1.16
+++ ada-lang.h 28 Jan 2005 20:21:13 -0000
@@ -187,8 +187,8 @@ extern void ada_error (char *); /* Defin
extern void ada_print_type (struct type *, char *, struct ui_file *, int,
int);
-extern int ada_val_print (struct type *, char *, int, CORE_ADDR,
- struct ui_file *, int, int, int,
+extern int ada_val_print (struct type *, const bfd_byte *, int,
+ CORE_ADDR, struct ui_file *, int, int, int,
enum val_prettyprint);
extern int ada_value_print (struct value *, struct ui_file *, int,
@@ -204,7 +204,8 @@ extern void ada_emit_char (int, struct u
extern void ada_printchar (int, struct ui_file *);
-extern void ada_printstr (struct ui_file *, char *, unsigned int, int, int);
+extern void ada_printstr (struct ui_file *, const bfd_byte *,
+ unsigned int, int, int);
extern void ada_convert_actuals (struct value *, int, struct value **,
CORE_ADDR *);
@@ -276,7 +277,8 @@ extern int ada_is_ignored_field (struct
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 *);
@@ -316,7 +318,8 @@ extern int ada_is_aligner_type (struct t
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);
@@ -338,7 +341,8 @@ extern struct value *ada_vax_float_print
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 *);
Index: ada-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-valprint.c,v
retrieving revision 1.18
diff -p -u -r1.18 ada-valprint.c
--- ada-valprint.c 28 Jan 2005 19:19:10 -0000 1.18
+++ ada-valprint.c 28 Jan 2005 20:21:13 -0000
@@ -39,7 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridg
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,22 @@ struct ada_val_print_args
enum val_prettyprint pretty;
};
-static void print_record (struct type *, char *, struct ui_file *, int,
+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 *,
+static int print_field_values (struct type *, const bfd_byte *,
+ struct ui_file *,
int, int, enum val_prettyprint,
- int, struct type *, char *);
-
-static int print_variant_part (struct type *, int, char *,
- 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);
+ int, struct type *, 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 +130,7 @@ print_optional_low_bound (struct ui_file
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 +238,7 @@ val_print_packed_array_elements (struct
}
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 +291,8 @@ ui_memcpy (void *dest, const char *buffe
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;
@@ -528,8 +521,8 @@ printstr (struct ui_file *stream, const
}
void
-ada_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+ada_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
printstr (stream, string, length, force_ellipses, width);
}
@@ -555,9 +548,10 @@ ada_printstr (struct ui_file *stream, ch
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,16 +583,17 @@ 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,
- int deref_ref, int recurse, enum val_prettyprint pretty)
+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;
int i;
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 +874,11 @@ ada_val_print_1 (struct type *type, char
}
static int
-print_variant_part (struct type *type, int field_num, 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_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,
+ 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 +954,9 @@ ada_value_print (struct value *val0, str
}
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 +987,10 @@ print_record (struct type *type, char *v
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;
Index: c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.33
diff -p -u -r1.33 c-lang.c
--- c-lang.c 11 Sep 2004 10:24:45 -0000 1.33
+++ c-lang.c 28 Jan 2005 20:21:13 -0000
@@ -85,8 +85,8 @@ c_printchar (int c, struct ui_file *stre
printing LENGTH characters, or if FORCE_ELLIPSES. */
void
-c_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+c_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
unsigned int i;
unsigned int things_printed = 0;
Index: c-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.h,v
retrieving revision 1.8
diff -p -u -r1.8 c-lang.h
--- c-lang.h 28 Jul 2004 15:18:06 -0000 1.8
+++ c-lang.h 28 Jan 2005 20:21:13 -0000
@@ -1,6 +1,7 @@
/* C language support definitions for GDB, the GNU debugger.
- Copyright 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2005 Free
+ Software Foundation, Inc.
This file is part of GDB.
@@ -38,8 +39,8 @@ extern void c_error (char *); /* Defined
extern void c_print_type (struct type *, char *, struct ui_file *, int,
int);
-extern int c_val_print (struct type *, char *, int, CORE_ADDR,
- struct ui_file *, int, int, int,
+extern int c_val_print (struct type *, const bfd_byte *, int,
+ CORE_ADDR, struct ui_file *, int, int, int,
enum val_prettyprint);
extern int c_value_print (struct value *, struct ui_file *, int,
@@ -49,7 +50,8 @@ extern int c_value_print (struct value *
extern void c_printchar (int, struct ui_file *);
-extern void c_printstr (struct ui_file * stream, char *string,
+extern void c_printstr (struct ui_file * stream,
+ const bfd_byte *string,
unsigned int length, int width,
int force_ellipses);
@@ -75,14 +77,16 @@ extern int vtblprint; /* Controls print
extern int static_field_print;
-extern void cp_print_class_member (char *, struct type *, struct ui_file *,
- char *);
+extern void cp_print_class_member (const bfd_byte *, struct type *,
+ struct ui_file *, char *);
-extern void cp_print_class_method (char *, struct type *, struct ui_file *);
+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,
- int, enum val_prettyprint,
+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);
extern int cp_is_vtbl_ptr_type (struct type *);
Index: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.25
diff -p -u -r1.25 c-valprint.c
--- c-valprint.c 12 Nov 2004 21:45:06 -0000 1.25
+++ c-valprint.c 28 Jan 2005 20:21:13 -0000
@@ -69,9 +69,10 @@ print_function_pointer_address (CORE_ADD
The PRETTY parameter controls prettyprinting. */
int
-c_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)
+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)
{
unsigned int i = 0; /* Number of characters printed */
unsigned len;
Index: cp-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-valprint.c,v
retrieving revision 1.27
diff -p -u -r1.27 cp-valprint.c
--- cp-valprint.c 12 Nov 2004 21:45:06 -0000 1.27
+++ cp-valprint.c 28 Jan 2005 20:21:13 -0000
@@ -50,7 +50,8 @@ static void cp_print_static_field (struc
struct ui_file *, int, int,
enum val_prettyprint);
-static void cp_print_value (struct type *, struct type *, char *, 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 **);
@@ -62,7 +63,7 @@ static void cp_print_hpacc_virtual_table
void
-cp_print_class_method (char *valaddr,
+cp_print_class_method (const bfd_byte *valaddr,
struct type *type,
struct ui_file *stream)
{
@@ -227,9 +228,10 @@ 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,
+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;
@@ -489,7 +491,8 @@ cp_print_value_fields (struct type *type
baseclasses. */
static void
-cp_print_value (struct type *type, struct type *real_type, char *valaddr,
+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)
@@ -517,7 +520,7 @@ cp_print_value (struct type *type, struc
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))
{
@@ -563,9 +566,11 @@ cp_print_value (struct type *type, struc
&& ((boffset + offset) < 0
|| (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,
+ /* FIXME (alloca): unsafe if baseclass is really
+ really large. */
+ bfd_byte *buf = (char *) alloca (TYPE_LENGTH (baseclass));
+ base_valaddr = buf;
+ if (target_read_memory (address + boffset, buf,
TYPE_LENGTH (baseclass)) != 0)
skip = 1;
address = address + boffset;
@@ -673,7 +678,7 @@ cp_print_static_field (struct type *type
}
void
-cp_print_class_member (char *valaddr, struct type *domain,
+cp_print_class_member (const bfd_byte *valaddr, struct type *domain,
struct ui_file *stream, char *prefix)
{
Index: f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.27
diff -p -u -r1.27 f-lang.c
--- f-lang.c 11 Sep 2004 10:24:47 -0000 1.27
+++ f-lang.c 28 Jan 2005 20:21:13 -0000
@@ -87,9 +87,6 @@ static void patch_common_entries (SAVED_
#endif
static struct type *f_create_fundamental_type (struct objfile *, int);
-static void f_printstr (struct ui_file * stream, char *string,
- unsigned int length, int width,
- int force_ellipses);
static void f_printchar (int c, struct ui_file * stream);
static void f_emit_char (int c, struct ui_file * stream, int quoter);
@@ -161,7 +158,8 @@ f_printchar (int c, struct ui_file *stre
be replaced with a true F77 version. */
static void
-f_printstr (struct ui_file *stream, char *string, unsigned int length,
+f_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length,
int width, int force_ellipses)
{
unsigned int i;
Index: f-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.h,v
retrieving revision 1.3
diff -p -u -r1.3 f-lang.h
--- f-lang.h 6 Mar 2001 08:21:07 -0000 1.3
+++ f-lang.h 28 Jan 2005 20:21:13 -0000
@@ -1,8 +1,10 @@
/* Fortran language support definitions for GDB, the GNU debugger.
- Copyright 1992, 1993, 1994, 1995, 1998, 2000
- Free Software Foundation, Inc.
- Contributed by Motorola. Adapted from the C definitions by Farooq Butt
- (fmbutt@engage.sps.mot.com).
+
+ 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).
This file is part of GDB.
@@ -28,8 +30,8 @@ extern void f_error (char *); /* Defined
extern void f_print_type (struct type *, char *, struct ui_file *, int,
int);
-extern int f_val_print (struct type *, char *, int, CORE_ADDR,
- struct ui_file *, int, int, int,
+extern int f_val_print (struct type *, const bfd_byte *, int,
+ CORE_ADDR, struct ui_file *, int, int, int,
enum val_prettyprint);
/* Language-specific data structures */
Index: f-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/f-valprint.c,v
retrieving revision 1.22
diff -p -u -r1.22 f-valprint.c
--- f-valprint.c 12 Nov 2004 21:45:06 -0000 1.22
+++ f-valprint.c 28 Jan 2005 20:21:13 -0000
@@ -42,13 +42,6 @@ static int there_is_a_visible_common_nam
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,10 +271,10 @@ f77_create_arrayprint_offset_tbl (struct
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,
- int deref_ref, int recurse, enum val_prettyprint pretty,
- int *elts)
+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)
{
int i;
@@ -323,9 +316,9 @@ f77_print_array_1 (int nss, int ndimensi
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,
- enum val_prettyprint pretty)
+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;
int elts = 0;
@@ -361,9 +354,10 @@ f77_print_array (struct type *type, char
The PRETTY parameter controls prettyprinting. */
int
-f_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)
+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)
{
unsigned int i = 0; /* Number of characters printed */
struct type *elttype;
Index: jv-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.h,v
retrieving revision 1.4
diff -p -u -r1.4 jv-lang.h
--- jv-lang.h 21 Oct 2001 01:57:42 -0000 1.4
+++ jv-lang.h 28 Jan 2005 20:21:13 -0000
@@ -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,8 +42,8 @@ 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,
- struct ui_file *, int, int, int,
+extern int java_val_print (struct type *, const bfd_byte *, int,
+ CORE_ADDR, struct ui_file *, int, int, int,
enum val_prettyprint);
extern int java_value_print (struct value *, struct ui_file *, int,
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.19
diff -p -u -r1.19 jv-valprint.c
--- jv-valprint.c 12 Nov 2004 21:45:06 -0000 1.19
+++ jv-valprint.c 28 Jan 2005 20:21:13 -0000
@@ -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,8 +246,9 @@ java_value_print (struct value *val, str
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,
+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 +268,7 @@ java_print_value_fields (struct type *ty
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 +446,10 @@ java_print_value_fields (struct type *ty
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;
Index: language.c
===================================================================
RCS file: /cvs/src/src/gdb/language.c,v
retrieving revision 1.52
diff -p -u -r1.52 language.c
--- language.c 22 Sep 2004 20:23:54 -0000 1.52
+++ language.c 28 Jan 2005 20:21:13 -0000
@@ -1,7 +1,7 @@
/* Multiple source language support for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by the Department of Computer Science at the State University
of New York at Buffalo.
@@ -86,17 +86,13 @@ static void unk_lang_emit_char (int c, s
static void unk_lang_printchar (int c, struct ui_file *stream);
-static void unk_lang_printstr (struct ui_file * stream, char *string,
- unsigned int length, int width,
- int force_ellipses);
-
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,
+static int unk_lang_val_print (struct type *, const bfd_byte *, 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);
@@ -1098,8 +1094,8 @@ unk_lang_printchar (int c, struct ui_fil
}
static void
-unk_lang_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+unk_lang_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
error ("internal error - unimplemented function unk_lang_printstr called.");
}
@@ -1118,9 +1114,10 @@ unk_lang_print_type (struct type *type,
}
static int
-unk_lang_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)
+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.");
}
Index: language.h
===================================================================
RCS file: /cvs/src/src/gdb/language.h,v
retrieving revision 1.32
diff -p -u -r1.32 language.h
--- language.h 11 Sep 2004 15:04:16 -0000 1.32
+++ language.h 28 Jan 2005 20:21:13 -0000
@@ -193,7 +193,7 @@ struct language_defn
void (*la_printchar) (int ch, struct ui_file * stream);
- void (*la_printstr) (struct ui_file * stream, char *string,
+ void (*la_printstr) (struct ui_file * stream, const bfd_byte *string,
unsigned int length, int width,
int force_ellipses);
@@ -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);
Index: m2-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-lang.c,v
retrieving revision 1.20
diff -p -u -r1.20 m2-lang.c
--- m2-lang.c 11 Sep 2004 10:24:49 -0000 1.20
+++ m2-lang.c 28 Jan 2005 20:21:14 -0000
@@ -31,9 +31,6 @@
extern void _initialize_m2_language (void);
static struct type *m2_create_fundamental_type (struct objfile *, int);
-static void m2_printstr (struct ui_file * stream, char *string,
- unsigned int length, int width,
- int force_ellipses);
static void m2_printchar (int, struct ui_file *);
static void m2_emit_char (int, struct ui_file *, int);
@@ -109,8 +106,8 @@ m2_printchar (int c, struct ui_file *str
be replaced with a true Modula version. */
static void
-m2_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+m2_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
unsigned int i;
unsigned int things_printed = 0;
Index: m2-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/m2-lang.h,v
retrieving revision 1.3
diff -p -u -r1.3 m2-lang.h
--- m2-lang.h 6 Mar 2001 08:21:09 -0000 1.3
+++ m2-lang.h 28 Jan 2005 20:21:14 -0000
@@ -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 *); /* Define
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);
Index: m2-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-valprint.c,v
retrieving revision 1.6
diff -p -u -r1.6 m2-valprint.c
--- m2-valprint.c 28 Jan 2005 06:40:27 -0000 1.6
+++ m2-valprint.c 28 Jan 2005 20:21:14 -0000
@@ -27,9 +27,10 @@
#include "c-lang.h"
int
-m2_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)
+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)
{
return (c_val_print (type, valaddr, 0, address, stream, format, deref_ref,
recurse, pretty));
Index: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.41
diff -p -u -r1.41 objc-lang.c
--- objc-lang.c 12 Jan 2005 18:31:32 -0000 1.41
+++ objc-lang.c 28 Jan 2005 20:21:14 -0000
@@ -335,7 +335,7 @@ objc_printchar (int c, struct ui_file *s
FORCE_ELLIPSES. */
static void
-objc_printstr (struct ui_file *stream, char *string,
+objc_printstr (struct ui_file *stream, const bfd_byte *string,
unsigned int length, int width, int force_ellipses)
{
unsigned int i;
Index: objc-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.h,v
retrieving revision 1.11
diff -p -u -r1.11 objc-lang.h
--- objc-lang.h 18 Feb 2004 04:22:35 -0000 1.11
+++ objc-lang.h 28 Jan 2005 20:21:14 -0000
@@ -1,6 +1,6 @@
/* Objective-C language support definitions for GDB, the GNU debugger.
- Copyright 1992 Free Software Foundation, Inc.
+ Copyright 1992, 2005 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
@@ -31,10 +31,6 @@ extern int objc_parse (void); /* Define
extern void objc_error (char *); /* Defined in c-exp.y */
-extern int c_val_print (struct type *, char *, int,
- CORE_ADDR, struct ui_file *, int,
- int, int, enum val_prettyprint);
-
extern int c_value_print (struct value *, struct ui_file *,
int, enum val_prettyprint);
Index: p-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.c,v
retrieving revision 1.22
diff -p -u -r1.22 p-lang.c
--- p-lang.c 11 Sep 2004 10:24:50 -0000 1.22
+++ p-lang.c 28 Jan 2005 20:21:14 -0000
@@ -155,8 +155,8 @@ pascal_printchar (int c, struct ui_file
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES. */
void
-pascal_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+pascal_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
unsigned int i;
unsigned int things_printed = 0;
Index: p-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.h,v
retrieving revision 1.4
diff -p -u -r1.4 p-lang.h
--- p-lang.h 2 May 2002 11:18:07 -0000 1.4
+++ p-lang.h 28 Jan 2005 20:21:14 -0000
@@ -1,5 +1,6 @@
/* Pascal language support definitions for GDB, the GNU debugger.
- Copyright 2000 Free Software Foundation, Inc.
+
+ Copyright 2000, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,8 +29,9 @@ extern void pascal_error (char *); /* De
/* 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,
- int, enum val_prettyprint);
+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);
@@ -43,7 +45,8 @@ extern int
extern void pascal_printchar (int, struct ui_file *);
-extern void pascal_printstr (struct ui_file *, char *, unsigned int, int, int);
+extern void pascal_printstr (struct ui_file *, const bfd_byte *,
+ unsigned int, int, int);
extern struct type *pascal_create_fundamental_type (struct objfile *, int);
@@ -63,12 +66,15 @@ extern int vtblprint; /* Controls print
extern int static_field_print;
-extern void pascal_object_print_class_member (char *, struct type *, struct ui_file *, char *);
+extern void pascal_object_print_class_member (const bfd_byte *, struct type *,
+ struct ui_file *, char *);
-extern void pascal_object_print_class_method (char *, struct type *, struct ui_file *);
+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 *);
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.28
diff -p -u -r1.28 p-valprint.c
--- p-valprint.c 12 Nov 2004 21:45:06 -0000 1.28
+++ p-valprint.c 28 Jan 2005 20:21:14 -0000
@@ -56,8 +56,9 @@
int
-pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int format,
+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 */
@@ -586,13 +587,14 @@ static void pascal_object_print_static_f
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 (char *valaddr, struct type *type,
- struct ui_file *stream)
+pascal_object_print_class_method (const bfd_byte *valaddr,
+ struct type *type, struct ui_file *stream)
{
struct type *domain;
struct fn_field *f = NULL;
@@ -730,7 +732,7 @@ pascal_object_is_vtbl_member (struct typ
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 +905,9 @@ pascal_object_print_value_fields (struct
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 +931,7 @@ pascal_object_print_value (struct type *
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 +969,9 @@ pascal_object_print_value (struct type *
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;
}
@@ -1045,7 +1049,7 @@ pascal_object_print_static_field (struct
}
void
-pascal_object_print_class_member (char *valaddr, struct type *domain,
+pascal_object_print_class_member (const bfd_byte *valaddr, struct type *domain,
struct ui_file *stream, char *prefix)
{
Index: scm-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/scm-lang.c,v
retrieving revision 1.28
diff -p -u -r1.28 scm-lang.c
--- scm-lang.c 11 Sep 2004 10:24:50 -0000 1.28
+++ scm-lang.c 28 Jan 2005 20:21:14 -0000
@@ -40,10 +40,6 @@ static struct value *evaluate_subexp_scm
int *, enum noside);
static struct value *scm_lookup_name (char *);
static int in_eval_c (void);
-static void scm_printstr (struct ui_file * stream, char *string,
- unsigned int length, int width,
- int force_ellipses);
-
struct type *builtin_type_scm;
void
@@ -53,8 +49,8 @@ scm_printchar (int c, struct ui_file *st
}
static void
-scm_printstr (struct ui_file *stream, char *string, unsigned int length,
- int width, int force_ellipses)
+scm_printstr (struct ui_file *stream, const bfd_byte *string,
+ unsigned int length, int width, int force_ellipses)
{
fprintf_filtered (stream, "\"%s\"", string);
}
Index: scm-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/scm-lang.h,v
retrieving revision 1.5
diff -p -u -r1.5 scm-lang.h
--- scm-lang.h 14 Jan 2003 00:49:04 -0000 1.5
+++ scm-lang.h 28 Jan 2005 20:21:14 -0000
@@ -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);
Index: scm-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/scm-valprint.c,v
retrieving revision 1.7
diff -p -u -r1.7 scm-valprint.c
--- scm-valprint.c 28 Jan 2005 06:40:27 -0000 1.7
+++ scm-valprint.c 28 Jan 2005 20:21:14 -0000
@@ -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))
{
Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.38
diff -p -u -r1.38 valprint.c
--- valprint.c 28 Jan 2005 16:45:16 -0000 1.38
+++ valprint.c 28 Jan 2005 20:21:14 -0000
@@ -123,9 +123,10 @@ int addressprint; /* Controls printing
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)
@@ -177,7 +178,7 @@ value_print (struct value *val, struct u
value. STREAM is where to print the value. */
void
-val_print_type_code_int (struct type *type, char *valaddr,
+val_print_type_code_int (struct type *type, const bfd_byte *valaddr,
struct ui_file *stream)
{
if (TYPE_LENGTH (type) > sizeof (LONGEST))
@@ -761,10 +762,10 @@ print_char_chars (struct ui_file *stream
*/
void
-val_print_array_elements (struct type *type, char *valaddr, CORE_ADDR address,
- struct ui_file *stream, int format, int deref_ref,
- int recurse, enum val_prettyprint pretty,
- unsigned int i)
+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)
{
unsigned int things_printed = 0;
unsigned len;
Index: valprint.h
===================================================================
RCS file: /cvs/src/src/gdb/valprint.h,v
retrieving revision 1.7
diff -p -u -r1.7 valprint.h
--- valprint.h 28 Jan 2005 16:23:51 -0000 1.7
+++ valprint.h 28 Jan 2005 20:21:14 -0000
@@ -50,11 +50,12 @@ 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 *, char *,
+extern void val_print_type_code_int (struct type *,
+ const bfd_byte *,
struct ui_file *);
extern void print_binary_chars (struct ui_file *, const bfd_byte *,
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.64
diff -p -u -r1.64 value.h
--- value.h 28 Jan 2005 16:45:16 -0000 1.64
+++ value.h 28 Jan 2005 20:21:14 -0000
@@ -479,7 +479,7 @@ extern void value_print_array_elements (
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,