* valprint.c (val_print): Update.

* p-valprint (pascal_val_print): Return void.
	* p-lang.h (pascal_val_print): Return void.
	* m2-valprint.c (m2_val_print): Return void.
	* m2-lang.h (m2_val_print): Return void.
	* language.h (struct language_defn) <la_val_print>: Return void.
	* language.c (unk_lang_val_print): Return void.
	* jv-valprint.c (java_val_print): Return void.
	* jv-lang.h (java_val_print): Return void.
	* f-valprint.c (f_val_print): Return void.
	* f-lang.h (f_val_print): Return void.
	* d-valprint.c (d_val_print): Return void.
	(dynamic_array_type): Update.
	* d-lang.h (d_val_print): Return void.
	* c-valprint.c (c_val_print): Return void.
	* c-lang.h (c_val_print): Return void.
	* ada-valprint.c (ada_vada_val_print, ada_val_print_1): Return
	void.
	* ada-lang.h (ada_val_print): Return void.
This commit is contained in:
Tom Tromey 2012-03-01 19:26:13 +00:00
parent 35c0084bfc
commit d3eab38a48
18 changed files with 145 additions and 164 deletions

View File

@ -1,3 +1,25 @@
2012-03-01 Tom Tromey <tromey@redhat.com>
* valprint.c (val_print): Update.
* p-valprint (pascal_val_print): Return void.
* p-lang.h (pascal_val_print): Return void.
* m2-valprint.c (m2_val_print): Return void.
* m2-lang.h (m2_val_print): Return void.
* language.h (struct language_defn) <la_val_print>: Return void.
* language.c (unk_lang_val_print): Return void.
* jv-valprint.c (java_val_print): Return void.
* jv-lang.h (java_val_print): Return void.
* f-valprint.c (f_val_print): Return void.
* f-lang.h (f_val_print): Return void.
* d-valprint.c (d_val_print): Return void.
(dynamic_array_type): Update.
* d-lang.h (d_val_print): Return void.
* c-valprint.c (c_val_print): Return void.
* c-lang.h (c_val_print): Return void.
* ada-valprint.c (ada_vada_val_print, ada_val_print_1): Return
void.
* ada-lang.h (ada_val_print): Return void.
2012-03-01 Tom Tromey <tromey@redhat.com>
* value.h (val_print): Return void.

View File

@ -164,10 +164,10 @@ extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void ada_value_print (struct value *, struct ui_file *,
const struct value_print_options *);

View File

