From: Tom Tromey Date: Fri, 18 May 2012 15:27:25 +0000 (+0000) Subject: * printcmd.c (print_address_demangle): Add 'opts' argument. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edf0c1b7caed4e2bfb9a84fd9c226c6720da1d97;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9cab34ea646..1eba1065722 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2012-05-18 Tom Tromey + + * 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 * psymtab.c (find_pc_sect_symtab_from_partial): Return the symtab diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index d1fd56d7ad8..4e329733417 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -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, diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 7dd13bbfcec..2e3beeaf324 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -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 diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 62a71363d96..31813563179 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -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; } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index ed94b846688..42b939d4192 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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 (_(""), 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"); } } diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 12a960f09d8..9c5c245d201 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -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; } diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index 9e1c1ff435c..015af3b0aa4 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -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; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index d6373aedd4e..0a32a22b607 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -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, diff --git a/gdb/printcmd.c b/gdb/printcmd.c index fa7629630e6..3bb43bdedde 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -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, " "); diff --git a/gdb/valprint.c b/gdb/valprint.c index 25b62bc14bd..507aeb587b8 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -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); } diff --git a/gdb/valprint.h b/gdb/valprint.h index 56c0c92c01c..817e5cd48de 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -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, diff --git a/gdb/value.h b/gdb/value.h index 055b69eb203..6e5066c3afb 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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);