* printcmd.c (print_address_demangle): Add 'opts' argument.

* p-valprint.c (pascal_val_print): Update.
	* jv-valprint.c (java_val_print): Update.
	* value.h: Update.
	* valprint.c (generic_val_print): Update.
	(print_function_pointer_address): Add 'options' argument.  Remove
	'addressprint' argument.  Update.
	* m2-valprint.c (print_unpacked_pointer): Update.
	* gnu-v3-abi.c (print_one_vtable): Update.
	(gnuv3_print_method_ptr): Update.
	* f-valprint.c (f_val_print): Update.
	* cp-valprint.c (cp_print_value_fields): Update.
	* valprint.h (print_function_pointer_address): Update.
	* c-valprint.c (c_val_print): Update.
This commit is contained in:
Tom Tromey 2012-05-18 15:27:25 +00:00
parent 2a0bfc8d16
commit edf0c1b7ca
12 changed files with 51 additions and 37 deletions

View File

@ -1,3 +1,20 @@
2012-05-18 Tom Tromey <tromey@redhat.com>
* printcmd.c (print_address_demangle): Add 'opts' argument.
* p-valprint.c (pascal_val_print): Update.
* jv-valprint.c (java_val_print): Update.
* value.h: Update.
* valprint.c (generic_val_print): Update.
(print_function_pointer_address): Add 'options' argument. Remove
'addressprint' argument. Update.
* m2-valprint.c (print_unpacked_pointer): Update.
* gnu-v3-abi.c (print_one_vtable): Update.
(gnuv3_print_method_ptr): Update.
* f-valprint.c (f_val_print): Update.
* cp-valprint.c (cp_print_value_fields): Update.
* valprint.h (print_function_pointer_address): Update.
* c-valprint.c (c_val_print): Update.
2012-05-18 Tom Tromey <tromey@redhat.com>
* psymtab.c (find_pc_sect_symtab_from_partial): Return the symtab

View File

@ -248,8 +248,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
break;
}
unresolved_elttype = TYPE_TARGET_TYPE (type);
@ -261,8 +260,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
return;
}
@ -354,8 +352,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
CORE_ADDR addr
= extract_typed_address (valaddr + offset, field_type);
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
}
else
cp_print_value_fields_rtti (type, valaddr,

View File

@ -368,9 +368,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
CORE_ADDR addr;
addr = extract_typed_address (valaddr + i_offset, i_type);
print_function_pointer_address (get_type_arch (type),
addr, stream,
options->addressprint);
print_function_pointer_address (options,
get_type_arch (type),
addr, stream);
}
}
else

View File

@ -316,8 +316,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
return;
}

View File

@ -620,7 +620,12 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
print_longest (stream, 'd', 1, ptr_value);
}
else
print_address_demangle (gdbarch, ptr_value, stream, demangle);
{
struct value_print_options opts;
get_user_print_options (&opts);
print_address_demangle (&opts, gdbarch, ptr_value, stream, demangle);
}
if (adjustment)
{
@ -890,8 +895,7 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
if (ex.reason < 0)
printf_filtered (_("<error: %s>"), ex.message);
else
print_function_pointer_address (gdbarch, addr, gdb_stdout,
opts->addressprint);
print_function_pointer_address (opts, gdbarch, addr, gdb_stdout);
printf_filtered ("\n");
}
}

View File

@ -513,7 +513,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
if (TYPE_CODE (target_type) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_address_demangle (gdbarch, addr, stream, demangle);
print_address_demangle (options, gdbarch, addr, stream, demangle);
return;
}

View File

@ -199,8 +199,7 @@ print_unpacked_pointer (struct type *type,
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
/* Return value is irrelevant except for string pointers. */
return 0;
}

View File

@ -157,7 +157,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* Extract the address, assume that it is unsigned. */
addr = extract_unsigned_integer (valaddr + embedded_offset,
TYPE_LENGTH (type), byte_order);
print_address_demangle (gdbarch, addr, stream, demangle);
print_address_demangle (options, gdbarch, addr, stream, demangle);
break;
}
check_typedef (TYPE_TARGET_TYPE (type));
@ -169,7 +169,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_address_demangle (gdbarch, addr, stream, demangle);
print_address_demangle (options, gdbarch, addr, stream, demangle);
return;
}
@ -292,7 +292,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
/* Extract the address, assume that it is unsigned. */
print_address_demangle
(gdbarch,
(options, gdbarch,
extract_unsigned_integer (valaddr + embedded_offset
+ TYPE_FIELD_BITPOS (type,
VTBL_FNADDR_OFFSET) / 8,

View File

@ -767,17 +767,15 @@ pc_prefix (CORE_ADDR addr)
or not. */
void
print_address_demangle (struct gdbarch *gdbarch, CORE_ADDR addr,
print_address_demangle (const struct value_print_options *opts,
struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream, int do_demangle)
{
struct value_print_options opts;
get_user_print_options (&opts);
if (addr == 0)
{
fprintf_filtered (stream, "0");
}
else if (opts.addressprint)
else if (opts->addressprint)
{
fputs_filtered (paddress (gdbarch, addr), stream);
print_address_symbolic (gdbarch, addr, stream, do_demangle, " ");

View File

@ -384,8 +384,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
print_function_pointer_address (options, gdbarch, addr, stream);
return;
}
@ -515,7 +514,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
type_print (type, "", stream, -1);
fprintf_filtered (stream, "} ");
/* Try to print what function it points to, and its address. */
print_address_demangle (gdbarch, address, stream, demangle);
print_address_demangle (options, gdbarch, address, stream, demangle);
break;
case TYPE_CODE_BOOL:
@ -1501,10 +1500,10 @@ print_char_chars (struct ui_file *stream, struct type *type,
stream STREAM. */
void
print_function_pointer_address (struct gdbarch *gdbarch,
print_function_pointer_address (const struct value_print_options *options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream,
int addressprint)
struct ui_file *stream)
{
CORE_ADDR func_addr
= gdbarch_convert_from_func_ptr_addr (gdbarch, address,
@ -1512,13 +1511,13 @@ print_function_pointer_address (struct gdbarch *gdbarch,
/* If the function pointer is represented by a description, print
the address of the description. */
if (addressprint && func_addr != address)
if (options->addressprint && func_addr != address)
{
fputs_filtered ("@", stream);
fputs_filtered (paddress (gdbarch, address), stream);
fputs_filtered (": ", stream);
}
print_address_demangle (gdbarch, func_addr, stream, demangle);
print_address_demangle (options, gdbarch, func_addr, stream, demangle);
}

View File

@ -148,10 +148,10 @@ extern void print_hex_chars (struct ui_file *, const gdb_byte *,
extern void print_char_chars (struct ui_file *, struct type *,
const gdb_byte *, unsigned int, enum bfd_endian);
extern void print_function_pointer_address (struct gdbarch *gdbarch,
extern void print_function_pointer_address (const struct value_print_options *options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream,
int addressprint);
struct ui_file *stream);
int read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
enum bfd_endian byte_order, gdb_byte **buffer,

View File

@ -491,7 +491,8 @@ extern void read_value_memory (struct value *val, int embedded_offset,
struct frame_info;
struct fn_field;
extern void print_address_demangle (struct gdbarch *, CORE_ADDR,
extern void print_address_demangle (const struct value_print_options *,
struct gdbarch *, CORE_ADDR,
struct ui_file *, int);
extern LONGEST value_as_long (struct value *val);