@ -50,10 +50,10 @@ static int print_field_values (struct type *, const gdb_byte *,
static void adjust_type_signedness (struct type *);
static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
static void ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
/* Make TYPE unsigned if its range of values includes no negatives. */
@ -566,10 +566,9 @@ ada_printstr (struct ui_file *stream, struct type *type,
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
ada_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
@ -577,35 +576,26 @@ ada_val_print (struct type *type, const gdb_byte *valaddr,
const struct value_print_options *options)
{
volatile struct gdb_exception except;
int result = 0;
/* XXX: this catches QUIT/ctrl-c as well. Isn't that busted? */
TRY_CATCH (except, RETURN_MASK_ALL)
{
result = ada_val_print_1 (type, valaddr, embedded_offset, address,
stream, recurse, val, options);
ada_val_print_1 (type, valaddr, embedded_offset, address,
stream, recurse, val, options);
}
if (except.reason < 0)
result = 0;
return result;
}
/* Assuming TYPE is a simple array, print the value of this array located
at VALADDR + OFFSET. See ada_val_print for a description of the various
parameters of this function; they are identical. The semantics
of the return value is also identical to ada_val_print. */
parameters of this function; they are identical. */
static int
static void
ada_val_print_array (struct type *type, const gdb_byte *valaddr,
int offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options)
{
int result = 0;
/* For an array of chars, print with string syntax. */
if (ada_is_string_type (type)
&& (options->format == 0 || options->format == 's'))
@ -644,7 +634,6 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
}
printstr (stream, elttype, valaddr + offset, len, 0, eltlen, options);
result = len;
}
else
{
@ -658,14 +647,12 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
stream, recurse, val, options, 0);
fprintf_filtered (stream, ")");
}
return result;
}
/* See the comment on ada_val_print. This function differs in that it
does not catch evaluation errors (leaving that to ada_val_print). */
static int
static void
ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
int offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
@ -684,7 +671,6 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
|| (ada_is_constrained_packed_array_type (type)
&& TYPE_CODE (type) != TYPE_CODE_PTR))
{
int retn;
struct value *mark = value_mark ();
struct value *val;
@ -701,16 +687,15 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
{
gdb_assert (TYPE_CODE (type) == TYPE_CODE_TYPEDEF);
fprintf_filtered (stream, "0x0");
retn = 0;
}
else
retn = ada_val_print_1 (value_type (val),
value_contents_for_printing (val),
value_embedded_offset (val),
value_address (val), stream, recurse,
val, options);
ada_val_print_1 (value_type (val),
value_contents_for_printing (val),
value_embedded_offset (val),
value_address (val), stream, recurse,
val, options);
value_free_to_mark (mark);
return retn;
return;
}
offset_aligned = offset + ada_aligned_value_addr (type, valaddr) - valaddr;
@ -719,13 +704,14 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
switch (TYPE_CODE (type))
{
default:
return c_val_print (type, valaddr, offset, address, stream,
recurse, original_value, options);
c_val_print (type, valaddr, offset, address, stream,
recurse, original_value, options);
break;
case TYPE_CODE_PTR:
{
int ret = c_val_print (type, valaddr, offset, address,
stream, recurse, original_value, options);
c_val_print (type, valaddr, offset, address,
stream, recurse, original_value, options);
if (ada_is_tag_type (type))
{
@ -737,9 +723,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
if (name != NULL)
fprintf_filtered (stream, " (%s)", name);
return 0;
}
return ret;
}
return;
}
case TYPE_CODE_INT:
@ -751,7 +736,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g",
(double) ada_fixed_to_float (type, v));
return 0;
return;
}
else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
{
@ -767,16 +752,17 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
= value_from_contents_and_address (type, valaddr + offset, 0);
struct value *v = value_cast (target_type, v1);
return ada_val_print_1 (target_type,
value_contents_for_printing (v),
value_embedded_offset (v), 0,
stream, recurse + 1, v, options);
ada_val_print_1 (target_type,
value_contents_for_printing (v),
value_embedded_offset (v), 0,
stream, recurse + 1, v, options);
}
else
return ada_val_print_1 (TYPE_TARGET_TYPE (type),
valaddr, offset,
address, stream, recurse,
original_value, options);
ada_val_print_1 (TYPE_TARGET_TYPE (type),
valaddr, offset,
address, stream, recurse,
original_value, options);
return;
}
else
{
@ -821,7 +807,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
ada_printchar (c, type, stream);
}
}
return 0;
return;
}
case TYPE_CODE_ENUM:
@ -866,8 +852,11 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
case TYPE_CODE_FLT:
if (options->format)
return c_val_print (type, valaddr, offset, address, stream,
recurse, original_value, options);
{
c_val_print (type, valaddr, offset, address, stream,
recurse, original_value, options);
return;
}
else
ada_print_floating (valaddr + offset, type, stream);
break;
@ -877,19 +866,20 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
if (ada_is_bogus_array_descriptor (type))
{
fprintf_filtered (stream, "(...?)");
return 0;
return;
}
else
{
print_record (type, valaddr, offset_aligned,
stream, recurse, original_value, options);
return 0;
return;
}
case TYPE_CODE_ARRAY:
return ada_val_print_array (type, valaddr, offset_aligned,
address, stream, recurse, original_value,
options);
ada_val_print_array (type, valaddr, offset_aligned,
address, stream, recurse, original_value,
options);
return;
case TYPE_CODE_REF:
/* For references, the debugger is expected to print the value as
@ -935,7 +925,6 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
break;
}
gdb_flush (stream);
return 0;
}
static int

View File

@ -71,11 +71,11 @@ extern void c_print_typedef (struct type *,
struct symbol *,
struct ui_file *);
extern int c_val_print (struct type *, const gdb_byte *,
int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void c_val_print (struct type *, const gdb_byte *,
int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void c_value_print (struct value *, struct ui_file *,
const struct value_print_options *);

View File

@ -117,10 +117,9 @@ c_textual_element_type (struct type *type, char format)
}
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
c_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
@ -262,9 +261,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
/* Try to print what function it points to. */
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
/* Return value is irrelevant except for string
pointers. */
return (0);
return;
}
if (options->addressprint)
@ -328,12 +325,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
}
}
}
/* 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;
return;
}
break;
@ -641,7 +633,6 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
TYPE_CODE (type));
}
gdb_flush (stream);
return (0);
}
void

View File

@ -24,10 +24,10 @@
extern char *d_demangle (const char *mangled, int options);
extern int d_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options);
extern void d_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options);
#endif /* !defined (D_LANG_H) */

View File

@ -23,10 +23,10 @@
#include "d-lang.h"
#include "c-lang.h"
/* Assuming that TYPE is a TYPE_CODE_STRUCT, verify that TYPE is
a dynamic array, and then print its value to STREAM. Return
the number of string characters printed, or -1 if TYPE is not
a dynamic array. */
/* Assuming that TYPE is a TYPE_CODE_STRUCT, verify that TYPE is a
dynamic array, and then print its value to STREAM. Return zero if
TYPE is a dynamic array, non-zero otherwise. */
static int
dynamic_array_type (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
@ -60,16 +60,17 @@ dynamic_array_type (struct type *type, const gdb_byte *valaddr,
true_type = lookup_array_range_type (true_type, 0, length - 1);
ival = value_at (true_type, addr);
return d_val_print (true_type,
value_contents_for_printing (ival),
value_embedded_offset (ival), addr,
stream, recurse + 1, ival, options);
d_val_print (true_type,
value_contents_for_printing (ival),
value_embedded_offset (ival), addr,
stream, recurse + 1, ival, options);
return 0;
}
return -1;
return 1;
}
/* Implements the la_val_print routine for language D. */
int
void
d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value *val,
@ -83,12 +84,10 @@ d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
case TYPE_CODE_STRUCT:
ret = dynamic_array_type (type, valaddr, embedded_offset, address,
stream, recurse, val, options);
if (ret != -1)
break;
if (ret == 0)
break;
default:
ret = c_val_print (type, valaddr, embedded_offset, address, stream,
recurse, val, options);
c_val_print (type, valaddr, embedded_offset, address, stream,
recurse, val, options);
}
return ret;
}

View File

@ -28,10 +28,10 @@ extern void f_error (char *); /* Defined in f-exp.y */
extern void f_print_type (struct type *, const char *, struct ui_file *, int,
int);
extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
/* Language-specific data structures */

View File

@ -243,10 +243,9 @@ Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"),
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value *original_value,
@ -306,8 +305,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
{
/* Try to print what function it points to. */
print_address_demangle (gdbarch, addr, stream, demangle);
/* Return value is irrelevant except for string pointers. */
return 0;
return;
}
if (options->addressprint && options->format != 's')
@ -321,11 +319,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
&& addr != 0)
i = val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
stream, options);
/* 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;
return;
}
break;
@ -514,7 +508,6 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
error (_("Invalid F77 type code %d in symbol table."), TYPE_CODE (type));
}
gdb_flush (stream);
return 0;
}
static void

View File

@ -42,10 +42,10 @@ struct builtin_java_type
extern const struct builtin_java_type *builtin_java_type (struct gdbarch *);
extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void java_value_print (struct value *, struct ui_file *,
const struct value_print_options *);

View File

@ -475,10 +475,9 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
}
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
java_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
@ -504,7 +503,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
if (addr == 0)
{
fputs_filtered ("null", stream);
return i;
return;
}
target_type = check_typedef (TYPE_TARGET_TYPE (type));
@ -512,8 +511,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
{
/* Try to print what function it points to. */
print_address_demangle (gdbarch, addr, stream, demangle);
/* Return value is irrelevant except for string pointers. */
return (0);
return;
}
if (options->addressprint && options->format != 's')
@ -522,7 +520,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
print_longest (stream, 'x', 0, (ULONGEST) addr);
}
return i;
return;
case TYPE_CODE_CHAR:
case TYPE_CODE_INT:
@ -553,9 +551,8 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
break;
default:
return c_val_print (type, valaddr, embedded_offset, address, stream,
recurse, val, options);
c_val_print (type, valaddr, embedded_offset, address, stream,
recurse, val, options);
break;
}
return 0;
}

View File

@ -847,7 +847,7 @@ unk_lang_print_type (struct type *type, const char *varstring,
"function unk_lang_print_type called."));
}
static int
static void
unk_lang_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,

View File

@ -240,12 +240,12 @@ struct language_defn
OPTIONS are the formatting options to be used when
printing. */
int (*la_val_print) (struct type *type,
const gdb_byte *contents,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options);
void (*la_val_print) (struct type *type,
const gdb_byte *contents,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options);
/* Print a top-level value using syntax appropriate for this language. */

View File

@ -32,10 +32,10 @@ extern void m2_print_typedef (struct type *, struct symbol *,
extern int m2_is_long_set (struct type *type);
extern int m2_is_unbounded_array (struct type *type);
extern int m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern int get_long_set_bounds (struct type *type, LONGEST *low,
LONGEST *high);

View File

@ -290,10 +290,9 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value *original_value,
@ -644,5 +643,4 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
error (_("Invalid m2 type code %d in symbol table."), TYPE_CODE (type));
}
gdb_flush (stream);
return (0);
}

View File

@ -35,10 +35,10 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *,
extern void pascal_print_typedef (struct type *, struct symbol *,
struct ui_file *);
extern int pascal_val_print (struct type *, const gdb_byte *, int,
CORE_ADDR, struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void pascal_val_print (struct type *, const gdb_byte *, int,
CORE_ADDR, struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern void pascal_value_print (struct value *, struct ui_file *,
const struct value_print_options *);

View File

@ -42,10 +42,9 @@
/* See val_print for a description of the various parameters of this
function; they are identical. The semantics of the return value is
also identical to val_print. */
function; they are identical. */
int
void
pascal_val_print (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
@ -159,8 +158,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
{
/* Try to print what function it points to. */
print_address_demangle (gdbarch, addr, stream, demangle);
/* Return value is irrelevant except for string pointers. */
return (0);
return;
}
if (options->addressprint && options->format != 's')
@ -248,12 +246,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
}
}
/* 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;
return;
case TYPE_CODE_REF:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
@ -576,7 +569,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
TYPE_CODE (type));
}
gdb_flush (stream);
return (0);
}
void

View File

@ -383,9 +383,9 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
TRY_CATCH (except, RETURN_MASK_ERROR)
{
ret = language->la_val_print (type, valaddr, embedded_offset, address,
stream, recurse, val,
&local_opts);
language->la_val_print (type, valaddr, embedded_offset, address,
stream, recurse, val,
&local_opts);
}
if (except.reason < 0)
fprintf_filtered (stream, _("<error reading variable>"));