gdb
* varobj.c (value_get_print_value): Include valprint.h. (value_get_print_value): Use get_formatted_print_options. * value.h (struct value_print_options): Declare. (value_print, val_print, common_val_print, val_print_string): Update. * value.c: Include valprint.h. (show_values): Use get_user_print_options. (show_convenience): Likewise. * valprint.h (prettyprint_arrays, prettyprint_structs): Don't declare. (struct value_print_options): New type. (vtblprint, unionprint, addressprint, objectprint, print_max, inspect_it, repeat_count_threshold, output_format, stop_print_at_null): Don't declare. (user_print_options, get_user_print_options, get_raw_print_options, get_formatted_print_options): Declare. (print_array_indexes_p): Don't declare. (maybe_print_array_index, val_print_array_elements): Update. * valprint.c (print_max): Remove. (user_print_options): New global. (get_user_print_options, get_raw_print_options, get_formatted_print_options): New functions. (print_array_indexes, repeat_count_threshold, stop_print_at_null, prettyprint_structs, prettyprint_arrays, unionprint, addressprint): Remove. (val_print): Remove format, deref_ref, pretty arguments; add options. Update. (common_val_print): Likewise. (print_array_indexes_p): Remove. (maybe_print_array_index): Remove format, pretty arguments; add options. Update. (val_print_array_elements): Remove format, deref_ref, pretty arguments; add options. Update. (val_print_string): Add options argument. Update. (_initialize_valprint): Use user_print_options. (output_format): Remove. (set_output_radix_1): Use user_print_options. * typeprint.c: Include valprint.h. (objectprint): Don't declare. (whatis_exp): Use get_user_print_options. * tui/tui-regs.c: Include valprint.h. (tui_register_format): Use get_formatted_print_options. * tracepoint.c: Include valprint.h. (addressprint): Don't declare. (trace_mention): Use get_user_print_options. (tracepoints_info): Likewise. * stack.c (print_frame_args): Use get_raw_print_options. (print_frame_info): Use get_user_print_options. (print_frame): Likewise. * sh64-tdep.c: Include valprint.h (sh64_do_register): Use get_formatted_print_options. * scm-valprint.c (scm_inferior_print): Remove format, deref_ref, pretty arguments; add options. (scm_scmlist_print): Likewise. Update. (scm_scmval_print): Likewise. (scm_val_print): Likewise. (scm_value_print): Remove format, pretty arguments; add options. Update. * scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print): Update. * scm-lang.c (scm_printstr): Add options argument. * python/python-value.c: Include valprint.h. (valpy_str): Use get_user_print_options. * printcmd.c: Include valprint.h. (addressprint): Don't declare. (inspect_it): Remove. (print_formatted): Remove format option; add options. Update. (print_scalar_formatted): Likewise. (print_address_demangle): Use get_user_print_options. (do_examine): Use get_formatted_print_options. (print_command_1): Likewise. (output_command): Use get_formatted_print_options. (do_one_display): Likewise. (print_variable_value): Use get_user_print_options. * p-valprint.c (pascal_val_print): Remove format, deref_ref, pretty arguments; add options. Update. (pascal_value_print): Remove format, pretty arguments; add options. Update. (vtblprint, objectprint): Don't declare. (pascal_static_field_print): Remove. (pascal_object_print_value_fields): Remove format, pretty arguments; add options. Update. (pascal_object_print_static_field): Likewise. (_initialize_pascal_valprint): Use user_print_options. Update. * p-lang.h (pascal_val_print, pascal_value_print, pascal_printstr, pascal_object_print_value_fields): Update. (vtblprint, static_field_print): Don't declare. * p-lang.c (pascal_printstr): Add options argument. Update. * objc-lang.c (objc_printstr): Add options argument. Update. * mt-tdep.c: Include valprint.h. (mt_registers_info): Use get_raw_print_options. * mips-tdep.c: Include valprint.h. (mips_print_fp_register): Use get_formatted_print_options. (mips_print_register): Likewise. * mi/mi-main.c: Include valprint.h. (get_register): Use get_user_print_options. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Use get_formatted_print_options. * mi/mi-cmd-stack.c: Include valprint.h. (list_args_or_locals): Use get_raw_print_options. * m2-valprint.c (print_function_pointer_address): Add addressprint argument. (m2_print_long_set): Remove format, pretty arguments. (m2_print_unbounded_array): Remove format, deref_ref, pretty arguments; add options. Update. (print_unpacked_pointer): Remove format argument; add options. Now static. Update. (print_variable_at_address): Remove format, deref_ref, pretty arguments; add options. Update. (m2_print_array_contents): Likewise. (m2_val_print): Likewise. * m2-lang.h (m2_val_print): Update. * m2-lang.c (m2_printstr): Add options argument. Update. * language.h (struct value_print_options): Declare. (struct language_defn) <la_printstr>: Add options argument. <la_val_print>: Remove format, deref_ref, pretty argument; add options. <la_value_print>: Remove format, pretty arguments; add options. <la_print_array_index>: Likewise. (LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING, LA_PRINT_ARRAY_INDEX): Update. (default_print_array_index): Update. * language.c (default_print_array_index): Remove format, pretty arguments; add options. Update. (unk_lang_printstr): Add options argument. (unk_lang_val_print): Remove format, deref_ref, pretty arguments; add options. (unk_lang_value_print): Remove format, pretty arguments; add options. * jv-valprint.c (java_value_print): Remove format, pretty arguments; add options. Update. (java_print_value_fields): Likewise. (java_val_print): Remove format, deref_ref, pretty arguments; add options. Update. * jv-lang.h (java_val_print, java_value_print): Declare. * infcmd.c: Include valprint.h. (print_return_value): Use get_raw_print_options. (default_print_registers_info): Use get_user_print_options, get_formatted_print_options. (registers_info): Use get_formatted_print_options. * gdbtypes.h (struct value_print_options): Declare. (print_scalar_formatted): Update. * f-valprint.c (f77_print_array_1): Remove format, deref_ref, pretty arguments; add options. Update. (f77_print_array): Likewise. (f_val_print): Likewise. * f-lang.h (f_val_print): Update. * f-lang.c (f_printstr): Add options argument. Update. (c_value_print): Update declaration. * expprint.c: Include valprint.h. (print_subexp_standard): Use get_raw_print_options, get_user_print_options. * eval.c: Include valprint.h. (objectprint): Don't declare. (evaluate_subexp_standard): Use get_user_print_options. * cp-valprint.c (vtblprint, objectprint, static_field_print): Remove. (cp_print_value_fields): Remove format, pretty arguments; add options. Update. (cp_print_value): Likewise. (cp_print_static_field): Likewise. (_initialize_cp_valprint): Use user_print_options. Update. * c-valprint.c (print_function_pointer_address): Add addressprint argument. (c_val_print): Remove format, deref_ref, pretty arguments; add options. Update. (c_value_print): Add options argument. Update. * c-lang.h (c_val_print, c_value_print, c_printstr): Update. (vtblprint, static_field_print): Don't declare. (cp_print_value_fields): Update. * c-lang.c (c_printstr): Add options argument. Update. * breakpoint.c: Include valprint.h. (addressprint): Don't declare. (watchpoint_value_print): Use get_user_print_options. (print_one_breakpoint_location): Likewise. (breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention, print_exception_catchpoint): Likewise. * auxv.c (fprint_target_auxv): Don't declare addressprint. Use get_user_print_options. * ada-valprint.c (struct ada_val_print_args): Remove format, deref_ref, and pretty; add options. (print_optional_low_bound): Add options argument. (val_print_packed_array_elements): Remove format and pretty arguments; add options. Update. (printstr): Add options argument. Update. (ada_printstr): Likewise. (ada_val_print): Remove format, deref_ref, pretty arguments; add options argument. Update. (ada_val_print_stub): Update. (ada_val_print_array): Remove format, deref_ref, pretty arguments; add options. Update. (ada_val_print_1): Likewise. (print_variant_part): Likewise. (ada_value_print): Remove format, pretty arguments; add options. Update. (print_record): Likewise. (print_field_values): Likewise. * ada-lang.h (ada_val_print, ada_value_print, ada_printstr): Update. * ada-lang.c (ada_print_array_index): Add options argument; remove format and pretty arguments. (print_one_exception): Use get_user_print_options. gdb/testsuite * gdb.base/exprs.exp (test_expr): Add enum formatting tests.
This commit is contained in:
parent
7c8a8b0498
commit
79a45b7d67
49 changed files with 1376 additions and 912 deletions
205
gdb/ChangeLog
205
gdb/ChangeLog
|
@ -1,3 +1,208 @@
|
||||||
|
2008-10-28 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* varobj.c (value_get_print_value): Include valprint.h.
|
||||||
|
(value_get_print_value): Use get_formatted_print_options.
|
||||||
|
* value.h (struct value_print_options): Declare.
|
||||||
|
(value_print, val_print, common_val_print, val_print_string):
|
||||||
|
Update.
|
||||||
|
* value.c: Include valprint.h.
|
||||||
|
(show_values): Use get_user_print_options.
|
||||||
|
(show_convenience): Likewise.
|
||||||
|
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
|
||||||
|
declare.
|
||||||
|
(struct value_print_options): New type.
|
||||||
|
(vtblprint, unionprint, addressprint, objectprint, print_max,
|
||||||
|
inspect_it, repeat_count_threshold, output_format,
|
||||||
|
stop_print_at_null): Don't declare.
|
||||||
|
(user_print_options, get_user_print_options,
|
||||||
|
get_raw_print_options, get_formatted_print_options): Declare.
|
||||||
|
(print_array_indexes_p): Don't declare.
|
||||||
|
(maybe_print_array_index, val_print_array_elements): Update.
|
||||||
|
* valprint.c (print_max): Remove.
|
||||||
|
(user_print_options): New global.
|
||||||
|
(get_user_print_options, get_raw_print_options,
|
||||||
|
get_formatted_print_options): New functions.
|
||||||
|
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
|
||||||
|
prettyprint_structs, prettyprint_arrays, unionprint,
|
||||||
|
addressprint): Remove.
|
||||||
|
(val_print): Remove format, deref_ref, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
(common_val_print): Likewise.
|
||||||
|
(print_array_indexes_p): Remove.
|
||||||
|
(maybe_print_array_index): Remove format, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
(val_print_array_elements): Remove format, deref_ref, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(val_print_string): Add options argument. Update.
|
||||||
|
(_initialize_valprint): Use user_print_options.
|
||||||
|
(output_format): Remove.
|
||||||
|
(set_output_radix_1): Use user_print_options.
|
||||||
|
* typeprint.c: Include valprint.h.
|
||||||
|
(objectprint): Don't declare.
|
||||||
|
(whatis_exp): Use get_user_print_options.
|
||||||
|
* tui/tui-regs.c: Include valprint.h.
|
||||||
|
(tui_register_format): Use get_formatted_print_options.
|
||||||
|
* tracepoint.c: Include valprint.h.
|
||||||
|
(addressprint): Don't declare.
|
||||||
|
(trace_mention): Use get_user_print_options.
|
||||||
|
(tracepoints_info): Likewise.
|
||||||
|
* stack.c (print_frame_args): Use get_raw_print_options.
|
||||||
|
(print_frame_info): Use get_user_print_options.
|
||||||
|
(print_frame): Likewise.
|
||||||
|
* sh64-tdep.c: Include valprint.h
|
||||||
|
(sh64_do_register): Use get_formatted_print_options.
|
||||||
|
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
|
||||||
|
pretty arguments; add options.
|
||||||
|
(scm_scmlist_print): Likewise. Update.
|
||||||
|
(scm_scmval_print): Likewise.
|
||||||
|
(scm_val_print): Likewise.
|
||||||
|
(scm_value_print): Remove format, pretty arguments; add options.
|
||||||
|
Update.
|
||||||
|
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
|
||||||
|
Update.
|
||||||
|
* scm-lang.c (scm_printstr): Add options argument.
|
||||||
|
* python/python-value.c: Include valprint.h.
|
||||||
|
(valpy_str): Use get_user_print_options.
|
||||||
|
* printcmd.c: Include valprint.h.
|
||||||
|
(addressprint): Don't declare.
|
||||||
|
(inspect_it): Remove.
|
||||||
|
(print_formatted): Remove format option; add options. Update.
|
||||||
|
(print_scalar_formatted): Likewise.
|
||||||
|
(print_address_demangle): Use get_user_print_options.
|
||||||
|
(do_examine): Use get_formatted_print_options.
|
||||||
|
(print_command_1): Likewise.
|
||||||
|
(output_command): Use get_formatted_print_options.
|
||||||
|
(do_one_display): Likewise.
|
||||||
|
(print_variable_value): Use get_user_print_options.
|
||||||
|
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
|
||||||
|
pretty arguments; add options. Update.
|
||||||
|
(pascal_value_print): Remove format, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
(vtblprint, objectprint): Don't declare.
|
||||||
|
(pascal_static_field_print): Remove.
|
||||||
|
(pascal_object_print_value_fields): Remove format, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(pascal_object_print_static_field): Likewise.
|
||||||
|
(_initialize_pascal_valprint): Use user_print_options. Update.
|
||||||
|
* p-lang.h (pascal_val_print, pascal_value_print,
|
||||||
|
pascal_printstr, pascal_object_print_value_fields): Update.
|
||||||
|
(vtblprint, static_field_print): Don't declare.
|
||||||
|
* p-lang.c (pascal_printstr): Add options argument. Update.
|
||||||
|
* objc-lang.c (objc_printstr): Add options argument. Update.
|
||||||
|
* mt-tdep.c: Include valprint.h.
|
||||||
|
(mt_registers_info): Use get_raw_print_options.
|
||||||
|
* mips-tdep.c: Include valprint.h.
|
||||||
|
(mips_print_fp_register): Use get_formatted_print_options.
|
||||||
|
(mips_print_register): Likewise.
|
||||||
|
* mi/mi-main.c: Include valprint.h.
|
||||||
|
(get_register): Use get_user_print_options.
|
||||||
|
(mi_cmd_data_evaluate_expression): Likewise.
|
||||||
|
(mi_cmd_data_read_memory): Use get_formatted_print_options.
|
||||||
|
* mi/mi-cmd-stack.c: Include valprint.h.
|
||||||
|
(list_args_or_locals): Use get_raw_print_options.
|
||||||
|
* m2-valprint.c (print_function_pointer_address): Add addressprint
|
||||||
|
argument.
|
||||||
|
(m2_print_long_set): Remove format, pretty arguments.
|
||||||
|
(m2_print_unbounded_array): Remove format, deref_ref, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(print_unpacked_pointer): Remove format argument; add options.
|
||||||
|
Now static. Update.
|
||||||
|
(print_variable_at_address): Remove format, deref_ref, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(m2_print_array_contents): Likewise.
|
||||||
|
(m2_val_print): Likewise.
|
||||||
|
* m2-lang.h (m2_val_print): Update.
|
||||||
|
* m2-lang.c (m2_printstr): Add options argument. Update.
|
||||||
|
* language.h (struct value_print_options): Declare.
|
||||||
|
(struct language_defn) <la_printstr>: Add options argument.
|
||||||
|
<la_val_print>: Remove format, deref_ref, pretty argument; add
|
||||||
|
options.
|
||||||
|
<la_value_print>: Remove format, pretty arguments; add options.
|
||||||
|
<la_print_array_index>: Likewise.
|
||||||
|
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
|
||||||
|
LA_PRINT_ARRAY_INDEX): Update.
|
||||||
|
(default_print_array_index): Update.
|
||||||
|
* language.c (default_print_array_index): Remove format, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(unk_lang_printstr): Add options argument.
|
||||||
|
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
|
||||||
|
add options.
|
||||||
|
(unk_lang_value_print): Remove format, pretty arguments; add
|
||||||
|
options.
|
||||||
|
* jv-valprint.c (java_value_print): Remove format, pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(java_print_value_fields): Likewise.
|
||||||
|
(java_val_print): Remove format, deref_ref, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
* jv-lang.h (java_val_print, java_value_print): Declare.
|
||||||
|
* infcmd.c: Include valprint.h.
|
||||||
|
(print_return_value): Use get_raw_print_options.
|
||||||
|
(default_print_registers_info): Use get_user_print_options,
|
||||||
|
get_formatted_print_options.
|
||||||
|
(registers_info): Use get_formatted_print_options.
|
||||||
|
* gdbtypes.h (struct value_print_options): Declare.
|
||||||
|
(print_scalar_formatted): Update.
|
||||||
|
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
|
||||||
|
pretty arguments; add options. Update.
|
||||||
|
(f77_print_array): Likewise.
|
||||||
|
(f_val_print): Likewise.
|
||||||
|
* f-lang.h (f_val_print): Update.
|
||||||
|
* f-lang.c (f_printstr): Add options argument. Update.
|
||||||
|
(c_value_print): Update declaration.
|
||||||
|
* expprint.c: Include valprint.h.
|
||||||
|
(print_subexp_standard): Use get_raw_print_options,
|
||||||
|
get_user_print_options.
|
||||||
|
* eval.c: Include valprint.h.
|
||||||
|
(objectprint): Don't declare.
|
||||||
|
(evaluate_subexp_standard): Use get_user_print_options.
|
||||||
|
* cp-valprint.c (vtblprint, objectprint, static_field_print):
|
||||||
|
Remove.
|
||||||
|
(cp_print_value_fields): Remove format, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
(cp_print_value): Likewise.
|
||||||
|
(cp_print_static_field): Likewise.
|
||||||
|
(_initialize_cp_valprint): Use user_print_options. Update.
|
||||||
|
* c-valprint.c (print_function_pointer_address): Add addressprint
|
||||||
|
argument.
|
||||||
|
(c_val_print): Remove format, deref_ref, pretty arguments; add
|
||||||
|
options. Update.
|
||||||
|
(c_value_print): Add options argument. Update.
|
||||||
|
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
|
||||||
|
(vtblprint, static_field_print): Don't declare.
|
||||||
|
(cp_print_value_fields): Update.
|
||||||
|
* c-lang.c (c_printstr): Add options argument. Update.
|
||||||
|
* breakpoint.c: Include valprint.h.
|
||||||
|
(addressprint): Don't declare.
|
||||||
|
(watchpoint_value_print): Use get_user_print_options.
|
||||||
|
(print_one_breakpoint_location): Likewise.
|
||||||
|
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
|
||||||
|
print_exception_catchpoint): Likewise.
|
||||||
|
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
|
||||||
|
get_user_print_options.
|
||||||
|
* ada-valprint.c (struct ada_val_print_args): Remove format,
|
||||||
|
deref_ref, and pretty; add options.
|
||||||
|
(print_optional_low_bound): Add options argument.
|
||||||
|
(val_print_packed_array_elements): Remove format and pretty
|
||||||
|
arguments; add options. Update.
|
||||||
|
(printstr): Add options argument. Update.
|
||||||
|
(ada_printstr): Likewise.
|
||||||
|
(ada_val_print): Remove format, deref_ref, pretty arguments; add
|
||||||
|
options argument. Update.
|
||||||
|
(ada_val_print_stub): Update.
|
||||||
|
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
|
||||||
|
add options. Update.
|
||||||
|
(ada_val_print_1): Likewise.
|
||||||
|
(print_variant_part): Likewise.
|
||||||
|
(ada_value_print): Remove format, pretty arguments; add options.
|
||||||
|
Update.
|
||||||
|
(print_record): Likewise.
|
||||||
|
(print_field_values): Likewise.
|
||||||
|
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
|
||||||
|
Update.
|
||||||
|
* ada-lang.c (ada_print_array_index): Add options argument; remove
|
||||||
|
format and pretty arguments.
|
||||||
|
(print_one_exception): Use get_user_print_options.
|
||||||
|
|
||||||
2008-10-28 Tom Tromey <tromey@redhat.com>
|
2008-10-28 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* cli/cli-script.c (do_fclose_cleanup): Remove.
|
* cli/cli-script.c (do_fclose_cleanup): Remove.
|
||||||
|
|
|
@ -353,9 +353,9 @@ ada_get_gdb_completer_word_break_characters (void)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ada_print_array_index (struct value *index_value, struct ui_file *stream,
|
ada_print_array_index (struct value *index_value, struct ui_file *stream,
|
||||||
int format, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
LA_VALUE_PRINT (index_value, stream, format, pretty);
|
LA_VALUE_PRINT (index_value, stream, options);
|
||||||
fprintf_filtered (stream, " => ");
|
fprintf_filtered (stream, " => ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10100,7 +10100,10 @@ static void
|
||||||
print_one_exception (enum exception_catchpoint_kind ex,
|
print_one_exception (enum exception_catchpoint_kind ex,
|
||||||
struct breakpoint *b, CORE_ADDR *last_addr)
|
struct breakpoint *b, CORE_ADDR *last_addr)
|
||||||
{
|
{
|
||||||
if (addressprint)
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
annotate_field (4);
|
annotate_field (4);
|
||||||
ui_out_field_core_addr (uiout, "addr", b->loc->address);
|
ui_out_field_core_addr (uiout, "addr", b->loc->address);
|
||||||
|
|
|
@ -249,11 +249,11 @@ extern void ada_print_type (struct type *, char *, struct ui_file *, int,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int ada_value_print (struct value *, struct ui_file *, int,
|
extern int ada_value_print (struct value *, struct ui_file *,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* Defined in ada-lang.c */
|
/* Defined in ada-lang.c */
|
||||||
|
|
||||||
|
@ -266,7 +266,8 @@ extern void ada_emit_char (int, struct ui_file *, int, int);
|
||||||
extern void ada_printchar (int, struct ui_file *);
|
extern void ada_printchar (int, struct ui_file *);
|
||||||
|
|
||||||
extern void ada_printstr (struct ui_file *, const gdb_byte *,
|
extern void ada_printstr (struct ui_file *, const gdb_byte *,
|
||||||
unsigned int, int, int);
|
unsigned int, int, int,
|
||||||
|
const struct value_print_options *);
|
||||||
|
|
||||||
struct value *ada_convert_actual (struct value *actual,
|
struct value *ada_convert_actual (struct value *actual,
|
||||||
struct type *formal_type0,
|
struct type *formal_type0,
|
||||||
|
|
|
@ -43,18 +43,17 @@ struct ada_val_print_args
|
||||||
int embedded_offset;
|
int embedded_offset;
|
||||||
CORE_ADDR address;
|
CORE_ADDR address;
|
||||||
struct ui_file *stream;
|
struct ui_file *stream;
|
||||||
int format;
|
|
||||||
int deref_ref;
|
|
||||||
int recurse;
|
int recurse;
|
||||||
enum val_prettyprint pretty;
|
const struct value_print_options *options;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void print_record (struct type *, const gdb_byte *, struct ui_file *,
|
static void print_record (struct type *, const gdb_byte *, struct ui_file *,
|
||||||
int, int, enum val_prettyprint);
|
int, const struct value_print_options *);
|
||||||
|
|
||||||
static int print_field_values (struct type *, const gdb_byte *,
|
static int print_field_values (struct type *, const gdb_byte *,
|
||||||
struct ui_file *, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint, int, struct type *,
|
const struct value_print_options *,
|
||||||
|
int, struct type *,
|
||||||
const gdb_byte *);
|
const gdb_byte *);
|
||||||
|
|
||||||
static void adjust_type_signedness (struct type *);
|
static void adjust_type_signedness (struct type *);
|
||||||
|
@ -62,8 +61,8 @@ static void adjust_type_signedness (struct type *);
|
||||||
static int ada_val_print_stub (void *args0);
|
static int ada_val_print_stub (void *args0);
|
||||||
|
|
||||||
static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
|
static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
|
|
||||||
/* Make TYPE unsigned if its range of values includes no negatives. */
|
/* Make TYPE unsigned if its range of values includes no negatives. */
|
||||||
|
@ -81,13 +80,14 @@ adjust_type_signedness (struct type *type)
|
||||||
otherwise 0. */
|
otherwise 0. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
print_optional_low_bound (struct ui_file *stream, struct type *type)
|
print_optional_low_bound (struct ui_file *stream, struct type *type,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *index_type;
|
struct type *index_type;
|
||||||
long low_bound;
|
long low_bound;
|
||||||
long high_bound;
|
long high_bound;
|
||||||
|
|
||||||
if (print_array_indexes_p ())
|
if (options->print_array_indexes)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!get_array_bounds (type, &low_bound, &high_bound))
|
if (!get_array_bounds (type, &low_bound, &high_bound))
|
||||||
|
@ -137,16 +137,15 @@ print_optional_low_bound (struct ui_file *stream, struct type *type)
|
||||||
|
|
||||||
/* Version of val_print_array_elements for GNAT-style packed arrays.
|
/* Version of val_print_array_elements for GNAT-style packed arrays.
|
||||||
Prints elements of packed array of type TYPE at bit offset
|
Prints elements of packed array of type TYPE at bit offset
|
||||||
BITOFFSET from VALADDR on STREAM. Formats according to FORMAT and
|
BITOFFSET from VALADDR on STREAM. Formats according to OPTIONS and
|
||||||
separates with commas. RECURSE is the recursion (nesting) level.
|
separates with commas. RECURSE is the recursion (nesting) level.
|
||||||
If PRETTY, uses "prettier" format. TYPE must have been decoded (as
|
TYPE must have been decoded (as by ada_coerce_to_simple_array). */
|
||||||
by ada_coerce_to_simple_array). */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
int bitoffset, struct ui_file *stream,
|
int bitoffset, struct ui_file *stream,
|
||||||
int format, int recurse,
|
int recurse,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -172,14 +171,14 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
i = 0;
|
i = 0;
|
||||||
annotate_array_section_begin (i, elttype);
|
annotate_array_section_begin (i, elttype);
|
||||||
|
|
||||||
while (i < len && things_printed < print_max)
|
while (i < len && things_printed < options->print_max)
|
||||||
{
|
{
|
||||||
struct value *v0, *v1;
|
struct value *v0, *v1;
|
||||||
int i0;
|
int i0;
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, ",\n");
|
fprintf_filtered (stream, ",\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -190,7 +189,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
maybe_print_array_index (index_type, i + low, stream, format, pretty);
|
maybe_print_array_index (index_type, i + low, stream, options);
|
||||||
|
|
||||||
i0 = i;
|
i0 = i;
|
||||||
v0 = ada_value_primitive_packed_val (NULL, valaddr,
|
v0 = ada_value_primitive_packed_val (NULL, valaddr,
|
||||||
|
@ -210,10 +209,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i - i0 > repeat_count_threshold)
|
if (i - i0 > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
val_print (elttype, value_contents (v0), 0, 0, stream, format,
|
struct value_print_options opts = *options;
|
||||||
0, recurse + 1, pretty, current_language);
|
opts.deref_ref = 0;
|
||||||
|
val_print (elttype, value_contents (v0), 0, 0, stream,
|
||||||
|
recurse + 1, &opts, current_language);
|
||||||
annotate_elt_rep (i - i0);
|
annotate_elt_rep (i - i0);
|
||||||
fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
|
fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
|
||||||
annotate_elt_rep_end ();
|
annotate_elt_rep_end ();
|
||||||
|
@ -222,11 +223,13 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
for (j = i0; j < i; j += 1)
|
for (j = i0; j < i; j += 1)
|
||||||
{
|
{
|
||||||
if (j > i0)
|
if (j > i0)
|
||||||
{
|
{
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, ",\n");
|
fprintf_filtered (stream, ",\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -237,10 +240,10 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
maybe_print_array_index (index_type, j + low,
|
maybe_print_array_index (index_type, j + low,
|
||||||
stream, format, pretty);
|
stream, options);
|
||||||
}
|
}
|
||||||
val_print (elttype, value_contents (v0), 0, 0, stream, format,
|
val_print (elttype, value_contents (v0), 0, 0, stream,
|
||||||
0, recurse + 1, pretty, current_language);
|
recurse + 1, &opts, current_language);
|
||||||
annotate_elt ();
|
annotate_elt ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,7 +455,8 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printstr (struct ui_file *stream, const gdb_byte *string,
|
printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int force_ellipses, int type_len)
|
unsigned int length, int force_ellipses, int type_len,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -465,7 +469,7 @@ printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; i += 1)
|
for (i = 0; i < length && things_printed < options->print_max; i += 1)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining
|
/* Position of the character we are examining
|
||||||
to see whether it is repeated. */
|
to see whether it is repeated. */
|
||||||
|
@ -491,11 +495,11 @@ printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
reps += 1;
|
reps += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\", ", stream);
|
fputs_filtered ("\\\", ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\", ", stream);
|
fputs_filtered ("\", ", stream);
|
||||||
|
@ -507,14 +511,14 @@ printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
fprintf_filtered (stream, _(" <repeats %u times>"), reps);
|
fprintf_filtered (stream, _(" <repeats %u times>"), reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!in_quotes)
|
if (!in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
@ -529,7 +533,7 @@ printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
@ -541,36 +545,28 @@ printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
|
|
||||||
void
|
void
|
||||||
ada_printstr (struct ui_file *stream, const gdb_byte *string,
|
ada_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
printstr (stream, string, length, force_ellipses, width);
|
printstr (stream, string, length, force_ellipses, width, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter as for the printf % codes or 0 for natural format).
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
The data at VALADDR is in target byte order.
|
|
||||||
|
|
||||||
If the data is printed as a string, returns the number of string characters
|
If the data is printed as a string, returns the number of string characters
|
||||||
printed.
|
printed.
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
RECURSE indicates the amount of indentation to supply before
|
RECURSE indicates the amount of indentation to supply before
|
||||||
continuation lines; this amount is roughly twice the value of RECURSE.
|
continuation lines; this amount is roughly twice the value of RECURSE. */
|
||||||
|
|
||||||
When PRETTY is non-zero, prints record fields on separate lines.
|
|
||||||
(For some reason, the current version of gdb instead uses a global
|
|
||||||
variable---prettyprint_arrays--- to causes a similar effect on
|
|
||||||
arrays.) */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ada_val_print (struct type *type, const gdb_byte *valaddr0,
|
ada_val_print (struct type *type, const gdb_byte *valaddr0,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int deref_ref,
|
struct ui_file *stream, int recurse,
|
||||||
int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct ada_val_print_args args;
|
struct ada_val_print_args args;
|
||||||
args.type = type;
|
args.type = type;
|
||||||
|
@ -578,10 +574,8 @@ ada_val_print (struct type *type, const gdb_byte *valaddr0,
|
||||||
args.embedded_offset = embedded_offset;
|
args.embedded_offset = embedded_offset;
|
||||||
args.address = address;
|
args.address = address;
|
||||||
args.stream = stream;
|
args.stream = stream;
|
||||||
args.format = format;
|
|
||||||
args.deref_ref = deref_ref;
|
|
||||||
args.recurse = recurse;
|
args.recurse = recurse;
|
||||||
args.pretty = pretty;
|
args.options = options;
|
||||||
|
|
||||||
return catch_errors (ada_val_print_stub, &args, NULL, RETURN_MASK_ALL);
|
return catch_errors (ada_val_print_stub, &args, NULL, RETURN_MASK_ALL);
|
||||||
}
|
}
|
||||||
|
@ -594,8 +588,7 @@ ada_val_print_stub (void *args0)
|
||||||
struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
|
struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
|
||||||
return ada_val_print_1 (argsp->type, argsp->valaddr0,
|
return ada_val_print_1 (argsp->type, argsp->valaddr0,
|
||||||
argsp->embedded_offset, argsp->address,
|
argsp->embedded_offset, argsp->address,
|
||||||
argsp->stream, argsp->format, argsp->deref_ref,
|
argsp->stream, argsp->recurse, argsp->options);
|
||||||
argsp->recurse, argsp->pretty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming TYPE is a simple array, print the value of this array located
|
/* Assuming TYPE is a simple array, print the value of this array located
|
||||||
|
@ -605,8 +598,8 @@ ada_val_print_stub (void *args0)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ada_val_print_array (struct type *type, const gdb_byte *valaddr,
|
ada_val_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream, int format,
|
CORE_ADDR address, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *elttype = TYPE_TARGET_TYPE (type);
|
struct type *elttype = TYPE_TARGET_TYPE (type);
|
||||||
unsigned int eltlen;
|
unsigned int eltlen;
|
||||||
|
@ -623,40 +616,40 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
len = TYPE_LENGTH (type) / eltlen;
|
len = TYPE_LENGTH (type) / eltlen;
|
||||||
|
|
||||||
/* For an array of chars, print with string syntax. */
|
/* For an array of chars, print with string syntax. */
|
||||||
if (ada_is_string_type (type) && (format == 0 || format == 's'))
|
if (ada_is_string_type (type)
|
||||||
|
&& (options->format == 0 || options->format == 's'))
|
||||||
{
|
{
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
|
||||||
/* If requested, look for the first null char and only print
|
/* If requested, look for the first null char and only print
|
||||||
elements up to it. */
|
elements up to it. */
|
||||||
if (stop_print_at_null)
|
if (options->stop_print_at_null)
|
||||||
{
|
{
|
||||||
int temp_len;
|
int temp_len;
|
||||||
|
|
||||||
/* Look for a NULL char. */
|
/* Look for a NULL char. */
|
||||||
for (temp_len = 0;
|
for (temp_len = 0;
|
||||||
(temp_len < len
|
(temp_len < len
|
||||||
&& temp_len < print_max
|
&& temp_len < options->print_max
|
||||||
&& char_at (valaddr, temp_len, eltlen) != 0);
|
&& char_at (valaddr, temp_len, eltlen) != 0);
|
||||||
temp_len += 1);
|
temp_len += 1);
|
||||||
len = temp_len;
|
len = temp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
printstr (stream, valaddr, len, 0, eltlen);
|
printstr (stream, valaddr, len, 0, eltlen, options);
|
||||||
result = len;
|
result = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "(");
|
fprintf_filtered (stream, "(");
|
||||||
print_optional_low_bound (stream, type);
|
print_optional_low_bound (stream, type, options);
|
||||||
if (TYPE_FIELD_BITSIZE (type, 0) > 0)
|
if (TYPE_FIELD_BITSIZE (type, 0) > 0)
|
||||||
val_print_packed_array_elements (type, valaddr, 0, stream,
|
val_print_packed_array_elements (type, valaddr, 0, stream,
|
||||||
format, recurse, pretty);
|
recurse, options);
|
||||||
else
|
else
|
||||||
val_print_array_elements (type, valaddr, address, stream,
|
val_print_array_elements (type, valaddr, address, stream,
|
||||||
format, deref_ref, recurse,
|
recurse, options, 0);
|
||||||
pretty, 0);
|
|
||||||
fprintf_filtered (stream, ")");
|
fprintf_filtered (stream, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,8 +662,8 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
static int
|
static int
|
||||||
ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
int i;
|
int i;
|
||||||
|
@ -695,8 +688,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
|
retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
|
||||||
VALUE_ADDRESS (val), stream, format,
|
VALUE_ADDRESS (val), stream, recurse, options);
|
||||||
deref_ref, recurse, pretty);
|
|
||||||
value_free_to_mark (mark);
|
value_free_to_mark (mark);
|
||||||
return retn;
|
return retn;
|
||||||
}
|
}
|
||||||
|
@ -709,12 +701,12 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return c_val_print (type, valaddr0, embedded_offset, address, stream,
|
return c_val_print (type, valaddr0, embedded_offset, address, stream,
|
||||||
format, deref_ref, recurse, pretty);
|
recurse, options);
|
||||||
|
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
{
|
{
|
||||||
int ret = c_val_print (type, valaddr0, embedded_offset, address,
|
int ret = c_val_print (type, valaddr0, embedded_offset, address,
|
||||||
stream, format, deref_ref, recurse, pretty);
|
stream, recurse, options);
|
||||||
if (ada_is_tag_type (type))
|
if (ada_is_tag_type (type))
|
||||||
{
|
{
|
||||||
struct value *val =
|
struct value *val =
|
||||||
|
@ -778,20 +770,22 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
value_from_contents_and_address
|
value_from_contents_and_address
|
||||||
(type, valaddr, 0));
|
(type, valaddr, 0));
|
||||||
return ada_val_print_1 (target_type, value_contents (v), 0, 0,
|
return ada_val_print_1 (target_type, value_contents (v), 0, 0,
|
||||||
stream, format, 0, recurse + 1, pretty);
|
stream, recurse + 1, options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return ada_val_print_1 (TYPE_TARGET_TYPE (type),
|
return ada_val_print_1 (TYPE_TARGET_TYPE (type),
|
||||||
valaddr0, embedded_offset,
|
valaddr0, embedded_offset,
|
||||||
address, stream, format, deref_ref,
|
address, stream, recurse, options);
|
||||||
recurse, pretty);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
format = format ? format : output_format;
|
int format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
if (format)
|
if (format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = format;
|
||||||
|
print_scalar_formatted (valaddr, type, &opts, 0, stream);
|
||||||
}
|
}
|
||||||
else if (ada_is_system_address_type (type)
|
else if (ada_is_system_address_type (type)
|
||||||
&& TYPE_OBJFILE (type) != NULL)
|
&& TYPE_OBJFILE (type) != NULL)
|
||||||
|
@ -830,9 +824,9 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = TYPE_NFIELDS (type);
|
len = TYPE_NFIELDS (type);
|
||||||
|
@ -860,16 +854,16 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLAGS:
|
case TYPE_CODE_FLAGS:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
else
|
else
|
||||||
val_print_type_code_flags (type, valaddr, stream);
|
val_print_type_code_flags (type, valaddr, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLT:
|
case TYPE_CODE_FLT:
|
||||||
if (format)
|
if (options->format)
|
||||||
return c_val_print (type, valaddr0, embedded_offset, address, stream,
|
return c_val_print (type, valaddr0, embedded_offset, address, stream,
|
||||||
format, deref_ref, recurse, pretty);
|
recurse, options);
|
||||||
else
|
else
|
||||||
ada_print_floating (valaddr0 + embedded_offset, type, stream);
|
ada_print_floating (valaddr0 + embedded_offset, type, stream);
|
||||||
break;
|
break;
|
||||||
|
@ -883,13 +877,13 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_record (type, valaddr, stream, format, recurse, pretty);
|
print_record (type, valaddr, stream, recurse, options);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_CODE_ARRAY:
|
case TYPE_CODE_ARRAY:
|
||||||
return ada_val_print_array (type, valaddr, address, stream, format,
|
return ada_val_print_array (type, valaddr, address, stream,
|
||||||
deref_ref, recurse, pretty);
|
recurse, options);
|
||||||
|
|
||||||
case TYPE_CODE_REF:
|
case TYPE_CODE_REF:
|
||||||
/* For references, the debugger is expected to print the value as
|
/* For references, the debugger is expected to print the value as
|
||||||
|
@ -910,8 +904,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
deref_val_int));
|
deref_val_int));
|
||||||
val_print (value_type (deref_val),
|
val_print (value_type (deref_val),
|
||||||
value_contents (deref_val), 0,
|
value_contents (deref_val), 0,
|
||||||
VALUE_ADDRESS (deref_val), stream, format,
|
VALUE_ADDRESS (deref_val), stream, recurse + 1,
|
||||||
deref_ref, recurse + 1, pretty, current_language);
|
options, current_language);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("(null)", stream);
|
fputs_filtered ("(null)", stream);
|
||||||
|
@ -927,8 +921,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
|
print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
|
||||||
struct ui_file *stream, int format, int recurse,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty, int comma_needed,
|
const struct value_print_options *options, int comma_needed,
|
||||||
struct type *outer_type, const gdb_byte *outer_valaddr)
|
struct type *outer_type, const gdb_byte *outer_valaddr)
|
||||||
{
|
{
|
||||||
struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
|
struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
|
||||||
|
@ -941,13 +935,13 @@ print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
|
||||||
(TYPE_FIELD_TYPE (var_type, which),
|
(TYPE_FIELD_TYPE (var_type, which),
|
||||||
valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT
|
valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT
|
||||||
+ TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT,
|
+ TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT,
|
||||||
stream, format, recurse, pretty,
|
stream, recurse, options,
|
||||||
comma_needed, outer_type, outer_valaddr);
|
comma_needed, outer_type, outer_valaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ada_value_print (struct value *val0, struct ui_file *stream, int format,
|
ada_value_print (struct value *val0, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
const gdb_byte *valaddr = value_contents (val0);
|
const gdb_byte *valaddr = value_contents (val0);
|
||||||
CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
|
CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
|
||||||
|
@ -955,6 +949,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format,
|
||||||
ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1);
|
ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1);
|
||||||
struct value *val =
|
struct value *val =
|
||||||
value_from_contents_and_address (type, valaddr, address);
|
value_from_contents_and_address (type, valaddr, address);
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* If it is a pointer, indicate what it points to. */
|
/* If it is a pointer, indicate what it points to. */
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||||
|
@ -984,21 +979,23 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts = *options;
|
||||||
|
opts.deref_ref = 1;
|
||||||
return (val_print (type, value_contents (val), 0, address,
|
return (val_print (type, value_contents (val), 0, address,
|
||||||
stream, format, 1, 0, pretty, current_language));
|
stream, 0, &opts, current_language));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_record (struct type *type, const gdb_byte *valaddr,
|
print_record (struct type *type, const gdb_byte *valaddr,
|
||||||
struct ui_file *stream, int format, int recurse,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
type = ada_check_typedef (type);
|
type = ada_check_typedef (type);
|
||||||
|
|
||||||
fprintf_filtered (stream, "(");
|
fprintf_filtered (stream, "(");
|
||||||
|
|
||||||
if (print_field_values (type, valaddr, stream, format, recurse, pretty,
|
if (print_field_values (type, valaddr, stream, recurse, options,
|
||||||
0, type, valaddr) != 0 && pretty)
|
0, type, valaddr) != 0 && options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -1009,7 +1006,7 @@ print_record (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
/* Print out fields of value at VALADDR having structure type TYPE.
|
/* Print out fields of value at VALADDR having structure type TYPE.
|
||||||
|
|
||||||
TYPE, VALADDR, STREAM, FORMAT, RECURSE, and PRETTY have the
|
TYPE, VALADDR, STREAM, RECURSE, and OPTIONS have the
|
||||||
same meanings as in ada_print_value and ada_val_print.
|
same meanings as in ada_print_value and ada_val_print.
|
||||||
|
|
||||||
OUTER_TYPE and OUTER_VALADDR give type and address of enclosing record
|
OUTER_TYPE and OUTER_VALADDR give type and address of enclosing record
|
||||||
|
@ -1023,8 +1020,9 @@ print_record (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
print_field_values (struct type *type, const gdb_byte *valaddr,
|
print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
struct ui_file *stream, int format, int recurse,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty, int comma_needed,
|
const struct value_print_options *options,
|
||||||
|
int comma_needed,
|
||||||
struct type *outer_type, const gdb_byte *outer_valaddr)
|
struct type *outer_type, const gdb_byte *outer_valaddr)
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
|
@ -1042,7 +1040,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
print_field_values (TYPE_FIELD_TYPE (type, i),
|
print_field_values (TYPE_FIELD_TYPE (type, i),
|
||||||
valaddr
|
valaddr
|
||||||
+ TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
|
+ TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
|
||||||
stream, format, recurse, pretty,
|
stream, recurse, options,
|
||||||
comma_needed, type, valaddr);
|
comma_needed, type, valaddr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1050,7 +1048,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
{
|
{
|
||||||
comma_needed =
|
comma_needed =
|
||||||
print_variant_part (type, i, valaddr,
|
print_variant_part (type, i, valaddr,
|
||||||
stream, format, recurse, pretty, comma_needed,
|
stream, recurse, options, comma_needed,
|
||||||
outer_type, outer_valaddr);
|
outer_type, outer_valaddr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1057,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
comma_needed = 1;
|
comma_needed = 1;
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -1068,7 +1066,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
{
|
{
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
}
|
}
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
||||||
fputs_filtered ("\"( ptr \"", stream);
|
fputs_filtered ("\"( ptr \"", stream);
|
||||||
|
@ -1107,6 +1105,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
{
|
{
|
||||||
int bit_pos = TYPE_FIELD_BITPOS (type, i);
|
int bit_pos = TYPE_FIELD_BITPOS (type, i);
|
||||||
int bit_size = TYPE_FIELD_BITSIZE (type, i);
|
int bit_size = TYPE_FIELD_BITSIZE (type, i);
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
adjust_type_signedness (TYPE_FIELD_TYPE (type, i));
|
adjust_type_signedness (TYPE_FIELD_TYPE (type, i));
|
||||||
v = ada_value_primitive_packed_val (NULL, valaddr,
|
v = ada_value_primitive_packed_val (NULL, valaddr,
|
||||||
|
@ -1114,15 +1113,20 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
|
||||||
bit_pos % HOST_CHAR_BIT,
|
bit_pos % HOST_CHAR_BIT,
|
||||||
bit_size,
|
bit_size,
|
||||||
TYPE_FIELD_TYPE (type, i));
|
TYPE_FIELD_TYPE (type, i));
|
||||||
|
opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
|
val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
|
||||||
stream, format, 0, recurse + 1, pretty,
|
stream, recurse + 1, &opts, current_language);
|
||||||
current_language);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ada_val_print (TYPE_FIELD_TYPE (type, i),
|
{
|
||||||
valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
|
struct value_print_options opts = *options;
|
||||||
0, 0, stream, format, 0, recurse + 1, pretty);
|
opts.deref_ref = 0;
|
||||||
|
ada_val_print (TYPE_FIELD_TYPE (type, i),
|
||||||
|
valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
|
||||||
|
0, 0, stream, recurse + 1, &opts);
|
||||||
|
}
|
||||||
annotate_field_end ();
|
annotate_field_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
gdb/auxv.c
13
gdb/auxv.c
|
@ -172,7 +172,6 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
|
||||||
|
|
||||||
while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
|
while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
|
||||||
{
|
{
|
||||||
extern int addressprint;
|
|
||||||
const char *name = "???";
|
const char *name = "???";
|
||||||
const char *description = "";
|
const char *description = "";
|
||||||
enum { dec, hex, str } flavor = hex;
|
enum { dec, hex, str } flavor = hex;
|
||||||
|
@ -240,10 +239,14 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
|
||||||
fprintf_filtered (file, "0x%s\n", paddr_nz (val));
|
fprintf_filtered (file, "0x%s\n", paddr_nz (val));
|
||||||
break;
|
break;
|
||||||
case str:
|
case str:
|
||||||
if (addressprint)
|
{
|
||||||
fprintf_filtered (file, "0x%s", paddr_nz (val));
|
struct value_print_options opts;
|
||||||
val_print_string (val, -1, 1, file);
|
get_user_print_options (&opts);
|
||||||
fprintf_filtered (file, "\n");
|
if (opts.addressprint)
|
||||||
|
fprintf_filtered (file, "0x%s", paddr_nz (val));
|
||||||
|
val_print_string (val, -1, 1, file, &opts);
|
||||||
|
fprintf_filtered (file, "\n");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++ents;
|
++ents;
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "ada-lang.h"
|
#include "ada-lang.h"
|
||||||
#include "top.h"
|
#include "top.h"
|
||||||
#include "wrapper.h"
|
#include "wrapper.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "mi/mi-common.h"
|
#include "mi/mi-common.h"
|
||||||
|
|
||||||
|
@ -283,8 +284,6 @@ breakpoints_always_inserted_mode (void)
|
||||||
|
|
||||||
void _initialize_breakpoint (void);
|
void _initialize_breakpoint (void);
|
||||||
|
|
||||||
extern int addressprint; /* Print machine addresses? */
|
|
||||||
|
|
||||||
/* Are we executing breakpoint commands? */
|
/* Are we executing breakpoint commands? */
|
||||||
static int executing_breakpoint_commands;
|
static int executing_breakpoint_commands;
|
||||||
|
|
||||||
|
@ -2259,7 +2258,11 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
fprintf_unfiltered (stream, _("<unreadable>"));
|
fprintf_unfiltered (stream, _("<unreadable>"));
|
||||||
else
|
else
|
||||||
value_print (val, stream, 0, Val_pretty_default);
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
value_print (val, stream, &opts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the normal print function for a bpstat. In the future,
|
/* This is the normal print function for a bpstat. In the future,
|
||||||
|
@ -3577,6 +3580,9 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
|
|
||||||
int header_of_multiple = 0;
|
int header_of_multiple = 0;
|
||||||
int part_of_multiple = (loc != NULL);
|
int part_of_multiple = (loc != NULL);
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
|
||||||
gdb_assert (!loc || loc_number != 0);
|
gdb_assert (!loc || loc_number != 0);
|
||||||
/* See comment in print_one_breakpoint concerning
|
/* See comment in print_one_breakpoint concerning
|
||||||
|
@ -3640,7 +3646,7 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
|
|
||||||
/* 5 and 6 */
|
/* 5 and 6 */
|
||||||
strcpy (wrap_indent, " ");
|
strcpy (wrap_indent, " ");
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
||||||
strcat (wrap_indent, " ");
|
strcat (wrap_indent, " ");
|
||||||
|
@ -3672,7 +3678,7 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
/* Field 4, the address, is omitted (which makes the columns
|
/* Field 4, the address, is omitted (which makes the columns
|
||||||
not line up too nicely with the headers, but the effect
|
not line up too nicely with the headers, but the effect
|
||||||
is relatively readable). */
|
is relatively readable). */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
ui_out_field_skip (uiout, "addr");
|
ui_out_field_skip (uiout, "addr");
|
||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
print_expression (b->exp, stb->stream);
|
print_expression (b->exp, stb->stream);
|
||||||
|
@ -3684,7 +3690,7 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
/* Field 4, the address, is omitted (which makes the columns
|
/* Field 4, the address, is omitted (which makes the columns
|
||||||
not line up too nicely with the headers, but the effect
|
not line up too nicely with the headers, but the effect
|
||||||
is relatively readable). */
|
is relatively readable). */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
ui_out_field_skip (uiout, "addr");
|
ui_out_field_skip (uiout, "addr");
|
||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
if (b->dll_pathname == NULL)
|
if (b->dll_pathname == NULL)
|
||||||
|
@ -3704,7 +3710,7 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
/* Field 4, the address, is omitted (which makes the columns
|
/* Field 4, the address, is omitted (which makes the columns
|
||||||
not line up too nicely with the headers, but the effect
|
not line up too nicely with the headers, but the effect
|
||||||
is relatively readable). */
|
is relatively readable). */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
ui_out_field_skip (uiout, "addr");
|
ui_out_field_skip (uiout, "addr");
|
||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
if (b->exec_pathname != NULL)
|
if (b->exec_pathname != NULL)
|
||||||
|
@ -3727,7 +3733,7 @@ print_one_breakpoint_location (struct breakpoint *b,
|
||||||
case bp_shlib_event:
|
case bp_shlib_event:
|
||||||
case bp_thread_event:
|
case bp_thread_event:
|
||||||
case bp_overlay_event:
|
case bp_overlay_event:
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
annotate_field (4);
|
annotate_field (4);
|
||||||
if (header_of_multiple)
|
if (header_of_multiple)
|
||||||
|
@ -3933,7 +3939,10 @@ breakpoint_1 (int bnum, int allflag)
|
||||||
CORE_ADDR last_addr = (CORE_ADDR) -1;
|
CORE_ADDR last_addr = (CORE_ADDR) -1;
|
||||||
int nr_printable_breakpoints;
|
int nr_printable_breakpoints;
|
||||||
struct cleanup *bkpttbl_chain;
|
struct cleanup *bkpttbl_chain;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
|
||||||
/* Compute the number of rows in the table. */
|
/* Compute the number of rows in the table. */
|
||||||
nr_printable_breakpoints = 0;
|
nr_printable_breakpoints = 0;
|
||||||
ALL_BREAKPOINTS (b)
|
ALL_BREAKPOINTS (b)
|
||||||
|
@ -3944,7 +3953,7 @@ breakpoint_1 (int bnum, int allflag)
|
||||||
nr_printable_breakpoints++;
|
nr_printable_breakpoints++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
bkpttbl_chain
|
bkpttbl_chain
|
||||||
= make_cleanup_ui_out_table_begin_end (uiout, 6, nr_printable_breakpoints,
|
= make_cleanup_ui_out_table_begin_end (uiout, 6, nr_printable_breakpoints,
|
||||||
"BreakpointTable");
|
"BreakpointTable");
|
||||||
|
@ -3967,7 +3976,7 @@ breakpoint_1 (int bnum, int allflag)
|
||||||
if (nr_printable_breakpoints > 0)
|
if (nr_printable_breakpoints > 0)
|
||||||
annotate_field (3);
|
annotate_field (3);
|
||||||
ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */
|
ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
if (nr_printable_breakpoints > 0)
|
if (nr_printable_breakpoints > 0)
|
||||||
annotate_field (4);
|
annotate_field (4);
|
||||||
|
@ -4760,10 +4769,14 @@ print_it_catch_fork (struct breakpoint *b)
|
||||||
static void
|
static void
|
||||||
print_one_catch_fork (struct breakpoint *b, CORE_ADDR *last_addr)
|
print_one_catch_fork (struct breakpoint *b, CORE_ADDR *last_addr)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
|
||||||
/* Field 4, the address, is omitted (which makes the columns
|
/* Field 4, the address, is omitted (which makes the columns
|
||||||
not line up too nicely with the headers, but the effect
|
not line up too nicely with the headers, but the effect
|
||||||
is relatively readable). */
|
is relatively readable). */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
ui_out_field_skip (uiout, "addr");
|
ui_out_field_skip (uiout, "addr");
|
||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
ui_out_text (uiout, "fork");
|
ui_out_text (uiout, "fork");
|
||||||
|
@ -4838,10 +4851,13 @@ print_it_catch_vfork (struct breakpoint *b)
|
||||||
static void
|
static void
|
||||||
print_one_catch_vfork (struct breakpoint *b, CORE_ADDR *last_addr)
|
print_one_catch_vfork (struct breakpoint *b, CORE_ADDR *last_addr)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
/* Field 4, the address, is omitted (which makes the columns
|
/* Field 4, the address, is omitted (which makes the columns
|
||||||
not line up too nicely with the headers, but the effect
|
not line up too nicely with the headers, but the effect
|
||||||
is relatively readable). */
|
is relatively readable). */
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
ui_out_field_skip (uiout, "addr");
|
ui_out_field_skip (uiout, "addr");
|
||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
ui_out_text (uiout, "vfork");
|
ui_out_text (uiout, "vfork");
|
||||||
|
@ -5072,6 +5088,9 @@ mention (struct breakpoint *b)
|
||||||
int say_where = 0;
|
int say_where = 0;
|
||||||
struct cleanup *old_chain, *ui_out_chain;
|
struct cleanup *old_chain, *ui_out_chain;
|
||||||
struct ui_stream *stb;
|
struct ui_stream *stb;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
|
||||||
stb = ui_out_stream_new (uiout);
|
stb = ui_out_stream_new (uiout);
|
||||||
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
||||||
|
@ -5184,7 +5203,7 @@ mention (struct breakpoint *b)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (addressprint || b->source_file == NULL)
|
if (opts.addressprint || b->source_file == NULL)
|
||||||
{
|
{
|
||||||
printf_filtered (" at ");
|
printf_filtered (" at ");
|
||||||
fputs_filtered (paddress (b->loc->address), gdb_stdout);
|
fputs_filtered (paddress (b->loc->address), gdb_stdout);
|
||||||
|
@ -6746,7 +6765,9 @@ print_exception_catchpoint (struct breakpoint *b)
|
||||||
static void
|
static void
|
||||||
print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr)
|
print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr)
|
||||||
{
|
{
|
||||||
if (addressprint)
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
annotate_field (4);
|
annotate_field (4);
|
||||||
if (b->loc == NULL || b->loc->shlib_disabled)
|
if (b->loc == NULL || b->loc->shlib_disabled)
|
||||||
|
|
15
gdb/c-lang.c
15
gdb/c-lang.c
|
@ -86,7 +86,8 @@ c_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
void
|
void
|
||||||
c_printstr (struct ui_file *stream, const gdb_byte *string,
|
c_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -108,7 +109,7 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; ++i)
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining
|
/* Position of the character we are examining
|
||||||
to see whether it is repeated. */
|
to see whether it is repeated. */
|
||||||
|
@ -137,11 +138,11 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
++reps;
|
++reps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\", ", stream);
|
fputs_filtered ("\\\", ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\", ", stream);
|
fputs_filtered ("\", ", stream);
|
||||||
|
@ -150,14 +151,14 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
LA_PRINT_CHAR (current_char, stream);
|
LA_PRINT_CHAR (current_char, stream);
|
||||||
fprintf_filtered (stream, _(" <repeats %u times>"), reps);
|
fprintf_filtered (stream, _(" <repeats %u times>"), reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!in_quotes)
|
if (!in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
@ -171,7 +172,7 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
|
17
gdb/c-lang.h
17
gdb/c-lang.h
|
@ -40,11 +40,11 @@ extern void c_print_type (struct type *, char *, struct ui_file *, int,
|
||||||
extern void c_print_typedef (struct type *, struct symbol *, struct ui_file *);
|
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,
|
extern int c_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int c_value_print (struct value *, struct ui_file *, int,
|
extern int c_value_print (struct value *, struct ui_file *,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* These are in c-lang.c: */
|
/* These are in c-lang.c: */
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ extern void c_printchar (int, struct ui_file *);
|
||||||
|
|
||||||
extern void c_printstr (struct ui_file * stream, const gdb_byte *string,
|
extern void c_printstr (struct ui_file * stream, const gdb_byte *string,
|
||||||
unsigned int length, int width,
|
unsigned int length, int width,
|
||||||
int force_ellipses);
|
int force_ellipses,
|
||||||
|
const struct value_print_options *options);
|
||||||
|
|
||||||
extern void scan_macro_expansion (char *expansion);
|
extern void scan_macro_expansion (char *expansion);
|
||||||
extern int scanning_macro_expansion (void);
|
extern int scanning_macro_expansion (void);
|
||||||
|
@ -70,17 +71,13 @@ extern void c_type_print_base (struct type *, struct ui_file *, int, int);
|
||||||
|
|
||||||
/* These are in cp-valprint.c */
|
/* These are in cp-valprint.c */
|
||||||
|
|
||||||
extern int vtblprint; /* Controls printing of vtbl's */
|
|
||||||
|
|
||||||
extern int static_field_print;
|
|
||||||
|
|
||||||
extern void cp_print_class_member (const gdb_byte *, struct type *,
|
extern void cp_print_class_member (const gdb_byte *, struct type *,
|
||||||
struct ui_file *, char *);
|
struct ui_file *, char *);
|
||||||
|
|
||||||
extern void cp_print_value_fields (struct type *, struct type *,
|
extern void cp_print_value_fields (struct type *, struct type *,
|
||||||
const gdb_byte *, int, CORE_ADDR,
|
const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int,
|
struct ui_file *, int,
|
||||||
int, enum val_prettyprint,
|
const struct value_print_options *,
|
||||||
struct type **, int);
|
struct type **, int);
|
||||||
|
|
||||||
extern int cp_is_vtbl_ptr_type (struct type *);
|
extern int cp_is_vtbl_ptr_type (struct type *);
|
||||||
|
|
167
gdb/c-valprint.c
167
gdb/c-valprint.c
|
@ -36,7 +36,8 @@
|
||||||
stream STREAM. */
|
stream STREAM. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
|
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
|
||||||
|
int addressprint)
|
||||||
{
|
{
|
||||||
CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
|
CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
|
||||||
address,
|
address,
|
||||||
|
@ -102,21 +103,15 @@ textual_element_type (struct type *type, char format)
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
target byte order.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed. */
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
CORE_ADDR address, struct ui_file *stream, int format,
|
CORE_ADDR address, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i = 0; /* Number of characters printed */
|
unsigned int i = 0; /* Number of characters printed */
|
||||||
unsigned len;
|
unsigned len;
|
||||||
|
@ -134,29 +129,29 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
{
|
{
|
||||||
eltlen = TYPE_LENGTH (elttype);
|
eltlen = TYPE_LENGTH (elttype);
|
||||||
len = TYPE_LENGTH (type) / eltlen;
|
len = TYPE_LENGTH (type) / eltlen;
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
{
|
{
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print arrays of textual chars with a string syntax. */
|
/* Print arrays of textual chars with a string syntax. */
|
||||||
if (textual_element_type (elttype, format))
|
if (textual_element_type (elttype, options->format))
|
||||||
{
|
{
|
||||||
/* If requested, look for the first null char and only print
|
/* If requested, look for the first null char and only print
|
||||||
elements up to it. */
|
elements up to it. */
|
||||||
if (stop_print_at_null)
|
if (options->stop_print_at_null)
|
||||||
{
|
{
|
||||||
unsigned int temp_len;
|
unsigned int temp_len;
|
||||||
|
|
||||||
/* Look for a NULL char. */
|
/* Look for a NULL char. */
|
||||||
for (temp_len = 0;
|
for (temp_len = 0;
|
||||||
(valaddr + embedded_offset)[temp_len]
|
(valaddr + embedded_offset)[temp_len]
|
||||||
&& temp_len < len && temp_len < print_max;
|
&& temp_len < len && temp_len < options->print_max;
|
||||||
temp_len++);
|
temp_len++);
|
||||||
len = temp_len;
|
len = temp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0);
|
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0, options);
|
||||||
i = len;
|
i = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -174,7 +169,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
||||||
format, deref_ref, recurse, pretty, i);
|
recurse, options, i);
|
||||||
fprintf_filtered (stream, "}");
|
fprintf_filtered (stream, "}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -184,9 +179,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
goto print_unpacked_pointer;
|
goto print_unpacked_pointer;
|
||||||
|
|
||||||
case TYPE_CODE_MEMBERPTR:
|
case TYPE_CODE_MEMBERPTR:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cp_print_class_member (valaddr + embedded_offset, type, stream, "&");
|
cp_print_class_member (valaddr + embedded_offset, type, stream, "&");
|
||||||
|
@ -197,19 +193,20 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
if (format && format != 's')
|
if (options->format && options->format != 's')
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (vtblprint && cp_is_vtbl_ptr_type (type))
|
if (options->vtblprint && cp_is_vtbl_ptr_type (type))
|
||||||
{
|
{
|
||||||
/* Print the unmangled name if desired. */
|
/* Print the unmangled name if desired. */
|
||||||
/* Print vtable entry - we only get here if we ARE using
|
/* Print vtable entry - we only get here if we ARE using
|
||||||
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
|
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= extract_typed_address (valaddr + embedded_offset, type);
|
= extract_typed_address (valaddr + embedded_offset, type);
|
||||||
print_function_pointer_address (addr, stream);
|
print_function_pointer_address (addr, stream, options->addressprint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
|
@ -220,21 +217,24 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
||||||
{
|
{
|
||||||
/* Try to print what function it points to. */
|
/* Try to print what function it points to. */
|
||||||
print_function_pointer_address (addr, stream);
|
print_function_pointer_address (addr, stream,
|
||||||
|
options->addressprint);
|
||||||
/* Return value is irrelevant except for string pointers. */
|
/* Return value is irrelevant except for string pointers. */
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
|
|
||||||
/* For a pointer to a textual type, also print the string
|
/* For a pointer to a textual type, also print the string
|
||||||
pointed to, unless pointer is null. */
|
pointed to, unless pointer is null. */
|
||||||
/* FIXME: need to handle wchar_t here... */
|
/* FIXME: need to handle wchar_t here... */
|
||||||
|
|
||||||
if (textual_element_type (elttype, format) && addr != 0)
|
if (textual_element_type (elttype, options->format)
|
||||||
|
&& addr != 0)
|
||||||
{
|
{
|
||||||
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
|
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,
|
||||||
|
options);
|
||||||
}
|
}
|
||||||
else if (cp_is_vtbl_member (type))
|
else if (cp_is_vtbl_member (type))
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
|
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
|
||||||
fputs_filtered (">", stream);
|
fputs_filtered (">", stream);
|
||||||
}
|
}
|
||||||
if (vt_address && vtblprint)
|
if (vt_address && options->vtblprint)
|
||||||
{
|
{
|
||||||
struct value *vt_val;
|
struct value *vt_val;
|
||||||
struct symbol *wsym = (struct symbol *) NULL;
|
struct symbol *wsym = (struct symbol *) NULL;
|
||||||
|
@ -271,10 +271,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
wtype = TYPE_TARGET_TYPE (type);
|
wtype = TYPE_TARGET_TYPE (type);
|
||||||
}
|
}
|
||||||
vt_val = value_at (wtype, vt_address);
|
vt_val = value_at (wtype, vt_address);
|
||||||
common_val_print (vt_val, stream, format,
|
common_val_print (vt_val, stream, recurse + 1, options,
|
||||||
deref_ref, recurse + 1, pretty,
|
|
||||||
current_language);
|
current_language);
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -291,17 +290,17 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
|
|
||||||
case TYPE_CODE_REF:
|
case TYPE_CODE_REF:
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= extract_typed_address (valaddr + embedded_offset, type);
|
= extract_typed_address (valaddr + embedded_offset, type);
|
||||||
fprintf_filtered (stream, "@");
|
fprintf_filtered (stream, "@");
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
fputs_filtered (": ", stream);
|
fputs_filtered (": ", stream);
|
||||||
}
|
}
|
||||||
/* De-reference the reference. */
|
/* De-reference the reference. */
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
||||||
{
|
{
|
||||||
|
@ -309,8 +308,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
value_at
|
value_at
|
||||||
(TYPE_TARGET_TYPE (type),
|
(TYPE_TARGET_TYPE (type),
|
||||||
unpack_pointer (type, valaddr + embedded_offset));
|
unpack_pointer (type, valaddr + embedded_offset));
|
||||||
common_val_print (deref_val, stream, format, deref_ref,
|
common_val_print (deref_val, stream, recurse, options,
|
||||||
recurse, pretty, current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("???", stream);
|
fputs_filtered ("???", stream);
|
||||||
|
@ -318,7 +317,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_UNION:
|
case TYPE_CODE_UNION:
|
||||||
if (recurse && !unionprint)
|
if (recurse && !options->unionprint)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "{...}");
|
fprintf_filtered (stream, "{...}");
|
||||||
break;
|
break;
|
||||||
|
@ -326,7 +325,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
/*FIXME: Abstract this away */
|
/*FIXME: Abstract this away */
|
||||||
if (vtblprint && cp_is_vtbl_ptr_type (type))
|
if (options->vtblprint && cp_is_vtbl_ptr_type (type))
|
||||||
{
|
{
|
||||||
/* Print the unmangled name if desired. */
|
/* Print the unmangled name if desired. */
|
||||||
/* Print vtable entry - we only get here if NOT using
|
/* Print vtable entry - we only get here if NOT using
|
||||||
|
@ -337,17 +336,18 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= extract_typed_address (valaddr + offset, field_type);
|
= extract_typed_address (valaddr + offset, field_type);
|
||||||
|
|
||||||
print_function_pointer_address (addr, stream);
|
print_function_pointer_address (addr, stream, options->addressprint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
|
cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream,
|
||||||
recurse, pretty, NULL, 0);
|
recurse, options, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = TYPE_NFIELDS (type);
|
len = TYPE_NFIELDS (type);
|
||||||
|
@ -371,17 +371,19 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLAGS:
|
case TYPE_CODE_FLAGS:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
val_print_type_code_flags (type, valaddr + embedded_offset, stream);
|
val_print_type_code_flags (type, valaddr + embedded_offset, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FUNC:
|
case TYPE_CODE_FUNC:
|
||||||
case TYPE_CODE_METHOD:
|
case TYPE_CODE_METHOD:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
||||||
|
@ -394,9 +396,14 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_BOOL:
|
case TYPE_CODE_BOOL:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = unpack_long (type, valaddr + embedded_offset);
|
val = unpack_long (type, valaddr + embedded_offset);
|
||||||
|
@ -420,10 +427,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case TYPE_CODE_INT:
|
case TYPE_CODE_INT:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -432,7 +442,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
Since we don't know whether the value is really intended to
|
Since we don't know whether the value is really intended to
|
||||||
be used as an integer or a character, print the character
|
be used as an integer or a character, print the character
|
||||||
equivalent as well. */
|
equivalent as well. */
|
||||||
if (textual_element_type (type, format))
|
if (textual_element_type (type, options->format))
|
||||||
{
|
{
|
||||||
fputs_filtered (" ", stream);
|
fputs_filtered (" ", stream);
|
||||||
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
|
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
|
||||||
|
@ -442,10 +452,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_CHAR:
|
case TYPE_CODE_CHAR:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -460,9 +473,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLT:
|
case TYPE_CODE_FLT:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -471,8 +485,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_DECFLOAT:
|
case TYPE_CODE_DECFLOAT:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
print_decimal_floating (valaddr + embedded_offset, type, stream);
|
print_decimal_floating (valaddr + embedded_offset, type, stream);
|
||||||
break;
|
break;
|
||||||
|
@ -493,19 +508,19 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_COMPLEX:
|
case TYPE_CODE_COMPLEX:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset,
|
print_scalar_formatted (valaddr + embedded_offset,
|
||||||
TYPE_TARGET_TYPE (type),
|
TYPE_TARGET_TYPE (type),
|
||||||
format, 0, stream);
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
|
print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
|
||||||
stream);
|
stream);
|
||||||
fprintf_filtered (stream, " + ");
|
fprintf_filtered (stream, " + ");
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset
|
print_scalar_formatted (valaddr + embedded_offset
|
||||||
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
||||||
TYPE_TARGET_TYPE (type),
|
TYPE_TARGET_TYPE (type),
|
||||||
format, 0, stream);
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
print_floating (valaddr + embedded_offset
|
print_floating (valaddr + embedded_offset
|
||||||
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
|
||||||
|
@ -522,11 +537,14 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
c_value_print (struct value *val, struct ui_file *stream, int format,
|
c_value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *type, *real_type;
|
struct type *type, *real_type;
|
||||||
int full, top, using_enc;
|
int full, top, using_enc;
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
|
||||||
|
opts.deref_ref = 1;
|
||||||
|
|
||||||
/* If it is a pointer, indicate what it points to.
|
/* If it is a pointer, indicate what it points to.
|
||||||
|
|
||||||
|
@ -551,7 +569,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
{
|
{
|
||||||
/* Print nothing */
|
/* Print nothing */
|
||||||
}
|
}
|
||||||
else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
|
else if (options->objectprint
|
||||||
|
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (TYPE_CODE(type) == TYPE_CODE_REF)
|
if (TYPE_CODE(type) == TYPE_CODE_REF)
|
||||||
|
@ -602,7 +621,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
if (!value_initialized (val))
|
if (!value_initialized (val))
|
||||||
fprintf_filtered (stream, " [uninitialized] ");
|
fprintf_filtered (stream, " [uninitialized] ");
|
||||||
|
|
||||||
if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
|
if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
|
||||||
{
|
{
|
||||||
/* Attempt to determine real type of object */
|
/* Attempt to determine real type of object */
|
||||||
real_type = value_rtti_type (val, &full, &top, &using_enc);
|
real_type = value_rtti_type (val, &full, &top, &using_enc);
|
||||||
|
@ -616,8 +635,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
/* Print out object: enclosing type is same as real_type if full */
|
/* Print out object: enclosing type is same as real_type if full */
|
||||||
return val_print (value_enclosing_type (val),
|
return val_print (value_enclosing_type (val),
|
||||||
value_contents_all (val), 0,
|
value_contents_all (val), 0,
|
||||||
VALUE_ADDRESS (val), stream, format, 1, 0,
|
VALUE_ADDRESS (val), stream, 0,
|
||||||
pretty, current_language);
|
&opts, current_language);
|
||||||
/* Note: When we look up RTTI entries, we don't get any information on
|
/* Note: When we look up RTTI entries, we don't get any information on
|
||||||
const or volatile attributes */
|
const or volatile attributes */
|
||||||
}
|
}
|
||||||
|
@ -628,8 +647,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
TYPE_NAME (value_enclosing_type (val)));
|
TYPE_NAME (value_enclosing_type (val)));
|
||||||
return val_print (value_enclosing_type (val),
|
return val_print (value_enclosing_type (val),
|
||||||
value_contents_all (val), 0,
|
value_contents_all (val), 0,
|
||||||
VALUE_ADDRESS (val), stream, format, 1, 0,
|
VALUE_ADDRESS (val), stream, 0,
|
||||||
pretty, current_language);
|
&opts, current_language);
|
||||||
}
|
}
|
||||||
/* Otherwise, we end up at the return outside this "if" */
|
/* Otherwise, we end up at the return outside this "if" */
|
||||||
}
|
}
|
||||||
|
@ -637,5 +656,5 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
return val_print (type, value_contents_all (val),
|
return val_print (type, value_contents_all (val),
|
||||||
value_embedded_offset (val),
|
value_embedded_offset (val),
|
||||||
VALUE_ADDRESS (val) + value_offset (val),
|
VALUE_ADDRESS (val) + value_offset (val),
|
||||||
stream, format, 1, 0, pretty, current_language);
|
stream, 0, &opts, current_language);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
/* Controls printing of vtbl's */
|
/* Controls printing of vtbl's */
|
||||||
int vtblprint;
|
|
||||||
static void
|
static void
|
||||||
show_vtblprint (struct ui_file *file, int from_tty,
|
show_vtblprint (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -50,7 +49,6 @@ Printing of C++ virtual function tables is %s.\n"),
|
||||||
|
|
||||||
/* Controls looking up an object's derived type using what we find in
|
/* Controls looking up an object's derived type using what we find in
|
||||||
its vtables. */
|
its vtables. */
|
||||||
int objectprint;
|
|
||||||
static void
|
static void
|
||||||
show_objectprint (struct ui_file *file, int from_tty,
|
show_objectprint (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c,
|
struct cmd_list_element *c,
|
||||||
|
@ -61,7 +59,6 @@ Printing of object's derived type based on vtable info is %s.\n"),
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int static_field_print; /* Controls printing of static fields. */
|
|
||||||
static void
|
static void
|
||||||
show_static_field_print (struct ui_file *file, int from_tty,
|
show_static_field_print (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -77,12 +74,12 @@ static struct obstack dont_print_statmem_obstack;
|
||||||
extern void _initialize_cp_valprint (void);
|
extern void _initialize_cp_valprint (void);
|
||||||
|
|
||||||
static void cp_print_static_field (struct type *, struct value *,
|
static void cp_print_static_field (struct type *, struct value *,
|
||||||
struct ui_file *, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
static void cp_print_value (struct type *, struct type *, const gdb_byte *,
|
static void cp_print_value (struct type *, struct type *, const gdb_byte *,
|
||||||
int, CORE_ADDR, struct ui_file *, int, int,
|
int, CORE_ADDR, struct ui_file *, int,
|
||||||
enum val_prettyprint, struct type **);
|
const struct value_print_options *, struct type **);
|
||||||
|
|
||||||
|
|
||||||
/* GCC versions after 2.4.5 use this. */
|
/* GCC versions after 2.4.5 use this. */
|
||||||
|
@ -139,7 +136,7 @@ cp_is_vtbl_member (struct type *type)
|
||||||
/* Mutually recursive subroutines of cp_print_value and c_val_print to
|
/* Mutually recursive subroutines of cp_print_value and c_val_print to
|
||||||
print out a structure's fields: cp_print_value_fields and cp_print_value.
|
print out a structure's fields: cp_print_value_fields and cp_print_value.
|
||||||
|
|
||||||
TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
|
TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
|
||||||
same meanings as in cp_print_value and c_val_print.
|
same meanings as in cp_print_value and c_val_print.
|
||||||
|
|
||||||
2nd argument REAL_TYPE is used to carry over the type of the derived
|
2nd argument REAL_TYPE is used to carry over the type of the derived
|
||||||
|
@ -151,9 +148,9 @@ cp_is_vtbl_member (struct type *type)
|
||||||
void
|
void
|
||||||
cp_print_value_fields (struct type *type, struct type *real_type,
|
cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
const gdb_byte *valaddr, int offset, CORE_ADDR address,
|
const gdb_byte *valaddr, int offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int recurse,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
struct type **dont_print_vb,int dont_print_statmem)
|
struct type **dont_print_vb, int dont_print_statmem)
|
||||||
{
|
{
|
||||||
int i, len, n_baseclasses;
|
int i, len, n_baseclasses;
|
||||||
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
|
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
|
||||||
|
@ -170,7 +167,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
|
|
||||||
if (n_baseclasses > 0)
|
if (n_baseclasses > 0)
|
||||||
cp_print_value (type, real_type, valaddr, offset, address, stream,
|
cp_print_value (type, real_type, valaddr, offset, address, stream,
|
||||||
format, recurse + 1, pretty, dont_print_vb);
|
recurse + 1, options, dont_print_vb);
|
||||||
|
|
||||||
/* Second, print out data fields */
|
/* Second, print out data fields */
|
||||||
|
|
||||||
|
@ -192,7 +189,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
for (i = n_baseclasses; i < len; i++)
|
for (i = n_baseclasses; i < len; i++)
|
||||||
{
|
{
|
||||||
/* If requested, skip printing of static fields. */
|
/* If requested, skip printing of static fields. */
|
||||||
if (!static_field_print
|
if (!options->static_field_print
|
||||||
&& field_is_static (&TYPE_FIELD (type, i)))
|
&& field_is_static (&TYPE_FIELD (type, i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -200,7 +197,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
else if (n_baseclasses > 0)
|
else if (n_baseclasses > 0)
|
||||||
{
|
{
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -211,7 +208,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
}
|
}
|
||||||
fields_seen = 1;
|
fields_seen = 1;
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -220,7 +217,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
{
|
{
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
}
|
}
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
||||||
fputs_filtered ("\"( ptr \"", stream);
|
fputs_filtered ("\"( ptr \"", stream);
|
||||||
|
@ -266,11 +263,13 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
v = value_from_longest
|
v = value_from_longest
|
||||||
(TYPE_FIELD_TYPE (type, i),
|
(TYPE_FIELD_TYPE (type, i),
|
||||||
unpack_field_as_long (type, valaddr + offset, i));
|
unpack_field_as_long (type, valaddr + offset, i));
|
||||||
|
|
||||||
common_val_print (v, stream, format, 0, recurse + 1, pretty,
|
common_val_print (v, stream, recurse + 1, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,15 +286,16 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
fputs_filtered ("<optimized out>", stream);
|
fputs_filtered ("<optimized out>", stream);
|
||||||
else
|
else
|
||||||
cp_print_static_field (TYPE_FIELD_TYPE (type, i), v,
|
cp_print_static_field (TYPE_FIELD_TYPE (type, i), v,
|
||||||
stream, format, recurse + 1,
|
stream, recurse + 1, options);
|
||||||
pretty);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
val_print (TYPE_FIELD_TYPE (type, i),
|
val_print (TYPE_FIELD_TYPE (type, i),
|
||||||
valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
|
valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
stream, format, 0, recurse + 1, pretty,
|
stream, recurse + 1, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
dont_print_statmem_obstack = tmp_obstack;
|
dont_print_statmem_obstack = tmp_obstack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -326,8 +326,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
|
||||||
static void
|
static void
|
||||||
cp_print_value (struct type *type, struct type *real_type,
|
cp_print_value (struct type *type, struct type *real_type,
|
||||||
const gdb_byte *valaddr, int offset, CORE_ADDR address,
|
const gdb_byte *valaddr, int offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int recurse,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty, struct type **dont_print_vb)
|
const struct value_print_options *options,
|
||||||
|
struct type **dont_print_vb)
|
||||||
{
|
{
|
||||||
struct type **last_dont_print
|
struct type **last_dont_print
|
||||||
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
|
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
|
||||||
|
@ -402,7 +403,7 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||||
base_valaddr = valaddr;
|
base_valaddr = valaddr;
|
||||||
|
|
||||||
/* now do the printing */
|
/* now do the printing */
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -419,8 +420,7 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||||
else
|
else
|
||||||
cp_print_value_fields (baseclass, thistype, base_valaddr,
|
cp_print_value_fields (baseclass, thistype, base_valaddr,
|
||||||
thisoffset + boffset, address + boffset,
|
thisoffset + boffset, address + boffset,
|
||||||
stream, format,
|
stream, recurse, options,
|
||||||
recurse, pretty,
|
|
||||||
((struct type **)
|
((struct type **)
|
||||||
obstack_base (&dont_print_vb_obstack)),
|
obstack_base (&dont_print_vb_obstack)),
|
||||||
0);
|
0);
|
||||||
|
@ -447,17 +447,17 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||||
static member classes in an obstack and refuse to print them more
|
static member classes in an obstack and refuse to print them more
|
||||||
than once.
|
than once.
|
||||||
|
|
||||||
VAL contains the value to print, TYPE, STREAM, RECURSE, and PRETTY
|
VAL contains the value to print, TYPE, STREAM, RECURSE, and OPTIONS
|
||||||
have the same meanings as in c_val_print. */
|
have the same meanings as in c_val_print. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cp_print_static_field (struct type *type,
|
cp_print_static_field (struct type *type,
|
||||||
struct value *val,
|
struct value *val,
|
||||||
struct ui_file *stream,
|
struct ui_file *stream,
|
||||||
int format,
|
|
||||||
int recurse,
|
int recurse,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
||||||
{
|
{
|
||||||
CORE_ADDR *first_dont_print;
|
CORE_ADDR *first_dont_print;
|
||||||
|
@ -485,12 +485,15 @@ cp_print_static_field (struct type *type,
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
cp_print_value_fields (type, type, value_contents_all (val),
|
cp_print_value_fields (type, type, value_contents_all (val),
|
||||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||||
stream, format, recurse, pretty, NULL, 1);
|
stream, recurse, options, NULL, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
val_print (type, value_contents_all (val),
|
val_print (type, value_contents_all (val),
|
||||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||||
stream, format, 0, recurse, pretty, current_language);
|
stream, recurse, &opts, current_language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -589,32 +592,29 @@ void
|
||||||
_initialize_cp_valprint (void)
|
_initialize_cp_valprint (void)
|
||||||
{
|
{
|
||||||
add_setshow_boolean_cmd ("static-members", class_support,
|
add_setshow_boolean_cmd ("static-members", class_support,
|
||||||
&static_field_print, _("\
|
&user_print_options.static_field_print, _("\
|
||||||
Set printing of C++ static members."), _("\
|
Set printing of C++ static members."), _("\
|
||||||
Show printing of C++ static members."), NULL,
|
Show printing of C++ static members."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_static_field_print,
|
show_static_field_print,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
/* Turn on printing of static fields. */
|
|
||||||
static_field_print = 1;
|
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("vtbl", class_support, &vtblprint, _("\
|
add_setshow_boolean_cmd ("vtbl", class_support,
|
||||||
|
&user_print_options.vtblprint, _("\
|
||||||
Set printing of C++ virtual function tables."), _("\
|
Set printing of C++ virtual function tables."), _("\
|
||||||
Show printing of C++ virtual function tables."), NULL,
|
Show printing of C++ virtual function tables."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_vtblprint,
|
show_vtblprint,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("object", class_support, &objectprint, _("\
|
add_setshow_boolean_cmd ("object", class_support,
|
||||||
|
&user_print_options.objectprint, _("\
|
||||||
Set printing of object's derived type based on vtable info."), _("\
|
Set printing of object's derived type based on vtable info."), _("\
|
||||||
Show printing of object's derived type based on vtable info."), NULL,
|
Show printing of object's derived type based on vtable info."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_objectprint,
|
show_objectprint,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
/* Give people the defaults which they are used to. */
|
|
||||||
objectprint = 0;
|
|
||||||
vtblprint = 0;
|
|
||||||
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
|
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
|
||||||
obstack_specify_allocation (&dont_print_statmem_obstack,
|
obstack_specify_allocation (&dont_print_statmem_obstack,
|
||||||
32 * sizeof (CORE_ADDR), sizeof (CORE_ADDR),
|
32 * sizeof (CORE_ADDR), sizeof (CORE_ADDR),
|
||||||
|
|
11
gdb/eval.c
11
gdb/eval.c
|
@ -39,16 +39,13 @@
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "user-regs.h"
|
#include "user-regs.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
|
|
||||||
/* This is defined in valops.c */
|
/* This is defined in valops.c */
|
||||||
extern int overload_resolution;
|
extern int overload_resolution;
|
||||||
|
|
||||||
/* JYG: lookup rtti type of STRUCTOP_PTR when this is set to continue
|
|
||||||
on with successful lookup for member/method of the rtti type. */
|
|
||||||
extern int objectprint;
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
|
static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
|
||||||
|
@ -1628,8 +1625,10 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||||
struct type *type = value_type (arg1);
|
struct type *type = value_type (arg1);
|
||||||
struct type *real_type;
|
struct type *real_type;
|
||||||
int full, top, using_enc;
|
int full, top, using_enc;
|
||||||
|
struct value_print_options opts;
|
||||||
if (objectprint && TYPE_TARGET_TYPE(type) &&
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
if (opts.objectprint && TYPE_TARGET_TYPE(type) &&
|
||||||
(TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
|
(TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
|
||||||
{
|
{
|
||||||
real_type = value_rtti_target_type (arg1, &full, &top, &using_enc);
|
real_type = value_rtti_target_type (arg1, &full, &top, &using_enc);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#ifdef HAVE_CTYPE_H
|
#ifdef HAVE_CTYPE_H
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -92,17 +93,25 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_LONG:
|
case OP_LONG:
|
||||||
(*pos) += 3;
|
{
|
||||||
value_print (value_from_longest (exp->elts[pc + 1].type,
|
struct value_print_options opts;
|
||||||
exp->elts[pc + 2].longconst),
|
get_raw_print_options (&opts);
|
||||||
stream, 0, Val_no_prettyprint);
|
(*pos) += 3;
|
||||||
|
value_print (value_from_longest (exp->elts[pc + 1].type,
|
||||||
|
exp->elts[pc + 2].longconst),
|
||||||
|
stream, &opts);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_DOUBLE:
|
case OP_DOUBLE:
|
||||||
(*pos) += 3;
|
{
|
||||||
value_print (value_from_double (exp->elts[pc + 1].type,
|
struct value_print_options opts;
|
||||||
exp->elts[pc + 2].doubleconst),
|
get_raw_print_options (&opts);
|
||||||
stream, 0, Val_no_prettyprint);
|
(*pos) += 3;
|
||||||
|
value_print (value_from_double (exp->elts[pc + 1].type,
|
||||||
|
exp->elts[pc + 2].doubleconst),
|
||||||
|
stream, &opts);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_VAR_VALUE:
|
case OP_VAR_VALUE:
|
||||||
|
@ -169,12 +178,17 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_STRING:
|
case OP_STRING:
|
||||||
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
{
|
||||||
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
|
struct value_print_options opts;
|
||||||
/* LA_PRINT_STRING will print using the current repeat count threshold.
|
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
||||||
If necessary, we can temporarily set it to zero, or pass it as an
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
|
||||||
additional parameter to LA_PRINT_STRING. -fnf */
|
/* LA_PRINT_STRING will print using the current repeat count threshold.
|
||||||
LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
|
If necessary, we can temporarily set it to zero, or pass it as an
|
||||||
|
additional parameter to LA_PRINT_STRING. -fnf */
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0,
|
||||||
|
&opts);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_BITSTRING:
|
case OP_BITSTRING:
|
||||||
|
@ -185,11 +199,16 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_OBJC_NSSTRING: /* Objective-C Foundation Class NSString constant. */
|
case OP_OBJC_NSSTRING: /* Objective-C Foundation Class NSString constant. */
|
||||||
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
{
|
||||||
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
|
struct value_print_options opts;
|
||||||
fputs_filtered ("@\"", stream);
|
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
||||||
LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("@\"", stream);
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0,
|
||||||
|
&opts);
|
||||||
|
fputs_filtered ("\"", stream);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_OBJC_MSGCALL:
|
case OP_OBJC_MSGCALL:
|
||||||
|
@ -270,7 +289,10 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
}
|
}
|
||||||
if (tem > 0)
|
if (tem > 0)
|
||||||
{
|
{
|
||||||
LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0);
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0,
|
||||||
|
&opts);
|
||||||
(*pos) = pc;
|
(*pos) = pc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -394,6 +416,8 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
|
if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
|
||||||
exp->elts[pc + 3].opcode == OP_LONG)
|
exp->elts[pc + 3].opcode == OP_LONG)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* We have a minimal symbol fn, probably. It's encoded
|
/* We have a minimal symbol fn, probably. It's encoded
|
||||||
as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
|
as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
|
||||||
Swallow the OP_LONG (including both its opcodes); ignore
|
Swallow the OP_LONG (including both its opcodes); ignore
|
||||||
|
@ -401,7 +425,8 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
(*pos) += 4;
|
(*pos) += 4;
|
||||||
val = value_at_lazy (exp->elts[pc + 1].type,
|
val = value_at_lazy (exp->elts[pc + 1].type,
|
||||||
(CORE_ADDR) exp->elts[pc + 5].longconst);
|
(CORE_ADDR) exp->elts[pc + 5].longconst);
|
||||||
value_print (val, stream, 0, Val_no_prettyprint);
|
get_raw_print_options (&opts);
|
||||||
|
value_print (val, stream, &opts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
19
gdb/f-lang.c
19
gdb/f-lang.c
|
@ -142,7 +142,8 @@ f_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
f_printstr (struct ui_file *stream, const gdb_byte *string,
|
f_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -155,7 +156,7 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; ++i)
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining
|
/* Position of the character we are examining
|
||||||
to see whether it is repeated. */
|
to see whether it is repeated. */
|
||||||
|
@ -179,11 +180,11 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
++reps;
|
++reps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\', ", stream);
|
fputs_filtered ("\\', ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("', ", stream);
|
fputs_filtered ("', ", stream);
|
||||||
|
@ -192,14 +193,14 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
f_printchar (string[i], stream);
|
f_printchar (string[i], stream);
|
||||||
fprintf_filtered (stream, " <repeats %u times>", reps);
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!in_quotes)
|
if (!in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\'", stream);
|
fputs_filtered ("\\'", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
|
@ -213,7 +214,7 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\'", stream);
|
fputs_filtered ("\\'", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
|
@ -305,8 +306,8 @@ f_language_arch_info (struct gdbarch *gdbarch,
|
||||||
|
|
||||||
/* This is declared in c-lang.h but it is silly to import that file for what
|
/* This is declared in c-lang.h but it is silly to import that file for what
|
||||||
is already just a hack. */
|
is already just a hack. */
|
||||||
extern int c_value_print (struct value *, struct ui_file *, int,
|
extern int c_value_print (struct value *, struct ui_file *,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
const struct language_defn f_language_defn =
|
const struct language_defn f_language_defn =
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,8 @@ extern void f_print_type (struct type *, char *, struct ui_file *, int,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* Language-specific data structures */
|
/* Language-specific data structures */
|
||||||
|
|
||||||
|
|
103
gdb/f-valprint.c
103
gdb/f-valprint.c
|
@ -164,42 +164,42 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
|
||||||
static void
|
static void
|
||||||
f77_print_array_1 (int nss, int ndimensions, struct type *type,
|
f77_print_array_1 (int nss, int ndimensions, struct type *type,
|
||||||
const gdb_byte *valaddr, CORE_ADDR address,
|
const gdb_byte *valaddr, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
int *elts)
|
int *elts)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (nss != ndimensions)
|
if (nss != ndimensions)
|
||||||
{
|
{
|
||||||
for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++)
|
for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); i++)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "( ");
|
fprintf_filtered (stream, "( ");
|
||||||
f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
|
f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
|
||||||
valaddr + i * F77_DIM_OFFSET (nss),
|
valaddr + i * F77_DIM_OFFSET (nss),
|
||||||
address + i * F77_DIM_OFFSET (nss),
|
address + i * F77_DIM_OFFSET (nss),
|
||||||
stream, format, deref_ref, recurse, pretty, elts);
|
stream, recurse, options, elts);
|
||||||
fprintf_filtered (stream, ") ");
|
fprintf_filtered (stream, ") ");
|
||||||
}
|
}
|
||||||
if (*elts >= print_max && i < F77_DIM_SIZE (nss))
|
if (*elts >= options->print_max && i < F77_DIM_SIZE (nss))
|
||||||
fprintf_filtered (stream, "...");
|
fprintf_filtered (stream, "...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < print_max;
|
for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max;
|
||||||
i++, (*elts)++)
|
i++, (*elts)++)
|
||||||
{
|
{
|
||||||
val_print (TYPE_TARGET_TYPE (type),
|
val_print (TYPE_TARGET_TYPE (type),
|
||||||
valaddr + i * F77_DIM_OFFSET (ndimensions),
|
valaddr + i * F77_DIM_OFFSET (ndimensions),
|
||||||
0,
|
0,
|
||||||
address + i * F77_DIM_OFFSET (ndimensions),
|
address + i * F77_DIM_OFFSET (ndimensions),
|
||||||
stream, format, deref_ref, recurse, pretty,
|
stream, recurse, options, current_language);
|
||||||
current_language);
|
|
||||||
|
|
||||||
if (i != (F77_DIM_SIZE (nss) - 1))
|
if (i != (F77_DIM_SIZE (nss) - 1))
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
|
|
||||||
if ((*elts == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1)))
|
if ((*elts == options->print_max - 1)
|
||||||
|
&& (i != (F77_DIM_SIZE (nss) - 1)))
|
||||||
fprintf_filtered (stream, "...");
|
fprintf_filtered (stream, "...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,8 +211,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
|
||||||
static void
|
static void
|
||||||
f77_print_array (struct type *type, const gdb_byte *valaddr,
|
f77_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream,
|
CORE_ADDR address, struct ui_file *stream,
|
||||||
int format, int deref_ref, int recurse,
|
int recurse, const struct value_print_options *options)
|
||||||
enum val_prettyprint pretty)
|
|
||||||
{
|
{
|
||||||
int ndimensions;
|
int ndimensions;
|
||||||
int elts = 0;
|
int elts = 0;
|
||||||
|
@ -229,28 +228,22 @@ f77_print_array (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
f77_create_arrayprint_offset_tbl (type, stream);
|
f77_create_arrayprint_offset_tbl (type, stream);
|
||||||
|
|
||||||
f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format,
|
f77_print_array_1 (1, ndimensions, type, valaddr, address, stream,
|
||||||
deref_ref, recurse, pretty, &elts);
|
recurse, options, &elts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
target byte order.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed. */
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
CORE_ADDR address, struct ui_file *stream, int format,
|
CORE_ADDR address, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i = 0; /* Number of characters printed */
|
unsigned int i = 0; /* Number of characters printed */
|
||||||
struct type *elttype;
|
struct type *elttype;
|
||||||
|
@ -263,20 +256,19 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
{
|
{
|
||||||
case TYPE_CODE_STRING:
|
case TYPE_CODE_STRING:
|
||||||
f77_get_dynamic_length_of_aggregate (type);
|
f77_get_dynamic_length_of_aggregate (type);
|
||||||
LA_PRINT_STRING (stream, valaddr, TYPE_LENGTH (type), 1, 0);
|
LA_PRINT_STRING (stream, valaddr, TYPE_LENGTH (type), 1, 0, options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_ARRAY:
|
case TYPE_CODE_ARRAY:
|
||||||
fprintf_filtered (stream, "(");
|
fprintf_filtered (stream, "(");
|
||||||
f77_print_array (type, valaddr, address, stream, format,
|
f77_print_array (type, valaddr, address, stream, recurse, options);
|
||||||
deref_ref, recurse, pretty);
|
|
||||||
fprintf_filtered (stream, ")");
|
fprintf_filtered (stream, ")");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
if (format && format != 's')
|
if (options->format && options->format != 's')
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -292,16 +284,17 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint && format != 's')
|
if (options->addressprint && options->format != 's')
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
|
|
||||||
/* For a pointer to char or unsigned char, also print the string
|
/* For a pointer to char or unsigned char, also print the string
|
||||||
pointed to, unless pointer is null. */
|
pointed to, unless pointer is null. */
|
||||||
if (TYPE_LENGTH (elttype) == 1
|
if (TYPE_LENGTH (elttype) == 1
|
||||||
&& TYPE_CODE (elttype) == TYPE_CODE_INT
|
&& TYPE_CODE (elttype) == TYPE_CODE_INT
|
||||||
&& (format == 0 || format == 's')
|
&& (options->format == 0 || options->format == 's')
|
||||||
&& addr != 0)
|
&& addr != 0)
|
||||||
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
|
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,
|
||||||
|
options);
|
||||||
|
|
||||||
/* Return number of characters printed, including the terminating
|
/* Return number of characters printed, including the terminating
|
||||||
'\0' if we reached the end. val_print_string takes care including
|
'\0' if we reached the end. val_print_string takes care including
|
||||||
|
@ -312,17 +305,17 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
|
|
||||||
case TYPE_CODE_REF:
|
case TYPE_CODE_REF:
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= extract_typed_address (valaddr + embedded_offset, type);
|
= extract_typed_address (valaddr + embedded_offset, type);
|
||||||
fprintf_filtered (stream, "@");
|
fprintf_filtered (stream, "@");
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
fputs_filtered (": ", stream);
|
fputs_filtered (": ", stream);
|
||||||
}
|
}
|
||||||
/* De-reference the reference. */
|
/* De-reference the reference. */
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
||||||
{
|
{
|
||||||
|
@ -330,8 +323,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
value_at
|
value_at
|
||||||
(TYPE_TARGET_TYPE (type),
|
(TYPE_TARGET_TYPE (type),
|
||||||
unpack_pointer (type, valaddr + embedded_offset));
|
unpack_pointer (type, valaddr + embedded_offset));
|
||||||
common_val_print (deref_val, stream, format, deref_ref, recurse,
|
common_val_print (deref_val, stream, recurse,
|
||||||
pretty, current_language);
|
options, current_language);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("???", stream);
|
fputs_filtered ("???", stream);
|
||||||
|
@ -339,9 +332,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FUNC:
|
case TYPE_CODE_FUNC:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
||||||
|
@ -354,9 +347,13 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_INT:
|
case TYPE_CODE_INT:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr, type, &opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val_print_type_code_int (type, valaddr, stream);
|
val_print_type_code_int (type, valaddr, stream);
|
||||||
|
@ -374,15 +371,15 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLAGS:
|
case TYPE_CODE_FLAGS:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
else
|
else
|
||||||
val_print_type_code_flags (type, valaddr, stream);
|
val_print_type_code_flags (type, valaddr, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLT:
|
case TYPE_CODE_FLT:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
else
|
else
|
||||||
print_floating (valaddr, type, stream);
|
print_floating (valaddr, type, stream);
|
||||||
break;
|
break;
|
||||||
|
@ -401,9 +398,13 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_BOOL:
|
case TYPE_CODE_BOOL:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr, type, &opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = extract_unsigned_integer (valaddr, TYPE_LENGTH (type));
|
val = extract_unsigned_integer (valaddr, TYPE_LENGTH (type));
|
||||||
|
@ -417,8 +418,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
{
|
{
|
||||||
/* Bash the type code temporarily. */
|
/* Bash the type code temporarily. */
|
||||||
TYPE_CODE (type) = TYPE_CODE_INT;
|
TYPE_CODE (type) = TYPE_CODE_INT;
|
||||||
f_val_print (type, valaddr, 0, address, stream, format,
|
f_val_print (type, valaddr, 0, address, stream, recurse, options);
|
||||||
deref_ref, recurse, pretty);
|
|
||||||
/* Restore the type code so later uses work as intended. */
|
/* Restore the type code so later uses work as intended. */
|
||||||
TYPE_CODE (type) = TYPE_CODE_BOOL;
|
TYPE_CODE (type) = TYPE_CODE_BOOL;
|
||||||
}
|
}
|
||||||
|
@ -450,8 +450,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
{
|
{
|
||||||
int offset = TYPE_FIELD_BITPOS (type, index) / 8;
|
int offset = TYPE_FIELD_BITPOS (type, index) / 8;
|
||||||
f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset,
|
f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset,
|
||||||
embedded_offset, address, stream,
|
embedded_offset, address, stream, recurse, options);
|
||||||
format, deref_ref, recurse, pretty);
|
|
||||||
if (index != TYPE_NFIELDS (type) - 1)
|
if (index != TYPE_NFIELDS (type) - 1)
|
||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
/* Forward declarations for prototypes. */
|
/* Forward declarations for prototypes. */
|
||||||
struct field;
|
struct field;
|
||||||
struct block;
|
struct block;
|
||||||
|
struct value_print_options;
|
||||||
|
|
||||||
/* Some macros for char-based bitfields. */
|
/* Some macros for char-based bitfields. */
|
||||||
|
|
||||||
|
@ -1246,8 +1247,9 @@ extern int field_is_static (struct field *);
|
||||||
|
|
||||||
/* printcmd.c */
|
/* printcmd.c */
|
||||||
|
|
||||||
extern void print_scalar_formatted (const void *, struct type *, int, int,
|
extern void print_scalar_formatted (const void *, struct type *,
|
||||||
struct ui_file *);
|
const struct value_print_options *,
|
||||||
|
int, struct ui_file *);
|
||||||
|
|
||||||
extern int can_dereference (struct type *);
|
extern int can_dereference (struct type *);
|
||||||
|
|
||||||
|
|
26
gdb/infcmd.c
26
gdb/infcmd.c
|
@ -51,6 +51,7 @@
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "cli/cli-decode.h"
|
#include "cli/cli-decode.h"
|
||||||
#include "gdbthread.h"
|
#include "gdbthread.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
/* Functions exported for general use, in inferior.h: */
|
/* Functions exported for general use, in inferior.h: */
|
||||||
|
|
||||||
|
@ -1291,6 +1292,8 @@ print_return_value (struct type *func_type, struct type *value_type)
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* Print it. */
|
/* Print it. */
|
||||||
stb = ui_out_stream_new (uiout);
|
stb = ui_out_stream_new (uiout);
|
||||||
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
||||||
|
@ -1298,7 +1301,8 @@ print_return_value (struct type *func_type, struct type *value_type)
|
||||||
ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
|
ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
|
||||||
record_latest_value (value));
|
record_latest_value (value));
|
||||||
ui_out_text (uiout, " = ");
|
ui_out_text (uiout, " = ");
|
||||||
value_print (value, stb->stream, 0, Val_no_prettyprint);
|
get_raw_print_options (&opts);
|
||||||
|
value_print (value, stb->stream, &opts);
|
||||||
ui_out_field_stream (uiout, "return-value", stb);
|
ui_out_field_stream (uiout, "return-value", stb);
|
||||||
ui_out_text (uiout, "\n");
|
ui_out_text (uiout, "\n");
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
|
@ -1812,9 +1816,12 @@ default_print_registers_info (struct gdbarch *gdbarch,
|
||||||
|| TYPE_CODE (register_type (gdbarch, i)) == TYPE_CODE_DECFLOAT)
|
|| TYPE_CODE (register_type (gdbarch, i)) == TYPE_CODE_DECFLOAT)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
||||||
file, 0, 1, 0, Val_pretty_default, current_language);
|
file, 0, &opts, current_language);
|
||||||
|
|
||||||
fprintf_filtered (file, "\t(raw 0x");
|
fprintf_filtered (file, "\t(raw 0x");
|
||||||
for (j = 0; j < register_size (gdbarch, i); j++)
|
for (j = 0; j < register_size (gdbarch, i); j++)
|
||||||
|
@ -1830,16 +1837,23 @@ default_print_registers_info (struct gdbarch *gdbarch,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* Print the register in hex. */
|
/* Print the register in hex. */
|
||||||
|
get_formatted_print_options (&opts, 'x');
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
||||||
file, 'x', 1, 0, Val_pretty_default, current_language);
|
file, 0, &opts,
|
||||||
|
current_language);
|
||||||
/* If not a vector register, print it also according to its
|
/* If not a vector register, print it also according to its
|
||||||
natural format. */
|
natural format. */
|
||||||
if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
|
if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
|
||||||
{
|
{
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
opts.deref_ref = 1;
|
||||||
fprintf_filtered (file, "\t");
|
fprintf_filtered (file, "\t");
|
||||||
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
val_print (register_type (gdbarch, i), buffer, 0, 0,
|
||||||
file, 0, 1, 0, Val_pretty_default, current_language);
|
file, 0, &opts, current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1905,12 +1919,14 @@ registers_info (char *addr_exp, int fpregs)
|
||||||
if (regnum >= gdbarch_num_regs (gdbarch)
|
if (regnum >= gdbarch_num_regs (gdbarch)
|
||||||
+ gdbarch_num_pseudo_regs (gdbarch))
|
+ gdbarch_num_pseudo_regs (gdbarch))
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
struct value *val = value_of_user_reg (regnum, frame);
|
struct value *val = value_of_user_reg (regnum, frame);
|
||||||
|
|
||||||
printf_filtered ("%s: ", start);
|
printf_filtered ("%s: ", start);
|
||||||
|
get_formatted_print_options (&opts, 'x');
|
||||||
print_scalar_formatted (value_contents (val),
|
print_scalar_formatted (value_contents (val),
|
||||||
check_typedef (value_type (val)),
|
check_typedef (value_type (val)),
|
||||||
'x', 0, gdb_stdout);
|
&opts, 0, gdb_stdout);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -41,11 +41,11 @@ extern struct type *java_double_type;
|
||||||
extern struct type *java_void_type;
|
extern struct type *java_void_type;
|
||||||
|
|
||||||
extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int java_value_print (struct value *, struct ui_file *, int,
|
extern int java_value_print (struct value *, struct ui_file *,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern struct value *java_class_from_object (struct value *);
|
extern struct value *java_class_from_object (struct value *);
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,14 @@
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
|
|
||||||
int
|
int
|
||||||
java_value_print (struct value *val, struct ui_file *stream, int format,
|
java_value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
CORE_ADDR address;
|
CORE_ADDR address;
|
||||||
int i;
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
type = value_type (val);
|
type = value_type (val);
|
||||||
address = VALUE_ADDRESS (val) + value_offset (val);
|
address = VALUE_ADDRESS (val) + value_offset (val);
|
||||||
|
@ -89,7 +90,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
|
|
||||||
address += JAVA_OBJECT_SIZE + 4; /* Skip object header and length. */
|
address += JAVA_OBJECT_SIZE + 4; /* Skip object header and length. */
|
||||||
|
|
||||||
while (i < length && things_printed < print_max)
|
while (i < length && things_printed < options->print_max)
|
||||||
{
|
{
|
||||||
gdb_byte *buf;
|
gdb_byte *buf;
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
|
VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
|
||||||
VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
|
VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
|
||||||
|
|
||||||
while (i < length && things_printed < print_max)
|
while (i < length && things_printed < options->print_max)
|
||||||
{
|
{
|
||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
wrap_here (n_spaces (2));
|
wrap_here (n_spaces (2));
|
||||||
|
@ -180,8 +181,9 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
else
|
else
|
||||||
fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
|
fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
|
||||||
|
|
||||||
common_val_print (v, stream, format, 2, 1, pretty,
|
opts = *options;
|
||||||
current_language);
|
opts.deref_ref = 1;
|
||||||
|
common_val_print (v, stream, 1, &opts, current_language);
|
||||||
|
|
||||||
things_printed++;
|
things_printed++;
|
||||||
i += reps;
|
i += reps;
|
||||||
|
@ -203,7 +205,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
&& TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
|
&& TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
|
||||||
&& strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
|
&& strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
|
||||||
"java.lang.String") == 0
|
"java.lang.String") == 0
|
||||||
&& (format == 0 || format == 's')
|
&& (options->format == 0 || options->format == 's')
|
||||||
&& address != 0
|
&& address != 0
|
||||||
&& value_as_address (val) != 0)
|
&& value_as_address (val) != 0)
|
||||||
{
|
{
|
||||||
|
@ -228,16 +230,17 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
|
|
||||||
value_free_to_mark (mark); /* Release unnecessary values */
|
value_free_to_mark (mark); /* Release unnecessary values */
|
||||||
|
|
||||||
val_print_string (data + boffset, count, 2, stream);
|
val_print_string (data + boffset, count, 2, stream, options);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return common_val_print (val, stream, format, 1, 0, pretty,
|
opts = *options;
|
||||||
current_language);
|
opts.deref_ref = 1;
|
||||||
|
return common_val_print (val, stream, 0, &opts, current_language);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
|
/* TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
|
||||||
same meanings as in cp_print_value and c_val_print.
|
same meanings as in cp_print_value and c_val_print.
|
||||||
|
|
||||||
DONT_PRINT is an array of baseclass types that we
|
DONT_PRINT is an array of baseclass types that we
|
||||||
|
@ -246,7 +249,8 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
static void
|
static void
|
||||||
java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream,
|
CORE_ADDR address, struct ui_file *stream,
|
||||||
int format, int recurse, enum val_prettyprint pretty)
|
int recurse,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
int i, len, n_baseclasses;
|
int i, len, n_baseclasses;
|
||||||
|
|
||||||
|
@ -275,7 +279,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
boffset = 0;
|
boffset = 0;
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * (recurse + 1), stream);
|
print_spaces_filtered (2 * (recurse + 1), stream);
|
||||||
|
@ -289,7 +293,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
base_valaddr = valaddr;
|
base_valaddr = valaddr;
|
||||||
|
|
||||||
java_print_value_fields (baseclass, base_valaddr, address + boffset,
|
java_print_value_fields (baseclass, base_valaddr, address + boffset,
|
||||||
stream, format, recurse + 1, pretty);
|
stream, recurse + 1, options);
|
||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +311,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
if (field_is_static (&TYPE_FIELD (type, i)))
|
if (field_is_static (&TYPE_FIELD (type, i)))
|
||||||
{
|
{
|
||||||
char *name = TYPE_FIELD_NAME (type, i);
|
char *name = TYPE_FIELD_NAME (type, i);
|
||||||
if (!static_field_print)
|
if (!options->static_field_print)
|
||||||
continue;
|
continue;
|
||||||
if (name != NULL && strcmp (name, "class") == 0)
|
if (name != NULL && strcmp (name, "class") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -316,7 +320,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
else if (n_baseclasses > 0)
|
else if (n_baseclasses > 0)
|
||||||
{
|
{
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -327,7 +331,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
fields_seen = 1;
|
fields_seen = 1;
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -336,7 +340,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
{
|
{
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
}
|
}
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
||||||
fputs_filtered ("\"( ptr \"", stream);
|
fputs_filtered ("\"( ptr \"", stream);
|
||||||
|
@ -380,11 +384,15 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
||||||
unpack_field_as_long (type, valaddr, i));
|
unpack_field_as_long (type, valaddr, i));
|
||||||
|
|
||||||
common_val_print (v, stream, format, 0, recurse + 1,
|
opts = *options;
|
||||||
pretty, current_language);
|
opts.deref_ref = 0;
|
||||||
|
common_val_print (v, stream, recurse + 1,
|
||||||
|
&opts, current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -400,28 +408,33 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
fputs_filtered ("<optimized out>", stream);
|
fputs_filtered ("<optimized out>", stream);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
struct type *t = check_typedef (value_type (v));
|
struct type *t = check_typedef (value_type (v));
|
||||||
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
|
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
|
||||||
v = value_addr (v);
|
v = value_addr (v);
|
||||||
common_val_print (v, stream, format, 0, recurse + 1,
|
opts = *options;
|
||||||
pretty, current_language);
|
opts.deref_ref = 0;
|
||||||
|
common_val_print (v, stream, recurse + 1,
|
||||||
|
&opts, current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TYPE_FIELD_TYPE (type, i) == NULL)
|
else if (TYPE_FIELD_TYPE (type, i) == NULL)
|
||||||
fputs_filtered ("<unknown type>", stream);
|
fputs_filtered ("<unknown type>", stream);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
val_print (TYPE_FIELD_TYPE (type, i),
|
val_print (TYPE_FIELD_TYPE (type, i),
|
||||||
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
||||||
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
stream, format, 0, recurse + 1, pretty,
|
stream, recurse + 1, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
annotate_field_end ();
|
annotate_field_end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -432,22 +445,16 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
target byte order.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed. */
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
java_val_print (struct type *type, const gdb_byte *valaddr,
|
java_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int deref_ref,
|
struct ui_file *stream, int recurse,
|
||||||
int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i = 0; /* Number of characters printed */
|
unsigned int i = 0; /* Number of characters printed */
|
||||||
struct type *target_type;
|
struct type *target_type;
|
||||||
|
@ -457,13 +464,13 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
switch (TYPE_CODE (type))
|
switch (TYPE_CODE (type))
|
||||||
{
|
{
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
if (format && format != 's')
|
if (options->format && options->format != 's')
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
print_scalar_formatted (valaddr, type, options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (vtblprint && cp_is_vtbl_ptr_type (type))
|
if (options->vtblprint && cp_is_vtbl_ptr_type (type))
|
||||||
{
|
{
|
||||||
/* Print the unmangled name if desired. */
|
/* Print the unmangled name if desired. */
|
||||||
/* Print vtable entry - we only get here if we ARE using
|
/* Print vtable entry - we only get here if we ARE using
|
||||||
|
@ -490,7 +497,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint && format != 's')
|
if (options->addressprint && options->format != 's')
|
||||||
{
|
{
|
||||||
fputs_filtered ("@", stream);
|
fputs_filtered ("@", stream);
|
||||||
print_longest (stream, 'x', 0, (ULONGEST) addr);
|
print_longest (stream, 'x', 0, (ULONGEST) addr);
|
||||||
|
@ -502,9 +509,13 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
case TYPE_CODE_INT:
|
case TYPE_CODE_INT:
|
||||||
/* Can't just call c_val_print because that prints bytes as C
|
/* Can't just call c_val_print because that prints bytes as C
|
||||||
chars. */
|
chars. */
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr, type, &opts, 0, stream);
|
||||||
|
}
|
||||||
else if (TYPE_CODE (type) == TYPE_CODE_CHAR
|
else if (TYPE_CODE (type) == TYPE_CODE_CHAR
|
||||||
|| (TYPE_CODE (type) == TYPE_CODE_INT
|
|| (TYPE_CODE (type) == TYPE_CODE_INT
|
||||||
&& TYPE_LENGTH (type) == 2
|
&& TYPE_LENGTH (type) == 2
|
||||||
|
@ -515,13 +526,13 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
java_print_value_fields (type, valaddr, address, stream, format,
|
java_print_value_fields (type, valaddr, address, stream, recurse,
|
||||||
recurse, pretty);
|
options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return c_val_print (type, valaddr, embedded_offset, address, stream,
|
return c_val_print (type, valaddr, embedded_offset, address, stream,
|
||||||
format, deref_ref, recurse, pretty);
|
recurse, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -72,7 +72,8 @@ static void unk_lang_printchar (int c, struct ui_file *stream);
|
||||||
static void unk_lang_print_type (struct type *, char *, struct ui_file *,
|
static void unk_lang_print_type (struct type *, char *, struct ui_file *,
|
||||||
int, int);
|
int, int);
|
||||||
|
|
||||||
static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
|
static int unk_lang_value_print (struct value *, struct ui_file *,
|
||||||
|
const struct value_print_options *);
|
||||||
|
|
||||||
static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc);
|
static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc);
|
||||||
|
|
||||||
|
@ -1035,10 +1036,10 @@ default_word_break_characters (void)
|
||||||
|
|
||||||
void
|
void
|
||||||
default_print_array_index (struct value *index_value, struct ui_file *stream,
|
default_print_array_index (struct value *index_value, struct ui_file *stream,
|
||||||
int format, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "[");
|
fprintf_filtered (stream, "[");
|
||||||
LA_VALUE_PRINT (index_value, stream, format, pretty);
|
LA_VALUE_PRINT (index_value, stream, options);
|
||||||
fprintf_filtered (stream, "] = ");
|
fprintf_filtered (stream, "] = ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1071,8 @@ unk_lang_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unk_lang_printstr (struct ui_file *stream, const gdb_byte *string,
|
unk_lang_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
error (_("internal error - unimplemented function unk_lang_printstr called."));
|
error (_("internal error - unimplemented function unk_lang_printstr called."));
|
||||||
}
|
}
|
||||||
|
@ -1085,15 +1087,15 @@ unk_lang_print_type (struct type *type, char *varstring, struct ui_file *stream,
|
||||||
static int
|
static int
|
||||||
unk_lang_val_print (struct type *type, const gdb_byte *valaddr,
|
unk_lang_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
error (_("internal error - unimplemented function unk_lang_val_print called."));
|
error (_("internal error - unimplemented function unk_lang_val_print called."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unk_lang_value_print (struct value *val, struct ui_file *stream, int format,
|
unk_lang_value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
error (_("internal error - unimplemented function unk_lang_value_print called."));
|
error (_("internal error - unimplemented function unk_lang_value_print called."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct objfile;
|
||||||
struct frame_info;
|
struct frame_info;
|
||||||
struct expression;
|
struct expression;
|
||||||
struct ui_file;
|
struct ui_file;
|
||||||
|
struct value_print_options;
|
||||||
|
|
||||||
#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims */
|
#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims */
|
||||||
|
|
||||||
|
@ -189,7 +190,8 @@ struct language_defn
|
||||||
|
|
||||||
void (*la_printstr) (struct ui_file * stream, const gdb_byte *string,
|
void (*la_printstr) (struct ui_file * stream, const gdb_byte *string,
|
||||||
unsigned int length, int width,
|
unsigned int length, int width,
|
||||||
int force_ellipses);
|
int force_ellipses,
|
||||||
|
const struct value_print_options *);
|
||||||
|
|
||||||
void (*la_emitchar) (int ch, struct ui_file * stream, int quoter);
|
void (*la_emitchar) (int ch, struct ui_file * stream, int quoter);
|
||||||
|
|
||||||
|
@ -208,13 +210,13 @@ struct language_defn
|
||||||
/* Print a value using syntax appropriate for this language. */
|
/* Print a value using syntax appropriate for this language. */
|
||||||
|
|
||||||
int (*la_val_print) (struct type *, const gdb_byte *, int, CORE_ADDR,
|
int (*la_val_print) (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* Print a top-level value using syntax appropriate for this language. */
|
/* Print a top-level value using syntax appropriate for this language. */
|
||||||
|
|
||||||
int (*la_value_print) (struct value *, struct ui_file *,
|
int (*la_value_print) (struct value *, struct ui_file *,
|
||||||
int, enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* PC is possibly an unknown languages trampoline.
|
/* PC is possibly an unknown languages trampoline.
|
||||||
If that PC falls in a trampoline belonging to this language,
|
If that PC falls in a trampoline belonging to this language,
|
||||||
|
@ -274,8 +276,7 @@ struct language_defn
|
||||||
/* Print the index of an element of an array. */
|
/* Print the index of an element of an array. */
|
||||||
void (*la_print_array_index) (struct value *index_value,
|
void (*la_print_array_index) (struct value *index_value,
|
||||||
struct ui_file *stream,
|
struct ui_file *stream,
|
||||||
int format,
|
const struct value_print_options *options);
|
||||||
enum val_prettyprint pretty);
|
|
||||||
|
|
||||||
/* Return non-zero if TYPE should be passed (and returned) by
|
/* Return non-zero if TYPE should be passed (and returned) by
|
||||||
reference at the language level. */
|
reference at the language level. */
|
||||||
|
@ -366,21 +367,22 @@ extern enum language set_language (enum language);
|
||||||
#define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
|
#define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
|
||||||
(current_language->la_print_typedef(type,new_symbol,stream))
|
(current_language->la_print_typedef(type,new_symbol,stream))
|
||||||
|
|
||||||
#define LA_VAL_PRINT(type,valaddr,offset,addr,stream,fmt,deref,recurse,pretty) \
|
#define LA_VAL_PRINT(type,valaddr,offset,addr,stream,recurse,options) \
|
||||||
(current_language->la_val_print(type,valaddr,offset,addr,stream,fmt,deref, \
|
(current_language->la_val_print(type,valaddr,offset,addr,stream, \
|
||||||
recurse,pretty))
|
recurse,options))
|
||||||
#define LA_VALUE_PRINT(val,stream,fmt,pretty) \
|
#define LA_VALUE_PRINT(val,stream,options) \
|
||||||
(current_language->la_value_print(val,stream,fmt,pretty))
|
(current_language->la_value_print(val,stream,options))
|
||||||
|
|
||||||
#define LA_PRINT_CHAR(ch, stream) \
|
#define LA_PRINT_CHAR(ch, stream) \
|
||||||
(current_language->la_printchar(ch, stream))
|
(current_language->la_printchar(ch, stream))
|
||||||
#define LA_PRINT_STRING(stream, string, length, width, force_ellipses) \
|
#define LA_PRINT_STRING(stream, string, length, width, force_ellipses,options) \
|
||||||
(current_language->la_printstr(stream, string, length, width, force_ellipses))
|
(current_language->la_printstr(stream, string, length, width, \
|
||||||
|
force_ellipses,options))
|
||||||
#define LA_EMIT_CHAR(ch, stream, quoter) \
|
#define LA_EMIT_CHAR(ch, stream, quoter) \
|
||||||
(current_language->la_emitchar(ch, stream, quoter))
|
(current_language->la_emitchar(ch, stream, quoter))
|
||||||
|
|
||||||
#define LA_PRINT_ARRAY_INDEX(index_value, stream, format, pretty) \
|
#define LA_PRINT_ARRAY_INDEX(index_value, stream, optins) \
|
||||||
(current_language->la_print_array_index(index_value, stream, format, pretty))
|
(current_language->la_print_array_index(index_value, stream, options))
|
||||||
|
|
||||||
/* Test a character to decide whether it can be printed in literal form
|
/* Test a character to decide whether it can be printed in literal form
|
||||||
or needs to be printed in another representation. For example,
|
or needs to be printed in another representation. For example,
|
||||||
|
@ -472,8 +474,7 @@ extern char *default_word_break_characters (void);
|
||||||
/* Print the index of an array element using the C99 syntax. */
|
/* Print the index of an array element using the C99 syntax. */
|
||||||
extern void default_print_array_index (struct value *index_value,
|
extern void default_print_array_index (struct value *index_value,
|
||||||
struct ui_file *stream,
|
struct ui_file *stream,
|
||||||
int format,
|
const struct value_print_options *options);
|
||||||
enum val_prettyprint pretty);
|
|
||||||
|
|
||||||
/* Return non-zero if TYPE should be passed (and returned) by
|
/* Return non-zero if TYPE should be passed (and returned) by
|
||||||
reference at the language level. */
|
reference at the language level. */
|
||||||
|
|
|
@ -104,7 +104,8 @@ m2_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -117,7 +118,7 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; ++i)
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining
|
/* Position of the character we are examining
|
||||||
to see whether it is repeated. */
|
to see whether it is repeated. */
|
||||||
|
@ -141,11 +142,11 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
++reps;
|
++reps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\", ", stream);
|
fputs_filtered ("\\\", ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\", ", stream);
|
fputs_filtered ("\", ", stream);
|
||||||
|
@ -154,14 +155,14 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
m2_printchar (string[i], stream);
|
m2_printchar (string[i], stream);
|
||||||
fprintf_filtered (stream, " <repeats %u times>", reps);
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!in_quotes)
|
if (!in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
@ -175,7 +176,7 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
|
|
@ -33,8 +33,8 @@ extern int m2_is_long_set (struct type *type);
|
||||||
extern int m2_is_unbounded_array (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,
|
extern int m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int get_long_set_bounds (struct type *type, LONGEST *low,
|
extern int get_long_set_bounds (struct type *type, LONGEST *low,
|
||||||
LONGEST *high);
|
LONGEST *high);
|
||||||
|
|
|
@ -30,22 +30,24 @@
|
||||||
#include "m2-lang.h"
|
#include "m2-lang.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
int print_unpacked_pointer (struct type *type,
|
static int print_unpacked_pointer (struct type *type,
|
||||||
CORE_ADDR address, CORE_ADDR addr,
|
CORE_ADDR address, CORE_ADDR addr,
|
||||||
int format, struct ui_file *stream);
|
const struct value_print_options *options,
|
||||||
|
struct ui_file *stream);
|
||||||
static void
|
static void
|
||||||
m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
int deref_ref, int recurse, int len);
|
int len);
|
||||||
|
|
||||||
|
|
||||||
/* Print function pointer with inferior address ADDRESS onto stdio
|
/* Print function pointer with inferior address ADDRESS onto stdio
|
||||||
stream STREAM. */
|
stream STREAM. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
|
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
|
||||||
|
int addressprint)
|
||||||
{
|
{
|
||||||
CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
|
CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
|
||||||
address,
|
address,
|
||||||
|
@ -88,8 +90,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
|
||||||
static void
|
static void
|
||||||
m2_print_long_set (struct type *type, const gdb_byte *valaddr,
|
m2_print_long_set (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream)
|
||||||
enum val_prettyprint pretty)
|
|
||||||
{
|
{
|
||||||
int empty_set = 1;
|
int empty_set = 1;
|
||||||
int element_seen = 0;
|
int element_seen = 0;
|
||||||
|
@ -184,9 +185,8 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
|
||||||
static void
|
static void
|
||||||
m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
|
m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, enum val_prettyprint pretty,
|
const struct value_print_options *options)
|
||||||
int recurse)
|
|
||||||
{
|
{
|
||||||
struct type *content_type;
|
struct type *content_type;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
@ -207,26 +207,27 @@ m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
|
||||||
fprintf_filtered (stream, "{");
|
fprintf_filtered (stream, "{");
|
||||||
m2_print_array_contents (value_type (val), value_contents(val),
|
m2_print_array_contents (value_type (val), value_contents(val),
|
||||||
value_embedded_offset (val), addr, stream,
|
value_embedded_offset (val), addr, stream,
|
||||||
format, deref_ref, pretty, recurse, len);
|
recurse, options, len);
|
||||||
fprintf_filtered (stream, ", HIGH = %d}", (int) len);
|
fprintf_filtered (stream, ", HIGH = %d}", (int) len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
print_unpacked_pointer (struct type *type,
|
print_unpacked_pointer (struct type *type,
|
||||||
CORE_ADDR address, CORE_ADDR addr,
|
CORE_ADDR address, CORE_ADDR addr,
|
||||||
int format, struct ui_file *stream)
|
const struct value_print_options *options,
|
||||||
|
struct ui_file *stream)
|
||||||
{
|
{
|
||||||
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
|
|
||||||
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
|
||||||
{
|
{
|
||||||
/* Try to print what function it points to. */
|
/* Try to print what function it points to. */
|
||||||
print_function_pointer_address (addr, stream);
|
print_function_pointer_address (addr, stream, options->addressprint);
|
||||||
/* Return value is irrelevant except for string pointers. */
|
/* Return value is irrelevant except for string pointers. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint && format != 's')
|
if (options->addressprint && options->format != 's')
|
||||||
fputs_filtered (paddress (address), stream);
|
fputs_filtered (paddress (address), stream);
|
||||||
|
|
||||||
/* For a pointer to char or unsigned char, also print the string
|
/* For a pointer to char or unsigned char, also print the string
|
||||||
|
@ -234,9 +235,9 @@ print_unpacked_pointer (struct type *type,
|
||||||
|
|
||||||
if (TYPE_LENGTH (elttype) == 1
|
if (TYPE_LENGTH (elttype) == 1
|
||||||
&& TYPE_CODE (elttype) == TYPE_CODE_INT
|
&& TYPE_CODE (elttype) == TYPE_CODE_INT
|
||||||
&& (format == 0 || format == 's')
|
&& (options->format == 0 || options->format == 's')
|
||||||
&& addr != 0)
|
&& addr != 0)
|
||||||
return val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
|
return val_print_string (addr, -1, TYPE_LENGTH (elttype), stream, options);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -244,9 +245,9 @@ print_unpacked_pointer (struct type *type,
|
||||||
static void
|
static void
|
||||||
print_variable_at_address (struct type *type,
|
print_variable_at_address (struct type *type,
|
||||||
const gdb_byte *valaddr,
|
const gdb_byte *valaddr,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream,
|
||||||
int deref_ref, int recurse,
|
int recurse,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = unpack_pointer (type, valaddr);
|
CORE_ADDR addr = unpack_pointer (type, valaddr);
|
||||||
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
|
@ -259,8 +260,7 @@ print_variable_at_address (struct type *type,
|
||||||
{
|
{
|
||||||
struct value *deref_val =
|
struct value *deref_val =
|
||||||
value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
|
value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
|
||||||
common_val_print (deref_val, stream, format, deref_ref,
|
common_val_print (deref_val, stream, recurse, options, current_language);
|
||||||
recurse, pretty, current_language);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("???", stream);
|
fputs_filtered ("???", stream);
|
||||||
|
@ -276,9 +276,9 @@ print_variable_at_address (struct type *type,
|
||||||
static void
|
static void
|
||||||
m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
int deref_ref, int recurse, int len)
|
int len)
|
||||||
{
|
{
|
||||||
int eltlen;
|
int eltlen;
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
|
@ -286,21 +286,20 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
||||||
if (TYPE_LENGTH (type) > 0)
|
if (TYPE_LENGTH (type) > 0)
|
||||||
{
|
{
|
||||||
eltlen = TYPE_LENGTH (type);
|
eltlen = TYPE_LENGTH (type);
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
/* For an array of chars, print with string syntax. */
|
/* For an array of chars, print with string syntax. */
|
||||||
if (eltlen == 1 &&
|
if (eltlen == 1 &&
|
||||||
((TYPE_CODE (type) == TYPE_CODE_INT)
|
((TYPE_CODE (type) == TYPE_CODE_INT)
|
||||||
|| ((current_language->la_language == language_m2)
|
|| ((current_language->la_language == language_m2)
|
||||||
&& (TYPE_CODE (type) == TYPE_CODE_CHAR)))
|
&& (TYPE_CODE (type) == TYPE_CODE_CHAR)))
|
||||||
&& (format == 0 || format == 's'))
|
&& (options->format == 0 || options->format == 's'))
|
||||||
val_print_string (address, len+1, eltlen, stream);
|
val_print_string (address, len+1, eltlen, stream, options);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "{");
|
fprintf_filtered (stream, "{");
|
||||||
val_print_array_elements (type, valaddr + embedded_offset,
|
val_print_array_elements (type, valaddr + embedded_offset,
|
||||||
address, stream, format,
|
address, stream, recurse, options, 0);
|
||||||
deref_ref, recurse, pretty, 0);
|
|
||||||
fprintf_filtered (stream, "}");
|
fprintf_filtered (stream, "}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,21 +308,15 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
target byte order.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed. */
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
CORE_ADDR address, struct ui_file *stream, int format,
|
CORE_ADDR address, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i = 0; /* Number of characters printed */
|
unsigned int i = 0; /* Number of characters printed */
|
||||||
unsigned len;
|
unsigned len;
|
||||||
|
@ -343,74 +336,73 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
eltlen = TYPE_LENGTH (elttype);
|
eltlen = TYPE_LENGTH (elttype);
|
||||||
len = TYPE_LENGTH (type) / eltlen;
|
len = TYPE_LENGTH (type) / eltlen;
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
/* For an array of chars, print with string syntax. */
|
/* For an array of chars, print with string syntax. */
|
||||||
if (eltlen == 1 &&
|
if (eltlen == 1 &&
|
||||||
((TYPE_CODE (elttype) == TYPE_CODE_INT)
|
((TYPE_CODE (elttype) == TYPE_CODE_INT)
|
||||||
|| ((current_language->la_language == language_m2)
|
|| ((current_language->la_language == language_m2)
|
||||||
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
|
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
|
||||||
&& (format == 0 || format == 's'))
|
&& (options->format == 0 || options->format == 's'))
|
||||||
{
|
{
|
||||||
/* If requested, look for the first null char and only print
|
/* If requested, look for the first null char and only print
|
||||||
elements up to it. */
|
elements up to it. */
|
||||||
if (stop_print_at_null)
|
if (options->stop_print_at_null)
|
||||||
{
|
{
|
||||||
unsigned int temp_len;
|
unsigned int temp_len;
|
||||||
|
|
||||||
/* Look for a NULL char. */
|
/* Look for a NULL char. */
|
||||||
for (temp_len = 0;
|
for (temp_len = 0;
|
||||||
(valaddr + embedded_offset)[temp_len]
|
(valaddr + embedded_offset)[temp_len]
|
||||||
&& temp_len < len && temp_len < print_max;
|
&& temp_len < len && temp_len < options->print_max;
|
||||||
temp_len++);
|
temp_len++);
|
||||||
len = temp_len;
|
len = temp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
|
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0,
|
||||||
|
options);
|
||||||
i = len;
|
i = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "{");
|
fprintf_filtered (stream, "{");
|
||||||
val_print_array_elements (type, valaddr + embedded_offset,
|
val_print_array_elements (type, valaddr + embedded_offset,
|
||||||
address, stream, format, deref_ref,
|
address, stream, recurse, options, 0);
|
||||||
recurse, pretty, 0);
|
|
||||||
fprintf_filtered (stream, "}");
|
fprintf_filtered (stream, "}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Array of unspecified length: treat like pointer to first elt. */
|
/* Array of unspecified length: treat like pointer to first elt. */
|
||||||
print_unpacked_pointer (type, address, address, format, stream);
|
print_unpacked_pointer (type, address, address, options, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
if (TYPE_CONST (type))
|
if (TYPE_CONST (type))
|
||||||
print_variable_at_address (type, valaddr + embedded_offset,
|
print_variable_at_address (type, valaddr + embedded_offset,
|
||||||
stream, format, deref_ref, recurse,
|
stream, recurse, options);
|
||||||
pretty);
|
else if (options->format && options->format != 's')
|
||||||
else if (format && format != 's')
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format,
|
options, 0, stream);
|
||||||
0, stream);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addr = unpack_pointer (type, valaddr + embedded_offset);
|
addr = unpack_pointer (type, valaddr + embedded_offset);
|
||||||
print_unpacked_pointer (type, addr, address, format, stream);
|
print_unpacked_pointer (type, addr, address, options, stream);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_REF:
|
case TYPE_CODE_REF:
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= extract_typed_address (valaddr + embedded_offset, type);
|
= extract_typed_address (valaddr + embedded_offset, type);
|
||||||
fprintf_filtered (stream, "@");
|
fprintf_filtered (stream, "@");
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
fputs_filtered (": ", stream);
|
fputs_filtered (": ", stream);
|
||||||
}
|
}
|
||||||
/* De-reference the reference. */
|
/* De-reference the reference. */
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
||||||
{
|
{
|
||||||
|
@ -418,8 +410,8 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
value_at
|
value_at
|
||||||
(TYPE_TARGET_TYPE (type),
|
(TYPE_TARGET_TYPE (type),
|
||||||
unpack_pointer (type, valaddr + embedded_offset));
|
unpack_pointer (type, valaddr + embedded_offset));
|
||||||
common_val_print (deref_val, stream, format, deref_ref,
|
common_val_print (deref_val, stream, recurse, options,
|
||||||
recurse, pretty, current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("???", stream);
|
fputs_filtered ("???", stream);
|
||||||
|
@ -427,7 +419,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_UNION:
|
case TYPE_CODE_UNION:
|
||||||
if (recurse && !unionprint)
|
if (recurse && !options->unionprint)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "{...}");
|
fprintf_filtered (stream, "{...}");
|
||||||
break;
|
break;
|
||||||
|
@ -436,22 +428,20 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
if (m2_is_long_set (type))
|
if (m2_is_long_set (type))
|
||||||
m2_print_long_set (type, valaddr, embedded_offset, address,
|
m2_print_long_set (type, valaddr, embedded_offset, address,
|
||||||
stream, format, pretty);
|
stream);
|
||||||
else if (m2_is_unbounded_array (type))
|
else if (m2_is_unbounded_array (type))
|
||||||
m2_print_unbounded_array (type, valaddr, embedded_offset,
|
m2_print_unbounded_array (type, valaddr, embedded_offset,
|
||||||
address, stream, format, deref_ref,
|
address, stream, recurse, options);
|
||||||
pretty, recurse);
|
|
||||||
else
|
else
|
||||||
cp_print_value_fields (type, type, valaddr, embedded_offset,
|
cp_print_value_fields (type, type, valaddr, embedded_offset,
|
||||||
address, stream, format,
|
address, stream, recurse, options, NULL, 0);
|
||||||
recurse, pretty, NULL, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type,
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
format, 0, stream);
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = TYPE_NFIELDS (type);
|
len = TYPE_NFIELDS (type);
|
||||||
|
@ -475,10 +465,10 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FUNC:
|
case TYPE_CODE_FUNC:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type,
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
format, 0, stream);
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
||||||
|
@ -491,10 +481,14 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_BOOL:
|
case TYPE_CODE_BOOL:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type,
|
struct value_print_options opts = *options;
|
||||||
format, 0, stream);
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = unpack_long (type, valaddr + embedded_offset);
|
val = unpack_long (type, valaddr + embedded_offset);
|
||||||
|
@ -511,7 +505,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
|
if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
|
||||||
{
|
{
|
||||||
m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset,
|
m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset,
|
||||||
address, stream, format, deref_ref, recurse, pretty);
|
address, stream, recurse, options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FIXME: create_range_type does not set the unsigned bit in a
|
/* FIXME: create_range_type does not set the unsigned bit in a
|
||||||
|
@ -524,19 +518,27 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case TYPE_CODE_INT:
|
case TYPE_CODE_INT:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format,
|
struct value_print_options opts = *options;
|
||||||
0, stream);
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
val_print_type_code_int (type, valaddr + embedded_offset, stream);
|
val_print_type_code_int (type, valaddr + embedded_offset, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_CHAR:
|
case TYPE_CODE_CHAR:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type,
|
struct value_print_options opts = *options;
|
||||||
format, 0, stream);
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = unpack_long (type, valaddr + embedded_offset);
|
val = unpack_long (type, valaddr + embedded_offset);
|
||||||
|
@ -550,9 +552,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLT:
|
case TYPE_CODE_FLT:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type,
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
format, 0, stream);
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
print_floating (valaddr + embedded_offset, type, stream);
|
print_floating (valaddr + embedded_offset, type, stream);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "dictionary.h"
|
#include "dictionary.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
|
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
|
||||||
|
|
||||||
|
@ -280,21 +281,29 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
|
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
val = read_var_value (sym2, fi);
|
val = read_var_value (sym2, fi);
|
||||||
|
get_raw_print_options (&opts);
|
||||||
|
opts.deref_ref = 1;
|
||||||
common_val_print
|
common_val_print
|
||||||
(val, stb->stream, 0, 1, 0, Val_no_prettyprint,
|
(val, stb->stream, 0, &opts,
|
||||||
language_def (SYMBOL_LANGUAGE (sym2)));
|
language_def (SYMBOL_LANGUAGE (sym2)));
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
}
|
}
|
||||||
do_cleanups (cleanup_tuple);
|
do_cleanups (cleanup_tuple);
|
||||||
break;
|
break;
|
||||||
case PRINT_ALL_VALUES:
|
case PRINT_ALL_VALUES:
|
||||||
val = read_var_value (sym2, fi);
|
{
|
||||||
common_val_print
|
struct value_print_options opts;
|
||||||
(val, stb->stream, 0, 1, 0, Val_no_prettyprint,
|
val = read_var_value (sym2, fi);
|
||||||
language_def (SYMBOL_LANGUAGE (sym2)));
|
get_raw_print_options (&opts);
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
opts.deref_ref = 1;
|
||||||
do_cleanups (cleanup_tuple);
|
common_val_print
|
||||||
|
(val, stb->stream, 0, &opts,
|
||||||
|
language_def (SYMBOL_LANGUAGE (sym2)));
|
||||||
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
|
do_cleanups (cleanup_tuple);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "mi-main.h"
|
#include "mi-main.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -499,9 +500,11 @@ get_register (int regnum, int format)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (current_gdbarch, regnum), buffer, 0, 0,
|
val_print (register_type (current_gdbarch, regnum), buffer, 0, 0,
|
||||||
stb->stream, format, 1, 0, Val_pretty_default,
|
stb->stream, 0, &opts, current_language);
|
||||||
current_language);
|
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
ui_out_stream_delete (stb);
|
ui_out_stream_delete (stb);
|
||||||
}
|
}
|
||||||
|
@ -570,6 +573,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||||
struct cleanup *old_chain = NULL;
|
struct cleanup *old_chain = NULL;
|
||||||
struct value *val;
|
struct value *val;
|
||||||
struct ui_stream *stb = NULL;
|
struct ui_stream *stb = NULL;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
stb = ui_out_stream_new (uiout);
|
stb = ui_out_stream_new (uiout);
|
||||||
|
|
||||||
|
@ -586,9 +590,11 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||||
val = evaluate_expression (expr);
|
val = evaluate_expression (expr);
|
||||||
|
|
||||||
/* Print the result of the expression evaluation. */
|
/* Print the result of the expression evaluation. */
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
opts.deref_ref = 0;
|
||||||
val_print (value_type (val), value_contents (val),
|
val_print (value_type (val), value_contents (val),
|
||||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||||
stb->stream, 0, 0, 0, 0, current_language);
|
stb->stream, 0, &opts, current_language);
|
||||||
|
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
ui_out_stream_delete (stb);
|
ui_out_stream_delete (stb);
|
||||||
|
@ -743,10 +749,13 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
int col_byte;
|
int col_byte;
|
||||||
struct cleanup *cleanup_tuple;
|
struct cleanup *cleanup_tuple;
|
||||||
struct cleanup *cleanup_list_data;
|
struct cleanup *cleanup_list_data;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
|
cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
|
||||||
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
|
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
|
||||||
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
|
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
|
||||||
cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data");
|
cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data");
|
||||||
|
get_formatted_print_options (&opts, word_format);
|
||||||
for (col = 0, col_byte = row_byte;
|
for (col = 0, col_byte = row_byte;
|
||||||
col < nr_cols;
|
col < nr_cols;
|
||||||
col++, col_byte += word_size)
|
col++, col_byte += word_size)
|
||||||
|
@ -758,7 +767,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui_file_rewind (stream->stream);
|
ui_file_rewind (stream->stream);
|
||||||
print_scalar_formatted (mbuf + col_byte, word_type, word_format,
|
print_scalar_formatted (mbuf + col_byte, word_type, &opts,
|
||||||
word_asize, stream->stream);
|
word_asize, stream->stream);
|
||||||
ui_out_field_stream (uiout, NULL, stream);
|
ui_out_field_stream (uiout, NULL, stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include "target-descriptions.h"
|
#include "target-descriptions.h"
|
||||||
#include "dwarf2-frame.h"
|
#include "dwarf2-frame.h"
|
||||||
#include "user-regs.h"
|
#include "user-regs.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
static const struct objfile_data *mips_pdr_data;
|
static const struct objfile_data *mips_pdr_data;
|
||||||
|
|
||||||
|
@ -4378,12 +4379,15 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
|
||||||
|
|
||||||
if (register_size (gdbarch, regnum) == 4 || mips2_fp_compat (frame))
|
if (register_size (gdbarch, regnum) == 4 || mips2_fp_compat (frame))
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* 4-byte registers: Print hex and floating. Also print even
|
/* 4-byte registers: Print hex and floating. Also print even
|
||||||
numbered registers as doubles. */
|
numbered registers as doubles. */
|
||||||
mips_read_fp_register_single (frame, regnum, raw_buffer);
|
mips_read_fp_register_single (frame, regnum, raw_buffer);
|
||||||
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
|
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
|
||||||
|
|
||||||
print_scalar_formatted (raw_buffer, builtin_type_uint32, 'x', 'w',
|
get_formatted_print_options (&opts, 'x');
|
||||||
|
print_scalar_formatted (raw_buffer, builtin_type_uint32, &opts, 'w',
|
||||||
file);
|
file);
|
||||||
|
|
||||||
fprintf_filtered (file, " flt: ");
|
fprintf_filtered (file, " flt: ");
|
||||||
|
@ -4407,6 +4411,8 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* Eight byte registers: print each one as hex, float and double. */
|
/* Eight byte registers: print each one as hex, float and double. */
|
||||||
mips_read_fp_register_single (frame, regnum, raw_buffer);
|
mips_read_fp_register_single (frame, regnum, raw_buffer);
|
||||||
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
|
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
|
||||||
|
@ -4414,8 +4420,8 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
|
||||||
mips_read_fp_register_double (frame, regnum, raw_buffer);
|
mips_read_fp_register_double (frame, regnum, raw_buffer);
|
||||||
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
|
doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
|
||||||
|
|
||||||
|
get_formatted_print_options (&opts, 'x');
|
||||||
print_scalar_formatted (raw_buffer, builtin_type_uint64, 'x', 'g',
|
print_scalar_formatted (raw_buffer, builtin_type_uint64, &opts, 'g',
|
||||||
file);
|
file);
|
||||||
|
|
||||||
fprintf_filtered (file, " flt: ");
|
fprintf_filtered (file, " flt: ");
|
||||||
|
@ -4439,6 +4445,7 @@ mips_print_register (struct ui_file *file, struct frame_info *frame,
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
|
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
|
||||||
int offset;
|
int offset;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
if (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
|
if (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
|
||||||
{
|
{
|
||||||
|
@ -4471,8 +4478,9 @@ mips_print_register (struct ui_file *file, struct frame_info *frame,
|
||||||
else
|
else
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
|
get_formatted_print_options (&opts, 'x');
|
||||||
print_scalar_formatted (raw_buffer + offset,
|
print_scalar_formatted (raw_buffer + offset,
|
||||||
register_type (gdbarch, regnum), 'x', 0,
|
register_type (gdbarch, regnum), &opts, 0,
|
||||||
file);
|
file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "infcall.h"
|
#include "infcall.h"
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
enum mt_arch_constants
|
enum mt_arch_constants
|
||||||
{
|
{
|
||||||
|
@ -675,6 +676,7 @@ mt_registers_info (struct gdbarch *gdbarch,
|
||||||
{
|
{
|
||||||
/* Special output handling for the 'coprocessor' register. */
|
/* Special output handling for the 'coprocessor' register. */
|
||||||
gdb_byte *buf;
|
gdb_byte *buf;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
buf = alloca (register_size (gdbarch, MT_COPRO_REGNUM));
|
buf = alloca (register_size (gdbarch, MT_COPRO_REGNUM));
|
||||||
frame_register_read (frame, MT_COPRO_REGNUM, buf);
|
frame_register_read (frame, MT_COPRO_REGNUM, buf);
|
||||||
|
@ -685,8 +687,10 @@ mt_registers_info (struct gdbarch *gdbarch,
|
||||||
print_spaces_filtered (15 - strlen (gdbarch_register_name
|
print_spaces_filtered (15 - strlen (gdbarch_register_name
|
||||||
(gdbarch, regnum)),
|
(gdbarch, regnum)),
|
||||||
file);
|
file);
|
||||||
|
get_raw_print_options (&opts);
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, regnum), buf,
|
val_print (register_type (gdbarch, regnum), buf,
|
||||||
0, 0, file, 0, 1, 0, Val_no_prettyprint,
|
0, 0, file, 0, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
fputs_filtered ("\n", file);
|
fputs_filtered ("\n", file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,8 @@ objc_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -360,7 +361,7 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; ++i)
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining to see whether it
|
/* Position of the character we are examining to see whether it
|
||||||
is repeated. */
|
is repeated. */
|
||||||
|
@ -384,11 +385,11 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
++reps;
|
++reps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\", ", stream);
|
fputs_filtered ("\\\", ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\", ", stream);
|
fputs_filtered ("\", ", stream);
|
||||||
|
@ -397,14 +398,14 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
objc_printchar (string[i], stream);
|
objc_printchar (string[i], stream);
|
||||||
fprintf_filtered (stream, " <repeats %u times>", reps);
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!in_quotes)
|
if (!in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
@ -418,7 +419,7 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\\"", stream);
|
fputs_filtered ("\\\"", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
|
|
15
gdb/p-lang.c
15
gdb/p-lang.c
|
@ -207,7 +207,8 @@ pascal_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
void
|
void
|
||||||
pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -226,7 +227,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length && things_printed < print_max; ++i)
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
||||||
{
|
{
|
||||||
/* Position of the character we are examining
|
/* Position of the character we are examining
|
||||||
to see whether it is repeated. */
|
to see whether it is repeated. */
|
||||||
|
@ -250,11 +251,11 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
++reps;
|
++reps;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\', ", stream);
|
fputs_filtered ("\\', ", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("', ", stream);
|
fputs_filtered ("', ", stream);
|
||||||
|
@ -263,7 +264,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
pascal_printchar (string[i], stream);
|
pascal_printchar (string[i], stream);
|
||||||
fprintf_filtered (stream, " <repeats %u times>", reps);
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
need_comma = 1;
|
need_comma = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -271,7 +272,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
int c = string[i];
|
int c = string[i];
|
||||||
if ((!in_quotes) && (PRINT_LITERAL_FORM (c)))
|
if ((!in_quotes) && (PRINT_LITERAL_FORM (c)))
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\'", stream);
|
fputs_filtered ("\\'", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
|
@ -285,7 +286,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
/* Terminate the quotes if necessary. */
|
/* Terminate the quotes if necessary. */
|
||||||
if (in_quotes)
|
if (in_quotes)
|
||||||
{
|
{
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
fputs_filtered ("\\'", stream);
|
fputs_filtered ("\\'", stream);
|
||||||
else
|
else
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
|
|
19
gdb/p-lang.h
19
gdb/p-lang.h
|
@ -35,10 +35,11 @@ extern void pascal_print_typedef (struct type *, struct symbol *,
|
||||||
struct ui_file *);
|
struct ui_file *);
|
||||||
|
|
||||||
extern int pascal_val_print (struct type *, const gdb_byte *, int,
|
extern int pascal_val_print (struct type *, const gdb_byte *, int,
|
||||||
CORE_ADDR, struct ui_file *, int, int,
|
CORE_ADDR, struct ui_file *, int,
|
||||||
int, enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int pascal_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
|
extern int pascal_value_print (struct value *, struct ui_file *,
|
||||||
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern void pascal_type_print_method_args (char *, char *,
|
extern void pascal_type_print_method_args (char *, char *,
|
||||||
struct ui_file *);
|
struct ui_file *);
|
||||||
|
@ -51,7 +52,8 @@ extern int
|
||||||
extern void pascal_printchar (int, struct ui_file *);
|
extern void pascal_printchar (int, struct ui_file *);
|
||||||
|
|
||||||
extern void pascal_printstr (struct ui_file *, const gdb_byte *,
|
extern void pascal_printstr (struct ui_file *, const gdb_byte *,
|
||||||
unsigned int, int, int);
|
unsigned int, int, int,
|
||||||
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern struct type **const (pascal_builtin_types[]);
|
extern struct type **const (pascal_builtin_types[]);
|
||||||
|
|
||||||
|
@ -63,15 +65,10 @@ extern void
|
||||||
extern void
|
extern void
|
||||||
pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
|
pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
|
||||||
|
|
||||||
/* These are in cp-valprint.c */
|
|
||||||
|
|
||||||
extern int vtblprint; /* Controls printing of vtbl's */
|
|
||||||
|
|
||||||
extern int static_field_print;
|
|
||||||
|
|
||||||
extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
|
extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
|
||||||
CORE_ADDR, struct ui_file *,
|
CORE_ADDR, struct ui_file *,
|
||||||
int, int, enum val_prettyprint,
|
int,
|
||||||
|
const struct value_print_options *,
|
||||||
struct type **, int);
|
struct type **, int);
|
||||||
|
|
||||||
extern int pascal_object_is_vtbl_ptr_type (struct type *);
|
extern int pascal_object_is_vtbl_ptr_type (struct type *);
|
||||||
|
|
203
gdb/p-valprint.c
203
gdb/p-valprint.c
|
@ -44,23 +44,17 @@
|
||||||
|
|
||||||
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
/* Print data of type TYPE located at VALADDR (within GDB), which came from
|
||||||
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
the inferior at address ADDRESS, onto stdio stream STREAM according to
|
||||||
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
|
OPTIONS. The data at VALADDR is in target byte order.
|
||||||
target byte order.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed. */
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting. */
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int deref_ref,
|
struct ui_file *stream, int recurse,
|
||||||
int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int i = 0; /* Number of characters printed */
|
unsigned int i = 0; /* Number of characters printed */
|
||||||
unsigned len;
|
unsigned len;
|
||||||
|
@ -80,7 +74,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
eltlen = TYPE_LENGTH (elttype);
|
eltlen = TYPE_LENGTH (elttype);
|
||||||
len = TYPE_LENGTH (type) / eltlen;
|
len = TYPE_LENGTH (type) / eltlen;
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
{
|
{
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
}
|
}
|
||||||
|
@ -89,23 +83,24 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
&& ((TYPE_CODE (elttype) == TYPE_CODE_INT)
|
&& ((TYPE_CODE (elttype) == TYPE_CODE_INT)
|
||||||
|| ((current_language->la_language == language_pascal)
|
|| ((current_language->la_language == language_pascal)
|
||||||
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
|
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
|
||||||
&& (format == 0 || format == 's'))
|
&& (options->format == 0 || options->format == 's'))
|
||||||
{
|
{
|
||||||
/* If requested, look for the first null char and only print
|
/* If requested, look for the first null char and only print
|
||||||
elements up to it. */
|
elements up to it. */
|
||||||
if (stop_print_at_null)
|
if (options->stop_print_at_null)
|
||||||
{
|
{
|
||||||
unsigned int temp_len;
|
unsigned int temp_len;
|
||||||
|
|
||||||
/* Look for a NULL char. */
|
/* Look for a NULL char. */
|
||||||
for (temp_len = 0;
|
for (temp_len = 0;
|
||||||
(valaddr + embedded_offset)[temp_len]
|
(valaddr + embedded_offset)[temp_len]
|
||||||
&& temp_len < len && temp_len < print_max;
|
&& temp_len < len && temp_len < options->print_max;
|
||||||
temp_len++);
|
temp_len++);
|
||||||
len = temp_len;
|
len = temp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
|
LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0,
|
||||||
|
options);
|
||||||
i = len;
|
i = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -123,7 +118,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
val_print_array_elements (type, valaddr + embedded_offset, address, stream,
|
||||||
format, deref_ref, recurse, pretty, i);
|
recurse, options, i);
|
||||||
fprintf_filtered (stream, "}");
|
fprintf_filtered (stream, "}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -133,12 +128,13 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
goto print_unpacked_pointer;
|
goto print_unpacked_pointer;
|
||||||
|
|
||||||
case TYPE_CODE_PTR:
|
case TYPE_CODE_PTR:
|
||||||
if (format && format != 's')
|
if (options->format && options->format != 's')
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
||||||
{
|
{
|
||||||
/* Print the unmangled name if desired. */
|
/* Print the unmangled name if desired. */
|
||||||
/* Print vtable entry - we only get here if we ARE using
|
/* Print vtable entry - we only get here if we ARE using
|
||||||
|
@ -162,7 +158,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressprint && format != 's')
|
if (options->addressprint && options->format != 's')
|
||||||
{
|
{
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
}
|
}
|
||||||
|
@ -172,11 +168,11 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
if (TYPE_LENGTH (elttype) == 1
|
if (TYPE_LENGTH (elttype) == 1
|
||||||
&& (TYPE_CODE (elttype) == TYPE_CODE_INT
|
&& (TYPE_CODE (elttype) == TYPE_CODE_INT
|
||||||
|| TYPE_CODE(elttype) == TYPE_CODE_CHAR)
|
|| TYPE_CODE(elttype) == TYPE_CODE_CHAR)
|
||||||
&& (format == 0 || format == 's')
|
&& (options->format == 0 || options->format == 's')
|
||||||
&& addr != 0)
|
&& addr != 0)
|
||||||
{
|
{
|
||||||
/* no wide string yet */
|
/* no wide string yet */
|
||||||
i = val_print_string (addr, -1, 1, stream);
|
i = val_print_string (addr, -1, 1, stream, options);
|
||||||
}
|
}
|
||||||
/* also for pointers to pascal strings */
|
/* also for pointers to pascal strings */
|
||||||
/* Note: this is Free Pascal specific:
|
/* Note: this is Free Pascal specific:
|
||||||
|
@ -193,7 +189,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
read_memory (addr + length_pos, buffer, length_size);
|
read_memory (addr + length_pos, buffer, length_size);
|
||||||
string_length = extract_unsigned_integer (buffer, length_size);
|
string_length = extract_unsigned_integer (buffer, length_size);
|
||||||
xfree (buffer);
|
xfree (buffer);
|
||||||
i = val_print_string (addr + string_pos, string_length, char_size, stream);
|
i = val_print_string (addr + string_pos, string_length, char_size, stream, options);
|
||||||
}
|
}
|
||||||
else if (pascal_object_is_vtbl_member (type))
|
else if (pascal_object_is_vtbl_member (type))
|
||||||
{
|
{
|
||||||
|
@ -209,7 +205,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
|
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
|
||||||
fputs_filtered (">", stream);
|
fputs_filtered (">", stream);
|
||||||
}
|
}
|
||||||
if (vt_address && vtblprint)
|
if (vt_address && options->vtblprint)
|
||||||
{
|
{
|
||||||
struct value *vt_val;
|
struct value *vt_val;
|
||||||
struct symbol *wsym = (struct symbol *) NULL;
|
struct symbol *wsym = (struct symbol *) NULL;
|
||||||
|
@ -230,9 +226,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
wtype = TYPE_TARGET_TYPE (type);
|
wtype = TYPE_TARGET_TYPE (type);
|
||||||
}
|
}
|
||||||
vt_val = value_at (wtype, vt_address);
|
vt_val = value_at (wtype, vt_address);
|
||||||
common_val_print (vt_val, stream, format, deref_ref,
|
common_val_print (vt_val, stream, recurse + 1, options,
|
||||||
recurse + 1, pretty, current_language);
|
current_language);
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -249,18 +245,18 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
case TYPE_CODE_REF:
|
case TYPE_CODE_REF:
|
||||||
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
elttype = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "@");
|
fprintf_filtered (stream, "@");
|
||||||
/* Extract the address, assume that it is unsigned. */
|
/* Extract the address, assume that it is unsigned. */
|
||||||
fputs_filtered (paddress (
|
fputs_filtered (paddress (
|
||||||
extract_unsigned_integer (valaddr + embedded_offset,
|
extract_unsigned_integer (valaddr + embedded_offset,
|
||||||
gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
|
gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
fputs_filtered (": ", stream);
|
fputs_filtered (": ", stream);
|
||||||
}
|
}
|
||||||
/* De-reference the reference. */
|
/* De-reference the reference. */
|
||||||
if (deref_ref)
|
if (options->deref_ref)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
|
||||||
{
|
{
|
||||||
|
@ -268,8 +264,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
value_at
|
value_at
|
||||||
(TYPE_TARGET_TYPE (type),
|
(TYPE_TARGET_TYPE (type),
|
||||||
unpack_pointer (type, valaddr + embedded_offset));
|
unpack_pointer (type, valaddr + embedded_offset));
|
||||||
common_val_print (deref_val, stream, format, deref_ref,
|
common_val_print (deref_val, stream, recurse + 1, options,
|
||||||
recurse + 1, pretty, current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fputs_filtered ("???", stream);
|
fputs_filtered ("???", stream);
|
||||||
|
@ -277,14 +273,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_UNION:
|
case TYPE_CODE_UNION:
|
||||||
if (recurse && !unionprint)
|
if (recurse && !options->unionprint)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "{...}");
|
fprintf_filtered (stream, "{...}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
|
||||||
{
|
{
|
||||||
/* Print the unmangled name if desired. */
|
/* Print the unmangled name if desired. */
|
||||||
/* Print vtable entry - we only get here if NOT using
|
/* Print vtable entry - we only get here if NOT using
|
||||||
|
@ -301,18 +297,19 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
&string_pos, &char_size, NULL))
|
&string_pos, &char_size, NULL))
|
||||||
{
|
{
|
||||||
len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
|
len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
|
||||||
LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0);
|
LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0, options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream, format,
|
pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream,
|
||||||
recurse, pretty, NULL, 0);
|
recurse, options, NULL, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = TYPE_NFIELDS (type);
|
len = TYPE_NFIELDS (type);
|
||||||
|
@ -336,16 +333,18 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLAGS:
|
case TYPE_CODE_FLAGS:
|
||||||
if (format)
|
if (options->format)
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
else
|
else
|
||||||
val_print_type_code_flags (type, valaddr + embedded_offset, stream);
|
val_print_type_code_flags (type, valaddr + embedded_offset, stream);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FUNC:
|
case TYPE_CODE_FUNC:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
/* FIXME, we should consider, at least for ANSI C language, eliminating
|
||||||
|
@ -358,9 +357,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_BOOL:
|
case TYPE_CODE_BOOL:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = unpack_long (type, valaddr + embedded_offset);
|
val = unpack_long (type, valaddr + embedded_offset);
|
||||||
|
@ -387,10 +391,13 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case TYPE_CODE_INT:
|
case TYPE_CODE_INT:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -399,10 +406,13 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_CHAR:
|
case TYPE_CODE_CHAR:
|
||||||
format = format ? format : output_format;
|
if (options->format || options->output_format)
|
||||||
if (format)
|
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = (options->format ? options->format
|
||||||
|
: options->output_format);
|
||||||
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
&opts, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -417,9 +427,10 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_FLT:
|
case TYPE_CODE_FLT:
|
||||||
if (format)
|
if (options->format)
|
||||||
{
|
{
|
||||||
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
|
print_scalar_formatted (valaddr + embedded_offset, type,
|
||||||
|
options, 0, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -517,8 +528,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pascal_value_print (struct value *val, struct ui_file *stream, int format,
|
pascal_value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *type = value_type (val);
|
struct type *type = value_type (val);
|
||||||
|
|
||||||
|
@ -547,19 +558,10 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
|
||||||
fprintf_filtered (stream, ") ");
|
fprintf_filtered (stream, ") ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return common_val_print (val, stream, format, 1, 0, pretty,
|
return common_val_print (val, stream, 0, options, current_language);
|
||||||
current_language);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
Inserted from cp-valprint
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
extern int vtblprint; /* Controls printing of vtbl's */
|
|
||||||
extern int objectprint; /* Controls looking up an object's derived type
|
|
||||||
using what we find in its vtables. */
|
|
||||||
static int pascal_static_field_print; /* Controls printing of static fields. */
|
|
||||||
static void
|
static void
|
||||||
show_pascal_static_field_print (struct ui_file *file, int from_tty,
|
show_pascal_static_field_print (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -572,12 +574,12 @@ static struct obstack dont_print_vb_obstack;
|
||||||
static struct obstack dont_print_statmem_obstack;
|
static struct obstack dont_print_statmem_obstack;
|
||||||
|
|
||||||
static void pascal_object_print_static_field (struct value *,
|
static void pascal_object_print_static_field (struct value *,
|
||||||
struct ui_file *, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
static void pascal_object_print_value (struct type *, const gdb_byte *,
|
static void pascal_object_print_value (struct type *, const gdb_byte *,
|
||||||
CORE_ADDR, struct ui_file *,
|
CORE_ADDR, struct ui_file *, int,
|
||||||
int, int, enum val_prettyprint,
|
const struct value_print_options *,
|
||||||
struct type **);
|
struct type **);
|
||||||
|
|
||||||
/* It was changed to this after 2.4.5. */
|
/* It was changed to this after 2.4.5. */
|
||||||
|
@ -624,7 +626,7 @@ pascal_object_is_vtbl_member (struct type *type)
|
||||||
c_val_print to print out a structure's fields:
|
c_val_print to print out a structure's fields:
|
||||||
pascal_object_print_value_fields and pascal_object_print_value.
|
pascal_object_print_value_fields and pascal_object_print_value.
|
||||||
|
|
||||||
TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
|
TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
|
||||||
same meanings as in pascal_object_print_value and c_val_print.
|
same meanings as in pascal_object_print_value and c_val_print.
|
||||||
|
|
||||||
DONT_PRINT is an array of baseclass types that we
|
DONT_PRINT is an array of baseclass types that we
|
||||||
|
@ -633,8 +635,8 @@ pascal_object_is_vtbl_member (struct type *type)
|
||||||
void
|
void
|
||||||
pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream,
|
CORE_ADDR address, struct ui_file *stream,
|
||||||
int format, int recurse,
|
int recurse,
|
||||||
enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
struct type **dont_print_vb,
|
struct type **dont_print_vb,
|
||||||
int dont_print_statmem)
|
int dont_print_statmem)
|
||||||
{
|
{
|
||||||
|
@ -651,7 +653,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
duplicates of virtual baseclasses. */
|
duplicates of virtual baseclasses. */
|
||||||
if (n_baseclasses > 0)
|
if (n_baseclasses > 0)
|
||||||
pascal_object_print_value (type, valaddr, address, stream,
|
pascal_object_print_value (type, valaddr, address, stream,
|
||||||
format, recurse + 1, pretty, dont_print_vb);
|
recurse + 1, options, dont_print_vb);
|
||||||
|
|
||||||
if (!len && n_baseclasses == 1)
|
if (!len && n_baseclasses == 1)
|
||||||
fprintf_filtered (stream, "<No data fields>");
|
fprintf_filtered (stream, "<No data fields>");
|
||||||
|
@ -671,14 +673,14 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
for (i = n_baseclasses; i < len; i++)
|
for (i = n_baseclasses; i < len; i++)
|
||||||
{
|
{
|
||||||
/* If requested, skip printing of static fields. */
|
/* If requested, skip printing of static fields. */
|
||||||
if (!pascal_static_field_print
|
if (!options->pascal_static_field_print
|
||||||
&& field_is_static (&TYPE_FIELD (type, i)))
|
&& field_is_static (&TYPE_FIELD (type, i)))
|
||||||
continue;
|
continue;
|
||||||
if (fields_seen)
|
if (fields_seen)
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
else if (n_baseclasses > 0)
|
else if (n_baseclasses > 0)
|
||||||
{
|
{
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -689,7 +691,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
fields_seen = 1;
|
fields_seen = 1;
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -698,7 +700,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
{
|
{
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
}
|
}
|
||||||
if (inspect_it)
|
if (options->inspect_it)
|
||||||
{
|
{
|
||||||
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
|
||||||
fputs_filtered ("\"( ptr \"", stream);
|
fputs_filtered ("\"( ptr \"", stream);
|
||||||
|
@ -742,11 +744,13 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts = *options;
|
||||||
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
|
||||||
unpack_field_as_long (type, valaddr, i));
|
unpack_field_as_long (type, valaddr, i));
|
||||||
|
|
||||||
common_val_print (v, stream, format, 0, recurse + 1,
|
opts.deref_ref = 0;
|
||||||
pretty, current_language);
|
common_val_print (v, stream, recurse + 1, &opts,
|
||||||
|
current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -765,11 +769,13 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
fputs_filtered ("<optimized out>", stream);
|
fputs_filtered ("<optimized out>", stream);
|
||||||
else
|
else
|
||||||
pascal_object_print_static_field (v, stream, format,
|
pascal_object_print_static_field (v, stream, recurse + 1,
|
||||||
recurse + 1, pretty);
|
options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
/* val_print (TYPE_FIELD_TYPE (type, i),
|
/* val_print (TYPE_FIELD_TYPE (type, i),
|
||||||
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
|
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
|
||||||
|
@ -777,7 +783,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
val_print (TYPE_FIELD_TYPE (type, i),
|
val_print (TYPE_FIELD_TYPE (type, i),
|
||||||
valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
|
valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
address + TYPE_FIELD_BITPOS (type, i) / 8,
|
||||||
stream, format, 0, recurse + 1, pretty,
|
stream, recurse + 1, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,7 +798,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
dont_print_statmem_obstack = tmp_obstack;
|
dont_print_statmem_obstack = tmp_obstack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -807,8 +813,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
|
||||||
static void
|
static void
|
||||||
pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream,
|
CORE_ADDR address, struct ui_file *stream,
|
||||||
int format, int recurse,
|
int recurse,
|
||||||
enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
struct type **dont_print_vb)
|
struct type **dont_print_vb)
|
||||||
{
|
{
|
||||||
struct type **last_dont_print
|
struct type **last_dont_print
|
||||||
|
@ -849,7 +855,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
boffset = baseclass_offset (type, i, valaddr, address);
|
boffset = baseclass_offset (type, i, valaddr, address);
|
||||||
|
|
||||||
if (pretty)
|
if (options->pretty)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\n");
|
fprintf_filtered (stream, "\n");
|
||||||
print_spaces_filtered (2 * recurse, stream);
|
print_spaces_filtered (2 * recurse, stream);
|
||||||
|
@ -881,7 +887,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||||
fprintf_filtered (stream, "<invalid address>");
|
fprintf_filtered (stream, "<invalid address>");
|
||||||
else
|
else
|
||||||
pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
|
pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
|
||||||
stream, format, recurse, pretty,
|
stream, recurse, options,
|
||||||
(struct type **) obstack_base (&dont_print_vb_obstack),
|
(struct type **) obstack_base (&dont_print_vb_obstack),
|
||||||
0);
|
0);
|
||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
|
@ -907,15 +913,17 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
|
||||||
static member classes in an obstack and refuse to print them more
|
static member classes in an obstack and refuse to print them more
|
||||||
than once.
|
than once.
|
||||||
|
|
||||||
VAL contains the value to print, STREAM, RECURSE, and PRETTY
|
VAL contains the value to print, STREAM, RECURSE, and OPTIONS
|
||||||
have the same meanings as in c_val_print. */
|
have the same meanings as in c_val_print. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pascal_object_print_static_field (struct value *val,
|
pascal_object_print_static_field (struct value *val,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream,
|
||||||
int recurse, enum val_prettyprint pretty)
|
int recurse,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct type *type = value_type (val);
|
struct type *type = value_type (val);
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
||||||
{
|
{
|
||||||
|
@ -942,11 +950,13 @@ pascal_object_print_static_field (struct value *val,
|
||||||
|
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
|
pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
|
||||||
stream, format, recurse, pretty, NULL, 1);
|
stream, recurse, options, NULL, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
common_val_print (val, stream, format, 0, recurse, pretty,
|
|
||||||
current_language);
|
opts = *options;
|
||||||
|
opts.deref_ref = 0;
|
||||||
|
common_val_print (val, stream, recurse, &opts, current_language);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */
|
extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */
|
||||||
|
@ -955,13 +965,10 @@ void
|
||||||
_initialize_pascal_valprint (void)
|
_initialize_pascal_valprint (void)
|
||||||
{
|
{
|
||||||
add_setshow_boolean_cmd ("pascal_static-members", class_support,
|
add_setshow_boolean_cmd ("pascal_static-members", class_support,
|
||||||
&pascal_static_field_print, _("\
|
&user_print_options.pascal_static_field_print, _("\
|
||||||
Set printing of pascal static members."), _("\
|
Set printing of pascal static members."), _("\
|
||||||
Show printing of pascal static members."), NULL,
|
Show printing of pascal static members."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_pascal_static_field_print,
|
show_pascal_static_field_print,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
/* Turn on printing of static fields. */
|
|
||||||
pascal_static_field_print = 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
104
gdb/printcmd.c
104
gdb/printcmd.c
|
@ -42,6 +42,7 @@
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "disasm.h"
|
#include "disasm.h"
|
||||||
#include "dfp.h"
|
#include "dfp.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
#include "tui/tui.h" /* For tui_active et.al. */
|
#include "tui/tui.h" /* For tui_active et.al. */
|
||||||
|
@ -55,7 +56,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
|
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
|
||||||
extern int addressprint; /* Whether to print hex addresses in HLL " */
|
|
||||||
|
|
||||||
struct format_data
|
struct format_data
|
||||||
{
|
{
|
||||||
|
@ -120,13 +120,6 @@ Printing of source filename and line number with <symbol> is %s.\n"),
|
||||||
|
|
||||||
int current_display_number;
|
int current_display_number;
|
||||||
|
|
||||||
/* Flag to low-level print routines that this value is being printed
|
|
||||||
in an epoch window. We'd like to pass this as a parameter, but
|
|
||||||
every routine would need to take it. Perhaps we can encapsulate
|
|
||||||
this in the I/O stream once we have GNU stdio. */
|
|
||||||
|
|
||||||
int inspect_it = 0;
|
|
||||||
|
|
||||||
struct display
|
struct display
|
||||||
{
|
{
|
||||||
/* Chain link to next auto-display item. */
|
/* Chain link to next auto-display item. */
|
||||||
|
@ -254,15 +247,15 @@ decode_format (char **string_ptr, int oformat, int osize)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print value VAL on stream according to FORMAT, a letter or 0.
|
/* Print value VAL on stream according to OPTIONS.
|
||||||
Do not end with a newline.
|
Do not end with a newline.
|
||||||
0 means print VAL according to its own type.
|
|
||||||
SIZE is the letter for the size of datum being printed.
|
SIZE is the letter for the size of datum being printed.
|
||||||
This is used to pad hex numbers so they line up. SIZE is 0
|
This is used to pad hex numbers so they line up. SIZE is 0
|
||||||
for print / output and set for examine. */
|
for print / output and set for examine. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_formatted (struct value *val, int format, int size,
|
print_formatted (struct value *val, int size,
|
||||||
|
const struct value_print_options *options,
|
||||||
struct ui_file *stream)
|
struct ui_file *stream)
|
||||||
{
|
{
|
||||||
struct type *type = check_typedef (value_type (val));
|
struct type *type = check_typedef (value_type (val));
|
||||||
|
@ -273,12 +266,13 @@ print_formatted (struct value *val, int format, int size,
|
||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
switch (format)
|
switch (options->format)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
/* FIXME: Need to handle wchar_t's here... */
|
/* FIXME: Need to handle wchar_t's here... */
|
||||||
next_address = VALUE_ADDRESS (val)
|
next_address = VALUE_ADDRESS (val)
|
||||||
+ val_print_string (VALUE_ADDRESS (val), -1, 1, stream);
|
+ val_print_string (VALUE_ADDRESS (val), -1, 1, stream,
|
||||||
|
options);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -291,22 +285,19 @@ print_formatted (struct value *val, int format, int size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == 0 || format == 's'
|
if (options->format == 0 || options->format == 's'
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_REF
|
|| TYPE_CODE (type) == TYPE_CODE_REF
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_ARRAY
|
|| TYPE_CODE (type) == TYPE_CODE_ARRAY
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_STRING
|
|| TYPE_CODE (type) == TYPE_CODE_STRING
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_UNION
|
|| TYPE_CODE (type) == TYPE_CODE_UNION
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
|
|| TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
|
||||||
/* If format is 0, use the 'natural' format for that type of
|
value_print (val, stream, options);
|
||||||
value. If the type is non-scalar, we have to use language
|
|
||||||
rules to print it as a series of scalars. */
|
|
||||||
value_print (val, stream, format, Val_pretty_default);
|
|
||||||
else
|
else
|
||||||
/* User specified format, so don't look to the the type to
|
/* User specified format, so don't look to the the type to
|
||||||
tell us what to do. */
|
tell us what to do. */
|
||||||
print_scalar_formatted (value_contents (val), type,
|
print_scalar_formatted (value_contents (val), type,
|
||||||
format, size, stream);
|
options, size, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return builtin floating point type of same length as TYPE.
|
/* Return builtin floating point type of same length as TYPE.
|
||||||
|
@ -328,15 +319,16 @@ float_type_from_length (struct gdbarch *gdbarch, struct type *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
|
/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
|
||||||
according to letters FORMAT and SIZE on STREAM.
|
according to OPTIONS and SIZE on STREAM.
|
||||||
FORMAT may not be zero. Formats s and i are not supported at this level.
|
Formats s and i are not supported at this level.
|
||||||
|
|
||||||
This is how the elements of an array or structure are printed
|
This is how the elements of an array or structure are printed
|
||||||
with a format. */
|
with a format. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_scalar_formatted (const void *valaddr, struct type *type,
|
print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
int format, int size, struct ui_file *stream)
|
const struct value_print_options *options,
|
||||||
|
int size, struct ui_file *stream)
|
||||||
{
|
{
|
||||||
LONGEST val_long = 0;
|
LONGEST val_long = 0;
|
||||||
unsigned int len = TYPE_LENGTH (type);
|
unsigned int len = TYPE_LENGTH (type);
|
||||||
|
@ -345,9 +337,12 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
/* If we get here with a string format, try again without it. Go
|
/* If we get here with a string format, try again without it. Go
|
||||||
all the way back to the language printers, which may call us
|
all the way back to the language printers, which may call us
|
||||||
again. */
|
again. */
|
||||||
if (format == 's')
|
if (options->format == 's')
|
||||||
{
|
{
|
||||||
val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default,
|
struct value_print_options opts = *options;
|
||||||
|
opts.format = 0;
|
||||||
|
opts.deref_ref = 0;
|
||||||
|
val_print (type, valaddr, 0, 0, stream, 0, &opts,
|
||||||
current_language);
|
current_language);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +351,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
(TYPE_CODE (type) == TYPE_CODE_INT
|
(TYPE_CODE (type) == TYPE_CODE_INT
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_ENUM))
|
|| TYPE_CODE (type) == TYPE_CODE_ENUM))
|
||||||
{
|
{
|
||||||
switch (format)
|
switch (options->format)
|
||||||
{
|
{
|
||||||
case 'o':
|
case 'o':
|
||||||
print_octal_chars (stream, valaddr, len, byte_order);
|
print_octal_chars (stream, valaddr, len, byte_order);
|
||||||
|
@ -379,7 +374,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format != 'f')
|
if (options->format != 'f')
|
||||||
val_long = unpack_long (type, valaddr);
|
val_long = unpack_long (type, valaddr);
|
||||||
|
|
||||||
/* If the value is a pointer, and pointers and addresses are not the
|
/* If the value is a pointer, and pointers and addresses are not the
|
||||||
|
@ -391,13 +386,13 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
/* If we are printing it as unsigned, truncate it in case it is actually
|
/* If we are printing it as unsigned, truncate it in case it is actually
|
||||||
a negative signed value (e.g. "print/u (short)-1" should print 65535
|
a negative signed value (e.g. "print/u (short)-1" should print 65535
|
||||||
(if shorts are 16 bits) instead of 4294967295). */
|
(if shorts are 16 bits) instead of 4294967295). */
|
||||||
if (format != 'd')
|
if (options->format != 'd')
|
||||||
{
|
{
|
||||||
if (len < sizeof (LONGEST))
|
if (len < sizeof (LONGEST))
|
||||||
val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1;
|
val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (format)
|
switch (options->format)
|
||||||
{
|
{
|
||||||
case 'x':
|
case 'x':
|
||||||
if (!size)
|
if (!size)
|
||||||
|
@ -442,13 +437,17 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
if (TYPE_UNSIGNED (type))
|
{
|
||||||
value_print (value_from_longest (builtin_type_true_unsigned_char,
|
struct value_print_options opts = *options;
|
||||||
val_long),
|
opts.format = 0;
|
||||||
stream, 0, Val_pretty_default);
|
if (TYPE_UNSIGNED (type))
|
||||||
else
|
value_print (value_from_longest (builtin_type_true_unsigned_char,
|
||||||
value_print (value_from_longest (builtin_type_true_char, val_long),
|
val_long),
|
||||||
stream, 0, Val_pretty_default);
|
stream, &opts);
|
||||||
|
else
|
||||||
|
value_print (value_from_longest (builtin_type_true_char, val_long),
|
||||||
|
stream, &opts);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
|
@ -508,7 +507,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error (_("Undefined output format \"%c\"."), format);
|
error (_("Undefined output format \"%c\"."), options->format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,11 +706,13 @@ void
|
||||||
print_address_demangle (CORE_ADDR addr, struct ui_file *stream,
|
print_address_demangle (CORE_ADDR addr, struct ui_file *stream,
|
||||||
int do_demangle)
|
int do_demangle)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "0");
|
fprintf_filtered (stream, "0");
|
||||||
}
|
}
|
||||||
else if (addressprint)
|
else if (opts.addressprint)
|
||||||
{
|
{
|
||||||
fputs_filtered (paddress (addr), stream);
|
fputs_filtered (paddress (addr), stream);
|
||||||
print_address_symbolic (addr, stream, do_demangle, " ");
|
print_address_symbolic (addr, stream, do_demangle, " ");
|
||||||
|
@ -745,6 +746,7 @@ do_examine (struct format_data fmt, CORE_ADDR addr)
|
||||||
struct type *val_type = NULL;
|
struct type *val_type = NULL;
|
||||||
int i;
|
int i;
|
||||||
int maxelts;
|
int maxelts;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
format = fmt.format;
|
format = fmt.format;
|
||||||
size = fmt.size;
|
size = fmt.size;
|
||||||
|
@ -775,6 +777,8 @@ do_examine (struct format_data fmt, CORE_ADDR addr)
|
||||||
if (format == 's' || format == 'i')
|
if (format == 's' || format == 'i')
|
||||||
maxelts = 1;
|
maxelts = 1;
|
||||||
|
|
||||||
|
get_formatted_print_options (&opts, format);
|
||||||
|
|
||||||
/* Print as many objects as specified in COUNT, at most maxelts per line,
|
/* Print as many objects as specified in COUNT, at most maxelts per line,
|
||||||
with the address of the next one at the start of each line. */
|
with the address of the next one at the start of each line. */
|
||||||
|
|
||||||
|
@ -809,7 +813,7 @@ do_examine (struct format_data fmt, CORE_ADDR addr)
|
||||||
if (last_examine_value)
|
if (last_examine_value)
|
||||||
release_value (last_examine_value);
|
release_value (last_examine_value);
|
||||||
|
|
||||||
print_formatted (last_examine_value, format, size, gdb_stdout);
|
print_formatted (last_examine_value, size, &opts, gdb_stdout);
|
||||||
|
|
||||||
/* Display any branch delay slots following the final insn. */
|
/* Display any branch delay slots following the final insn. */
|
||||||
if (format == 'i' && count == 1)
|
if (format == 'i' && count == 1)
|
||||||
|
@ -847,10 +851,6 @@ print_command_1 (char *exp, int inspect, int voidprint)
|
||||||
struct format_data fmt;
|
struct format_data fmt;
|
||||||
int cleanup = 0;
|
int cleanup = 0;
|
||||||
|
|
||||||
/* Pass inspect flag to the rest of the print routines in a global
|
|
||||||
(sigh). */
|
|
||||||
inspect_it = inspect;
|
|
||||||
|
|
||||||
if (exp && *exp == '/')
|
if (exp && *exp == '/')
|
||||||
{
|
{
|
||||||
exp++;
|
exp++;
|
||||||
|
@ -879,6 +879,7 @@ print_command_1 (char *exp, int inspect, int voidprint)
|
||||||
if (voidprint || (val && value_type (val) &&
|
if (voidprint || (val && value_type (val) &&
|
||||||
TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
|
TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
int histindex = record_latest_value (val);
|
int histindex = record_latest_value (val);
|
||||||
|
|
||||||
if (histindex >= 0)
|
if (histindex >= 0)
|
||||||
|
@ -895,7 +896,10 @@ print_command_1 (char *exp, int inspect, int voidprint)
|
||||||
if (histindex >= 0)
|
if (histindex >= 0)
|
||||||
annotate_value_history_value ();
|
annotate_value_history_value ();
|
||||||
|
|
||||||
print_formatted (val, format, fmt.size, gdb_stdout);
|
get_formatted_print_options (&opts, format);
|
||||||
|
opts.inspect_it = inspect;
|
||||||
|
|
||||||
|
print_formatted (val, fmt.size, &opts, gdb_stdout);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
|
|
||||||
if (histindex >= 0)
|
if (histindex >= 0)
|
||||||
|
@ -909,7 +913,6 @@ print_command_1 (char *exp, int inspect, int voidprint)
|
||||||
|
|
||||||
if (cleanup)
|
if (cleanup)
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
inspect_it = 0; /* Reset print routines to normal. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -942,6 +945,7 @@ output_command (char *exp, int from_tty)
|
||||||
char format = 0;
|
char format = 0;
|
||||||
struct value *val;
|
struct value *val;
|
||||||
struct format_data fmt;
|
struct format_data fmt;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
fmt.size = 0;
|
fmt.size = 0;
|
||||||
|
|
||||||
|
@ -960,7 +964,8 @@ output_command (char *exp, int from_tty)
|
||||||
|
|
||||||
annotate_value_begin (value_type (val));
|
annotate_value_begin (value_type (val));
|
||||||
|
|
||||||
print_formatted (val, format, fmt.size, gdb_stdout);
|
get_formatted_print_options (&opts, format);
|
||||||
|
print_formatted (val, fmt.size, &opts, gdb_stdout);
|
||||||
|
|
||||||
annotate_value_end ();
|
annotate_value_end ();
|
||||||
|
|
||||||
|
@ -1507,6 +1512,8 @@ do_one_display (struct display *d)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
annotate_display_format ();
|
annotate_display_format ();
|
||||||
|
|
||||||
if (d->format.format)
|
if (d->format.format)
|
||||||
|
@ -1521,8 +1528,9 @@ do_one_display (struct display *d)
|
||||||
|
|
||||||
annotate_display_expression ();
|
annotate_display_expression ();
|
||||||
|
|
||||||
|
get_formatted_print_options (&opts, d->format.format);
|
||||||
print_formatted (evaluate_expression (d->exp),
|
print_formatted (evaluate_expression (d->exp),
|
||||||
d->format.format, d->format.size, gdb_stdout);
|
d->format.size, &opts, gdb_stdout);
|
||||||
printf_filtered ("\n");
|
printf_filtered ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1677,8 +1685,10 @@ print_variable_value (struct symbol *var, struct frame_info *frame,
|
||||||
struct ui_file *stream)
|
struct ui_file *stream)
|
||||||
{
|
{
|
||||||
struct value *val = read_var_value (var, frame);
|
struct value *val = read_var_value (var, frame);
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
value_print (val, stream, 0, Val_pretty_default);
|
get_user_print_options (&opts);
|
||||||
|
value_print (val, stream, &opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "dfp.h"
|
#include "dfp.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
/* List of all values which are currently exposed to Python. It is
|
/* List of all values which are currently exposed to Python. It is
|
||||||
maintained so that when an objfile is discarded, preserve_values
|
maintained so that when an objfile is discarded, preserve_values
|
||||||
|
@ -189,15 +190,19 @@ valpy_str (PyObject *self)
|
||||||
struct ui_file *stb;
|
struct ui_file *stb;
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
struct value_print_options opts;
|
||||||
volatile struct gdb_exception except;
|
volatile struct gdb_exception except;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
|
opts.deref_ref = 0;
|
||||||
|
|
||||||
stb = mem_fileopen ();
|
stb = mem_fileopen ();
|
||||||
old_chain = make_cleanup_ui_file_delete (stb);
|
old_chain = make_cleanup_ui_file_delete (stb);
|
||||||
|
|
||||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
common_val_print (((value_object *) self)->value, stb, 0, 0, 0,
|
common_val_print (((value_object *) self)->value, stb, 0,
|
||||||
Val_pretty_default, current_language);
|
&opts, current_language);
|
||||||
s = ui_file_xstrdup (stb, &dummy);
|
s = ui_file_xstrdup (stb, &dummy);
|
||||||
}
|
}
|
||||||
GDB_PY_HANDLE_EXCEPTION (except);
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
|
|
|
@ -50,7 +50,8 @@ scm_printchar (int c, struct ui_file *stream)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scm_printstr (struct ui_file *stream, const gdb_byte *string,
|
scm_printstr (struct ui_file *stream, const gdb_byte *string,
|
||||||
unsigned int length, int width, int force_ellipses)
|
unsigned int length, int width, int force_ellipses,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "\"%s\"", string);
|
fprintf_filtered (stream, "\"%s\"", string);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,16 +46,16 @@
|
||||||
struct value;
|
struct value;
|
||||||
|
|
||||||
extern int scm_value_print (struct value *, struct ui_file *,
|
extern int scm_value_print (struct value *, struct ui_file *,
|
||||||
int, enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int scm_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
extern int scm_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
|
||||||
struct ui_file *, int, int, int,
|
struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern LONGEST scm_get_field (LONGEST, int);
|
extern LONGEST scm_get_field (LONGEST, int);
|
||||||
|
|
||||||
extern void scm_scmval_print (LONGEST, struct ui_file *, int, int, int,
|
extern void scm_scmval_print (LONGEST, struct ui_file *, int,
|
||||||
enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
extern int is_scmvalue_type (struct type *);
|
extern int is_scmvalue_type (struct type *);
|
||||||
|
|
||||||
|
|
|
@ -33,18 +33,18 @@
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
|
|
||||||
static void scm_ipruk (char *, LONGEST, struct ui_file *);
|
static void scm_ipruk (char *, LONGEST, struct ui_file *);
|
||||||
static void scm_scmlist_print (LONGEST, struct ui_file *, int, int,
|
static void scm_scmlist_print (LONGEST, struct ui_file *, int,
|
||||||
int, enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
static int scm_inferior_print (LONGEST, struct ui_file *, int, int,
|
static int scm_inferior_print (LONGEST, struct ui_file *, int,
|
||||||
int, enum val_prettyprint);
|
const struct value_print_options *);
|
||||||
|
|
||||||
/* Prints the SCM value VALUE by invoking the inferior, if appropraite.
|
/* Prints the SCM value VALUE by invoking the inferior, if appropraite.
|
||||||
Returns >= 0 on success; return -1 if the inferior cannot/should not
|
Returns >= 0 on success; return -1 if the inferior cannot/should not
|
||||||
print VALUE. */
|
print VALUE. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
scm_inferior_print (LONGEST value, struct ui_file *stream, int format,
|
scm_inferior_print (LONGEST value, struct ui_file *stream,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
int recurse, const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct objfile *objf;
|
struct objfile *objf;
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
|
@ -129,17 +129,16 @@ static char *scm_isymnames[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int format,
|
scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
unsigned int more = print_max;
|
unsigned int more = options->print_max;
|
||||||
if (recurse > 6)
|
if (recurse > 6)
|
||||||
{
|
{
|
||||||
fputs_filtered ("...", stream);
|
fputs_filtered ("...", stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scm_scmval_print (SCM_CAR (svalue), stream, format,
|
scm_scmval_print (SCM_CAR (svalue), stream, recurse + 1, options);
|
||||||
deref_ref, recurse + 1, pretty);
|
|
||||||
svalue = SCM_CDR (svalue);
|
svalue = SCM_CDR (svalue);
|
||||||
for (; SCM_NIMP (svalue); svalue = SCM_CDR (svalue))
|
for (; SCM_NIMP (svalue); svalue = SCM_CDR (svalue))
|
||||||
{
|
{
|
||||||
|
@ -151,14 +150,12 @@ scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int format,
|
||||||
fputs_filtered ("...", stream);
|
fputs_filtered ("...", stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scm_scmval_print (SCM_CAR (svalue), stream, format,
|
scm_scmval_print (SCM_CAR (svalue), stream, recurse + 1, options);
|
||||||
deref_ref, recurse + 1, pretty);
|
|
||||||
}
|
}
|
||||||
if (SCM_NNULLP (svalue))
|
if (SCM_NNULLP (svalue))
|
||||||
{
|
{
|
||||||
fputs_filtered (" . ", stream);
|
fputs_filtered (" . ", stream);
|
||||||
scm_scmval_print (svalue, stream, format,
|
scm_scmval_print (svalue, stream, recurse + 1, options);
|
||||||
deref_ref, recurse + 1, pretty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,15 +171,17 @@ scm_ipruk (char *hdr, LONGEST ptr, struct ui_file *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_scmval_print (LONGEST svalue, struct ui_file *stream, int format,
|
scm_scmval_print (LONGEST svalue, struct ui_file *stream,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty)
|
int recurse, const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
taloop:
|
taloop:
|
||||||
switch (7 & (int) svalue)
|
switch (7 & (int) svalue)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
case 6:
|
case 6:
|
||||||
print_longest (stream, format ? format : 'd', 1, svalue >> 2);
|
print_longest (stream,
|
||||||
|
options->format ? options->format : 'd',
|
||||||
|
1, svalue >> 2);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (SCM_ICHRP (svalue))
|
if (SCM_ICHRP (svalue))
|
||||||
|
@ -243,14 +242,12 @@ taloop:
|
||||||
case scm_tcs_cons_imcar:
|
case scm_tcs_cons_imcar:
|
||||||
case scm_tcs_cons_nimcar:
|
case scm_tcs_cons_nimcar:
|
||||||
fputs_filtered ("(", stream);
|
fputs_filtered ("(", stream);
|
||||||
scm_scmlist_print (svalue, stream, format,
|
scm_scmlist_print (svalue, stream, recurse + 1, options);
|
||||||
deref_ref, recurse + 1, pretty);
|
|
||||||
fputs_filtered (")", stream);
|
fputs_filtered (")", stream);
|
||||||
break;
|
break;
|
||||||
case scm_tcs_closures:
|
case scm_tcs_closures:
|
||||||
fputs_filtered ("#<CLOSURE ", stream);
|
fputs_filtered ("#<CLOSURE ", stream);
|
||||||
scm_scmlist_print (SCM_CODE (svalue), stream, format,
|
scm_scmlist_print (SCM_CODE (svalue), stream, recurse + 1, options);
|
||||||
deref_ref, recurse + 1, pretty);
|
|
||||||
fputs_filtered (">", stream);
|
fputs_filtered (">", stream);
|
||||||
break;
|
break;
|
||||||
case scm_tc7_string:
|
case scm_tc7_string:
|
||||||
|
@ -261,9 +258,9 @@ taloop:
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int buf_size;
|
int buf_size;
|
||||||
gdb_byte buffer[64];
|
gdb_byte buffer[64];
|
||||||
int truncate = print_max && len > (int) print_max;
|
int truncate = options->print_max && len > (int) options->print_max;
|
||||||
if (truncate)
|
if (truncate)
|
||||||
len = print_max;
|
len = options->print_max;
|
||||||
fputs_filtered ("\"", stream);
|
fputs_filtered ("\"", stream);
|
||||||
for (; done < len; done += buf_size)
|
for (; done < len; done += buf_size)
|
||||||
{
|
{
|
||||||
|
@ -305,8 +302,8 @@ taloop:
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
fputs_filtered (" ", stream);
|
fputs_filtered (" ", stream);
|
||||||
scm_scmval_print (scm_get_field (elements, i), stream, format,
|
scm_scmval_print (scm_get_field (elements, i), stream,
|
||||||
deref_ref, recurse + 1, pretty);
|
recurse + 1, options);
|
||||||
}
|
}
|
||||||
fputs_filtered (")", stream);
|
fputs_filtered (")", stream);
|
||||||
}
|
}
|
||||||
|
@ -401,21 +398,19 @@ taloop:
|
||||||
int
|
int
|
||||||
scm_val_print (struct type *type, const gdb_byte *valaddr,
|
scm_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format, int deref_ref,
|
struct ui_file *stream, int recurse,
|
||||||
int recurse, enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
if (is_scmvalue_type (type))
|
if (is_scmvalue_type (type))
|
||||||
{
|
{
|
||||||
LONGEST svalue = extract_signed_integer (valaddr, TYPE_LENGTH (type));
|
LONGEST svalue = extract_signed_integer (valaddr, TYPE_LENGTH (type));
|
||||||
|
|
||||||
if (scm_inferior_print (svalue, stream, format,
|
if (scm_inferior_print (svalue, stream, recurse, options) >= 0)
|
||||||
deref_ref, recurse, pretty) >= 0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scm_scmval_print (svalue, stream, format,
|
scm_scmval_print (svalue, stream, recurse, options);
|
||||||
deref_ref, recurse, pretty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_flush (stream);
|
gdb_flush (stream);
|
||||||
|
@ -423,15 +418,15 @@ scm_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return c_val_print (type, valaddr, 0, address, stream, format,
|
return c_val_print (type, valaddr, 0, address, stream, recurse, options);
|
||||||
deref_ref, recurse, pretty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scm_value_print (struct value *val, struct ui_file *stream, int format,
|
scm_value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
return (common_val_print (val, stream, format, 1, 0, pretty,
|
struct value_print_options opts = *options;
|
||||||
current_language));
|
opts.deref_ref = 1;
|
||||||
|
return (common_val_print (val, stream, 0, &opts, current_language));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "osabi.h"
|
#include "osabi.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "elf-bfd.h"
|
#include "elf-bfd.h"
|
||||||
|
|
||||||
|
@ -2092,6 +2093,7 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
|
||||||
struct frame_info *frame, int regnum)
|
struct frame_info *frame, int regnum)
|
||||||
{
|
{
|
||||||
unsigned char raw_buffer[MAX_REGISTER_SIZE];
|
unsigned char raw_buffer[MAX_REGISTER_SIZE];
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
|
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
|
||||||
print_spaces_filtered (15 - strlen (gdbarch_register_name
|
print_spaces_filtered (15 - strlen (gdbarch_register_name
|
||||||
|
@ -2100,12 +2102,16 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
|
||||||
/* Get the data in raw format. */
|
/* Get the data in raw format. */
|
||||||
if (!frame_register_read (frame, regnum, raw_buffer))
|
if (!frame_register_read (frame, regnum, raw_buffer))
|
||||||
fprintf_filtered (file, "*value not available*\n");
|
fprintf_filtered (file, "*value not available*\n");
|
||||||
|
|
||||||
|
get_formatted_print_options (&opts, 'x');
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
|
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
|
||||||
file, 'x', 1, 0, Val_pretty_default, current_language);
|
file, 0, &opts, current_language);
|
||||||
fprintf_filtered (file, "\t");
|
fprintf_filtered (file, "\t");
|
||||||
|
get_formatted_print_options (&opts, 0);
|
||||||
|
opts.deref_ref = 1;
|
||||||
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
|
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
|
||||||
file, 0, 1, 0, Val_pretty_default, current_language);
|
file, 0, &opts, current_language);
|
||||||
fprintf_filtered (file, "\n");
|
fprintf_filtered (file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
gdb/stack.c
19
gdb/stack.c
|
@ -368,6 +368,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
const struct language_defn *language;
|
const struct language_defn *language;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
/* Use the appropriate language to display our symbol,
|
/* Use the appropriate language to display our symbol,
|
||||||
unless the user forced the language to a specific
|
unless the user forced the language to a specific
|
||||||
|
@ -377,8 +378,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
|
||||||
else
|
else
|
||||||
language = current_language;
|
language = current_language;
|
||||||
|
|
||||||
common_val_print (val, stb->stream, 0, 0, 2,
|
get_raw_print_options (&opts);
|
||||||
Val_no_prettyprint, language);
|
opts.deref_ref = 0;
|
||||||
|
common_val_print (val, stb->stream, 2,
|
||||||
|
&opts, language);
|
||||||
ui_out_field_stream (uiout, "value", stb);
|
ui_out_field_stream (uiout, "value", stb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -547,6 +550,8 @@ print_frame_info (struct frame_info *frame, int print_level,
|
||||||
sal.line + 1, 0);
|
sal.line + 1, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
/* We used to do this earlier, but that is clearly
|
/* We used to do this earlier, but that is clearly
|
||||||
wrong. This function is used by many different
|
wrong. This function is used by many different
|
||||||
parts of gdb, including normal_stop in infrun.c,
|
parts of gdb, including normal_stop in infrun.c,
|
||||||
|
@ -555,7 +560,7 @@ print_frame_info (struct frame_info *frame, int print_level,
|
||||||
line. Only the command line really wants this
|
line. Only the command line really wants this
|
||||||
behavior. Other UIs probably would like the
|
behavior. Other UIs probably would like the
|
||||||
ability to decide for themselves if it is desired. */
|
ability to decide for themselves if it is desired. */
|
||||||
if (addressprint && mid_statement)
|
if (opts.addressprint && mid_statement)
|
||||||
{
|
{
|
||||||
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
|
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
|
||||||
ui_out_text (uiout, "\t");
|
ui_out_text (uiout, "\t");
|
||||||
|
@ -584,6 +589,7 @@ print_frame (struct frame_info *frame, int print_level,
|
||||||
enum language funlang = language_unknown;
|
enum language funlang = language_unknown;
|
||||||
struct ui_stream *stb;
|
struct ui_stream *stb;
|
||||||
struct cleanup *old_chain, *list_chain;
|
struct cleanup *old_chain, *list_chain;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
stb = ui_out_stream_new (uiout);
|
stb = ui_out_stream_new (uiout);
|
||||||
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
||||||
|
@ -665,7 +671,8 @@ print_frame (struct frame_info *frame, int print_level,
|
||||||
ui_out_field_fmt_int (uiout, 2, ui_left, "level",
|
ui_out_field_fmt_int (uiout, 2, ui_left, "level",
|
||||||
frame_relative_level (frame));
|
frame_relative_level (frame));
|
||||||
}
|
}
|
||||||
if (addressprint)
|
get_user_print_options (&opts);
|
||||||
|
if (opts.addressprint)
|
||||||
if (get_frame_pc (frame) != sal.pc || !sal.symtab
|
if (get_frame_pc (frame) != sal.pc || !sal.symtab
|
||||||
|| print_what == LOC_AND_ADDRESS)
|
|| print_what == LOC_AND_ADDRESS)
|
||||||
{
|
{
|
||||||
|
@ -1405,10 +1412,12 @@ print_block_frame_labels (struct block *b, int *have_default,
|
||||||
if (SYMBOL_CLASS (sym) == LOC_LABEL)
|
if (SYMBOL_CLASS (sym) == LOC_LABEL)
|
||||||
{
|
{
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
|
struct value_print_options opts;
|
||||||
sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
|
sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
|
||||||
values_printed = 1;
|
values_printed = 1;
|
||||||
fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
|
fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
|
||||||
if (addressprint)
|
get_user_print_options (&opts);
|
||||||
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, " ");
|
fprintf_filtered (stream, " ");
|
||||||
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (sym)), stream);
|
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (sym)), stream);
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2008-10-28 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
|
||||||
|
|
||||||
2008-10-24 Pedro Alves <pedro@codesourcery.com>
|
2008-10-24 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* gdb.python/python-value.exp (test_value_in_inferior): Don't use
|
* gdb.python/python-value.exp (test_value_in_inferior): Don't use
|
||||||
|
|
|
@ -252,3 +252,10 @@ gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \
|
||||||
# String concatentation.
|
# String concatentation.
|
||||||
test_expr "print \"x\" \"y\"" "\\$\[0-9\]* = \"xy\""
|
test_expr "print \"x\" \"y\"" "\\$\[0-9\]* = \"xy\""
|
||||||
test_expr "print \"x\" \"y\" \"z\"" "\\$\[0-9\]* = \"xyz\""
|
test_expr "print \"x\" \"y\" \"z\"" "\\$\[0-9\]* = \"xyz\""
|
||||||
|
|
||||||
|
# Enum formatting tests.
|
||||||
|
test_expr "print red" "\\$\[0-9\]* = red"
|
||||||
|
gdb_test "set output-radix 8" ""
|
||||||
|
test_expr "print red" "\\$\[0-9\]* = red"
|
||||||
|
test_expr "print/d red" "\\$\[0-9\]* = 0"
|
||||||
|
gdb_test "set output-radix 10" ""
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "dictionary.h"
|
#include "dictionary.h"
|
||||||
#include "observer.h"
|
#include "observer.h"
|
||||||
#include "user-regs.h"
|
#include "user-regs.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "ax.h"
|
#include "ax.h"
|
||||||
#include "ax-gdb.h"
|
#include "ax-gdb.h"
|
||||||
|
@ -67,7 +68,6 @@
|
||||||
extern void (*deprecated_readline_begin_hook) (char *, ...);
|
extern void (*deprecated_readline_begin_hook) (char *, ...);
|
||||||
extern char *(*deprecated_readline_hook) (char *);
|
extern char *(*deprecated_readline_hook) (char *);
|
||||||
extern void (*deprecated_readline_end_hook) (void);
|
extern void (*deprecated_readline_end_hook) (void);
|
||||||
extern int addressprint; /* Print machine addresses? */
|
|
||||||
|
|
||||||
/* GDB commands implemented in other modules:
|
/* GDB commands implemented in other modules:
|
||||||
*/
|
*/
|
||||||
|
@ -434,9 +434,11 @@ trace_command (char *arg, int from_tty)
|
||||||
static void
|
static void
|
||||||
trace_mention (struct tracepoint *tp)
|
trace_mention (struct tracepoint *tp)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
printf_filtered ("Tracepoint %d", tp->number);
|
printf_filtered ("Tracepoint %d", tp->number);
|
||||||
|
|
||||||
if (addressprint || (tp->source_file == NULL))
|
get_user_print_options (&opts);
|
||||||
|
if (opts.addressprint || (tp->source_file == NULL))
|
||||||
{
|
{
|
||||||
printf_filtered (" at ");
|
printf_filtered (" at ");
|
||||||
printf_filtered ("%s", paddress (tp->address));
|
printf_filtered ("%s", paddress (tp->address));
|
||||||
|
@ -467,12 +469,12 @@ tracepoints_info (char *tpnum_exp, int from_tty)
|
||||||
ALL_TRACEPOINTS (t)
|
ALL_TRACEPOINTS (t)
|
||||||
if (tpnum == -1 || tpnum == t->number)
|
if (tpnum == -1 || tpnum == t->number)
|
||||||
{
|
{
|
||||||
extern int addressprint; /* Print machine addresses? */
|
struct value_print_options opts;
|
||||||
|
get_user_print_options (&opts);
|
||||||
if (!found_a_tracepoint++)
|
if (!found_a_tracepoint++)
|
||||||
{
|
{
|
||||||
printf_filtered ("Num Enb ");
|
printf_filtered ("Num Enb ");
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
||||||
printf_filtered ("Address ");
|
printf_filtered ("Address ");
|
||||||
|
@ -482,7 +484,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
|
||||||
printf_filtered ("PassC StepC What\n");
|
printf_filtered ("PassC StepC What\n");
|
||||||
}
|
}
|
||||||
strcpy (wrap_indent, " ");
|
strcpy (wrap_indent, " ");
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
if (gdbarch_addr_bit (current_gdbarch) <= 32)
|
||||||
strcat (wrap_indent, " ");
|
strcat (wrap_indent, " ");
|
||||||
|
@ -492,7 +494,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
|
||||||
|
|
||||||
printf_filtered ("%-3d %-3s ", t->number,
|
printf_filtered ("%-3d %-3s ", t->number,
|
||||||
t->enabled_p ? "y" : "n");
|
t->enabled_p ? "y" : "n");
|
||||||
if (addressprint)
|
if (opts.addressprint)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "tui/tui-wingeneral.h"
|
#include "tui/tui-wingeneral.h"
|
||||||
#include "tui/tui-file.h"
|
#include "tui/tui-file.h"
|
||||||
#include "reggroups.h"
|
#include "reggroups.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "gdb_curses.h"
|
#include "gdb_curses.h"
|
||||||
|
|
||||||
|
@ -689,11 +690,13 @@ tui_register_format (struct gdbarch *gdbarch,
|
||||||
{
|
{
|
||||||
gdb_byte buf[MAX_REGISTER_SIZE];
|
gdb_byte buf[MAX_REGISTER_SIZE];
|
||||||
int len;
|
int len;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
len = register_size (current_gdbarch, regnum);
|
len = register_size (current_gdbarch, regnum);
|
||||||
fprintf_filtered (stream, "%-14s ", name);
|
fprintf_filtered (stream, "%-14s ", name);
|
||||||
get_frame_register (frame, regnum, buf);
|
get_frame_register (frame, regnum, buf);
|
||||||
print_scalar_formatted (buf, type, 'f', len, stream);
|
get_formatted_print_options (&opts, 'f');
|
||||||
|
print_scalar_formatted (buf, type, &opts, len, stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,12 +33,9 @@
|
||||||
#include "cp-abi.h"
|
#include "cp-abi.h"
|
||||||
#include "typeprint.h"
|
#include "typeprint.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
#include "valprint.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/* For real-type printing in whatis_exp() */
|
|
||||||
extern int objectprint; /* Controls looking up an object's derived type
|
|
||||||
using what we find in its vtables. */
|
|
||||||
|
|
||||||
extern void _initialize_typeprint (void);
|
extern void _initialize_typeprint (void);
|
||||||
|
|
||||||
static void ptype_command (char *, int);
|
static void ptype_command (char *, int);
|
||||||
|
@ -95,6 +92,7 @@ whatis_exp (char *exp, int show)
|
||||||
int full = 0;
|
int full = 0;
|
||||||
int top = -1;
|
int top = -1;
|
||||||
int using_enc = 0;
|
int using_enc = 0;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
if (exp)
|
if (exp)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +105,8 @@ whatis_exp (char *exp, int show)
|
||||||
|
|
||||||
type = value_type (val);
|
type = value_type (val);
|
||||||
|
|
||||||
if (objectprint)
|
get_user_print_options (&opts);
|
||||||
|
if (opts.objectprint)
|
||||||
{
|
{
|
||||||
if (((TYPE_CODE (type) == TYPE_CODE_PTR)
|
if (((TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||||
|| (TYPE_CODE (type) == TYPE_CODE_REF))
|
|| (TYPE_CODE (type) == TYPE_CODE_REF))
|
||||||
|
|
197
gdb/valprint.c
197
gdb/valprint.c
|
@ -60,13 +60,55 @@ static void set_output_radix_1 (int, unsigned);
|
||||||
|
|
||||||
void _initialize_valprint (void);
|
void _initialize_valprint (void);
|
||||||
|
|
||||||
/* Maximum number of chars to print for a string pointer value or vector
|
|
||||||
contents, or UINT_MAX for no limit. Note that "set print elements 0"
|
|
||||||
stores UINT_MAX in print_max, which displays in a show command as
|
|
||||||
"unlimited". */
|
|
||||||
|
|
||||||
unsigned int print_max;
|
|
||||||
#define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */
|
#define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */
|
||||||
|
|
||||||
|
struct value_print_options user_print_options =
|
||||||
|
{
|
||||||
|
Val_pretty_default, /* pretty */
|
||||||
|
0, /* prettyprint_arrays */
|
||||||
|
0, /* prettyprint_structs */
|
||||||
|
0, /* vtblprint */
|
||||||
|
1, /* unionprint */
|
||||||
|
1, /* addressprint */
|
||||||
|
0, /* objectprint */
|
||||||
|
PRINT_MAX_DEFAULT, /* print_max */
|
||||||
|
10, /* repeat_count_threshold */
|
||||||
|
0, /* output_format */
|
||||||
|
0, /* format */
|
||||||
|
0, /* stop_print_at_null */
|
||||||
|
0, /* inspect_it */
|
||||||
|
0, /* print_array_indexes */
|
||||||
|
0, /* deref_ref */
|
||||||
|
1, /* static_field_print */
|
||||||
|
1 /* pascal_static_field_print */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options. */
|
||||||
|
void
|
||||||
|
get_user_print_options (struct value_print_options *opts)
|
||||||
|
{
|
||||||
|
*opts = user_print_options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options, but with
|
||||||
|
pretty-printing disabled. */
|
||||||
|
void
|
||||||
|
get_raw_print_options (struct value_print_options *opts)
|
||||||
|
{
|
||||||
|
*opts = user_print_options;
|
||||||
|
opts->pretty = Val_no_prettyprint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options, but using
|
||||||
|
FORMAT as the formatting option. */
|
||||||
|
void
|
||||||
|
get_formatted_print_options (struct value_print_options *opts,
|
||||||
|
char format)
|
||||||
|
{
|
||||||
|
*opts = user_print_options;
|
||||||
|
opts->format = format;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_print_max (struct ui_file *file, int from_tty,
|
show_print_max (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -98,12 +140,10 @@ show_output_radix (struct ui_file *file, int from_tty,
|
||||||
Default output radix for printing of values is %s.\n"),
|
Default output radix for printing of values is %s.\n"),
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
int output_format = 0;
|
|
||||||
|
|
||||||
/* By default we print arrays without printing the index of each element in
|
/* By default we print arrays without printing the index of each element in
|
||||||
the array. This behavior can be changed by setting PRINT_ARRAY_INDEXES. */
|
the array. This behavior can be changed by setting PRINT_ARRAY_INDEXES. */
|
||||||
|
|
||||||
static int print_array_indexes = 0;
|
|
||||||
static void
|
static void
|
||||||
show_print_array_indexes (struct ui_file *file, int from_tty,
|
show_print_array_indexes (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -115,7 +155,6 @@ show_print_array_indexes (struct ui_file *file, int from_tty,
|
||||||
element in an array. Referenced by the low level language dependent
|
element in an array. Referenced by the low level language dependent
|
||||||
print routines. */
|
print routines. */
|
||||||
|
|
||||||
unsigned int repeat_count_threshold = 10;
|
|
||||||
static void
|
static void
|
||||||
show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -126,7 +165,6 @@ show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
||||||
|
|
||||||
/* If nonzero, stops printing of char arrays at first null. */
|
/* If nonzero, stops printing of char arrays at first null. */
|
||||||
|
|
||||||
int stop_print_at_null;
|
|
||||||
static void
|
static void
|
||||||
show_stop_print_at_null (struct ui_file *file, int from_tty,
|
show_stop_print_at_null (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -138,7 +176,6 @@ Printing of char arrays to stop at first null char is %s.\n"),
|
||||||
|
|
||||||
/* Controls pretty printing of structures. */
|
/* Controls pretty printing of structures. */
|
||||||
|
|
||||||
int prettyprint_structs;
|
|
||||||
static void
|
static void
|
||||||
show_prettyprint_structs (struct ui_file *file, int from_tty,
|
show_prettyprint_structs (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -148,7 +185,6 @@ show_prettyprint_structs (struct ui_file *file, int from_tty,
|
||||||
|
|
||||||
/* Controls pretty printing of arrays. */
|
/* Controls pretty printing of arrays. */
|
||||||
|
|
||||||
int prettyprint_arrays;
|
|
||||||
static void
|
static void
|
||||||
show_prettyprint_arrays (struct ui_file *file, int from_tty,
|
show_prettyprint_arrays (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -159,7 +195,6 @@ show_prettyprint_arrays (struct ui_file *file, int from_tty,
|
||||||
/* If nonzero, causes unions inside structures or other unions to be
|
/* If nonzero, causes unions inside structures or other unions to be
|
||||||
printed. */
|
printed. */
|
||||||
|
|
||||||
int unionprint; /* Controls printing of nested unions. */
|
|
||||||
static void
|
static void
|
||||||
show_unionprint (struct ui_file *file, int from_tty,
|
show_unionprint (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -171,7 +206,6 @@ Printing of unions interior to structures is %s.\n"),
|
||||||
|
|
||||||
/* If nonzero, causes machine addresses to be printed in certain contexts. */
|
/* If nonzero, causes machine addresses to be printed in certain contexts. */
|
||||||
|
|
||||||
int addressprint; /* Controls printing of machine addresses */
|
|
||||||
static void
|
static void
|
||||||
show_addressprint (struct ui_file *file, int from_tty,
|
show_addressprint (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -182,13 +216,7 @@ show_addressprint (struct ui_file *file, int from_tty,
|
||||||
|
|
||||||
/* Print using the given LANGUAGE the data of type TYPE located at VALADDR
|
/* Print using the given LANGUAGE the data of type TYPE located at VALADDR
|
||||||
(within GDB), which came from the inferior at address ADDRESS, onto
|
(within GDB), which came from the inferior at address ADDRESS, onto
|
||||||
stdio stream STREAM according to FORMAT (a letter, or 0 for natural
|
stdio stream STREAM according to OPTIONS.
|
||||||
format using TYPE).
|
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed.
|
||||||
|
@ -203,17 +231,18 @@ show_addressprint (struct ui_file *file, int from_tty,
|
||||||
|
|
||||||
int
|
int
|
||||||
val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
CORE_ADDR address, struct ui_file *stream, int format,
|
CORE_ADDR address, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
const struct language_defn *language)
|
const struct language_defn *language)
|
||||||
{
|
{
|
||||||
volatile struct gdb_exception except;
|
volatile struct gdb_exception except;
|
||||||
volatile enum val_prettyprint real_pretty = pretty;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
struct value_print_options local_opts = *options;
|
||||||
struct type *real_type = check_typedef (type);
|
struct type *real_type = check_typedef (type);
|
||||||
if (pretty == Val_pretty_default)
|
|
||||||
real_pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
|
if (local_opts.pretty == Val_pretty_default)
|
||||||
|
local_opts.pretty = (local_opts.prettyprint_structs
|
||||||
|
? Val_prettyprint : Val_no_prettyprint);
|
||||||
|
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
|
@ -231,8 +260,7 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
|
||||||
TRY_CATCH (except, RETURN_MASK_ERROR)
|
TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||||
{
|
{
|
||||||
ret = language->la_val_print (type, valaddr, embedded_offset, address,
|
ret = language->la_val_print (type, valaddr, embedded_offset, address,
|
||||||
stream, format, deref_ref, recurse,
|
stream, recurse, &local_opts);
|
||||||
real_pretty);
|
|
||||||
}
|
}
|
||||||
if (except.reason < 0)
|
if (except.reason < 0)
|
||||||
fprintf_filtered (stream, _("<error reading variable>"));
|
fprintf_filtered (stream, _("<error reading variable>"));
|
||||||
|
@ -263,12 +291,7 @@ value_check_printable (struct value *val, struct ui_file *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print using the given LANGUAGE the value VAL onto stream STREAM according
|
/* Print using the given LANGUAGE the value VAL onto stream STREAM according
|
||||||
to FORMAT (a letter, or 0 for natural format using TYPE).
|
to OPTIONS.
|
||||||
|
|
||||||
If DEREF_REF is nonzero, then dereference references, otherwise just print
|
|
||||||
them like pointers.
|
|
||||||
|
|
||||||
The PRETTY parameter controls prettyprinting.
|
|
||||||
|
|
||||||
If the data are a string pointer, returns the number of string characters
|
If the data are a string pointer, returns the number of string characters
|
||||||
printed.
|
printed.
|
||||||
|
@ -277,8 +300,8 @@ value_check_printable (struct value *val, struct ui_file *stream)
|
||||||
GDB's value mechanism. */
|
GDB's value mechanism. */
|
||||||
|
|
||||||
int
|
int
|
||||||
common_val_print (struct value *val, struct ui_file *stream, int format,
|
common_val_print (struct value *val, struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse, enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
const struct language_defn *language)
|
const struct language_defn *language)
|
||||||
{
|
{
|
||||||
if (!value_check_printable (val, stream))
|
if (!value_check_printable (val, stream))
|
||||||
|
@ -286,23 +309,22 @@ common_val_print (struct value *val, struct ui_file *stream, int format,
|
||||||
|
|
||||||
return val_print (value_type (val), value_contents_all (val),
|
return val_print (value_type (val), value_contents_all (val),
|
||||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||||
stream, format, deref_ref, recurse, pretty,
|
stream, recurse, options, language);
|
||||||
language);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the value VAL in C-ish syntax on stream STREAM.
|
/* Print the value VAL in C-ish syntax on stream STREAM according to
|
||||||
FORMAT is a format-letter, or 0 for print in natural format of data type.
|
OPTIONS.
|
||||||
If the object printed is a string pointer, returns
|
If the object printed is a string pointer, returns
|
||||||
the number of string bytes printed. */
|
the number of string bytes printed. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_print (struct value *val, struct ui_file *stream, int format,
|
value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
if (!value_check_printable (val, stream))
|
if (!value_check_printable (val, stream))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return LA_VALUE_PRINT (val, stream, format, pretty);
|
return LA_VALUE_PRINT (val, stream, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by various <lang>_val_print routines to print
|
/* Called by various <lang>_val_print routines to print
|
||||||
|
@ -928,15 +950,6 @@ print_char_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return non-zero if the debugger should print the index of each element
|
|
||||||
when printing array values. */
|
|
||||||
|
|
||||||
int
|
|
||||||
print_array_indexes_p (void)
|
|
||||||
{
|
|
||||||
return print_array_indexes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assuming TYPE is a simple, non-empty array type, compute its upper
|
/* Assuming TYPE is a simple, non-empty array type, compute its upper
|
||||||
and lower bound. Save the low bound into LOW_BOUND if not NULL.
|
and lower bound. Save the low bound into LOW_BOUND if not NULL.
|
||||||
Save the high bound into HIGH_BOUND if not NULL.
|
Save the high bound into HIGH_BOUND if not NULL.
|
||||||
|
@ -992,23 +1005,23 @@ get_array_bounds (struct type *type, long *low_bound, long *high_bound)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print on STREAM using the given FORMAT the index for the element
|
/* Print on STREAM using the given OPTIONS the index for the element
|
||||||
at INDEX of an array whose index type is INDEX_TYPE. */
|
at INDEX of an array whose index type is INDEX_TYPE. */
|
||||||
|
|
||||||
void
|
void
|
||||||
maybe_print_array_index (struct type *index_type, LONGEST index,
|
maybe_print_array_index (struct type *index_type, LONGEST index,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream,
|
||||||
enum val_prettyprint pretty)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
struct value *index_value;
|
struct value *index_value;
|
||||||
|
|
||||||
if (!print_array_indexes)
|
if (!options->print_array_indexes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
index_value = value_from_longest (index_type, index);
|
index_value = value_from_longest (index_type, index);
|
||||||
|
|
||||||
LA_PRINT_ARRAY_INDEX (index_value, stream, format, pretty);
|
LA_PRINT_ARRAY_INDEX (index_value, stream, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by various <lang>_val_print routines to print elements of an
|
/* Called by various <lang>_val_print routines to print elements of an
|
||||||
array in the form "<elem1>, <elem2>, <elem3>, ...".
|
array in the form "<elem1>, <elem2>, <elem3>, ...".
|
||||||
|
@ -1022,8 +1035,8 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
|
||||||
void
|
void
|
||||||
val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
CORE_ADDR address, struct ui_file *stream,
|
CORE_ADDR address, struct ui_file *stream,
|
||||||
int format, int deref_ref,
|
int recurse,
|
||||||
int recurse, enum val_prettyprint pretty,
|
const struct value_print_options *options,
|
||||||
unsigned int i)
|
unsigned int i)
|
||||||
{
|
{
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
|
@ -1070,11 +1083,11 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
annotate_array_section_begin (i, elttype);
|
annotate_array_section_begin (i, elttype);
|
||||||
|
|
||||||
for (; i < len && things_printed < print_max; i++)
|
for (; i < len && things_printed < options->print_max; i++)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
if (prettyprint_arrays)
|
if (options->prettyprint_arrays)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, ",\n");
|
fprintf_filtered (stream, ",\n");
|
||||||
print_spaces_filtered (2 + 2 * recurse, stream);
|
print_spaces_filtered (2 + 2 * recurse, stream);
|
||||||
|
@ -1086,7 +1099,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
wrap_here (n_spaces (2 + 2 * recurse));
|
wrap_here (n_spaces (2 + 2 * recurse));
|
||||||
maybe_print_array_index (index_type, i + low_bound_index,
|
maybe_print_array_index (index_type, i + low_bound_index,
|
||||||
stream, format, pretty);
|
stream, options);
|
||||||
|
|
||||||
rep1 = i + 1;
|
rep1 = i + 1;
|
||||||
reps = 1;
|
reps = 1;
|
||||||
|
@ -1097,21 +1110,21 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
++rep1;
|
++rep1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reps > repeat_count_threshold)
|
if (reps > options->repeat_count_threshold)
|
||||||
{
|
{
|
||||||
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
|
val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
|
||||||
deref_ref, recurse + 1, pretty, current_language);
|
recurse + 1, options, current_language);
|
||||||
annotate_elt_rep (reps);
|
annotate_elt_rep (reps);
|
||||||
fprintf_filtered (stream, " <repeats %u times>", reps);
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
||||||
annotate_elt_rep_end ();
|
annotate_elt_rep_end ();
|
||||||
|
|
||||||
i = rep1 - 1;
|
i = rep1 - 1;
|
||||||
things_printed += repeat_count_threshold;
|
things_printed += options->repeat_count_threshold;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
|
val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
|
||||||
deref_ref, recurse + 1, pretty, current_language);
|
recurse + 1, options, current_language);
|
||||||
annotate_elt ();
|
annotate_elt ();
|
||||||
things_printed++;
|
things_printed++;
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1186,8 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int *errnoptr
|
||||||
/* FIXME: Use target_read_string. */
|
/* FIXME: Use target_read_string. */
|
||||||
|
|
||||||
int
|
int
|
||||||
val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
|
val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream,
|
||||||
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
|
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
|
||||||
int errcode; /* Errno returned from bad reads. */
|
int errcode; /* Errno returned from bad reads. */
|
||||||
|
@ -1194,7 +1208,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
|
||||||
because finding the null byte (or available memory) is what actually
|
because finding the null byte (or available memory) is what actually
|
||||||
limits the fetch. */
|
limits the fetch. */
|
||||||
|
|
||||||
fetchlimit = (len == -1 ? print_max : min (len, print_max));
|
fetchlimit = (len == -1 ? options->print_max : min (len, options->print_max));
|
||||||
|
|
||||||
/* Now decide how large of chunks to try to read in one operation. This
|
/* Now decide how large of chunks to try to read in one operation. This
|
||||||
is also pretty simple. If LEN >= zero, then we want fetchlimit chars,
|
is also pretty simple. If LEN >= zero, then we want fetchlimit chars,
|
||||||
|
@ -1317,11 +1331,11 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
|
||||||
and then the error message. */
|
and then the error message. */
|
||||||
if (errcode == 0 || bufptr > buffer)
|
if (errcode == 0 || bufptr > buffer)
|
||||||
{
|
{
|
||||||
if (addressprint)
|
if (options->addressprint)
|
||||||
{
|
{
|
||||||
fputs_filtered (" ", stream);
|
fputs_filtered (" ", stream);
|
||||||
}
|
}
|
||||||
LA_PRINT_STRING (stream, buffer, (bufptr - buffer) / width, width, force_ellipsis);
|
LA_PRINT_STRING (stream, buffer, (bufptr - buffer) / width, width, force_ellipsis, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errcode != 0)
|
if (errcode != 0)
|
||||||
|
@ -1394,13 +1408,13 @@ set_output_radix_1 (int from_tty, unsigned radix)
|
||||||
switch (radix)
|
switch (radix)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
output_format = 'x'; /* hex */
|
user_print_options.output_format = 'x'; /* hex */
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
output_format = 0; /* decimal */
|
user_print_options.output_format = 0; /* decimal */
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
output_format = 'o'; /* octal */
|
user_print_options.output_format = 'o'; /* octal */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* FIXME: cagney/2002-03-17: This needs to revert the bad radix
|
/* FIXME: cagney/2002-03-17: This needs to revert the bad radix
|
||||||
|
@ -1494,7 +1508,8 @@ _initialize_valprint (void)
|
||||||
add_alias_cmd ("p", "print", no_class, 1, &showlist);
|
add_alias_cmd ("p", "print", no_class, 1, &showlist);
|
||||||
add_alias_cmd ("pr", "print", no_class, 1, &showlist);
|
add_alias_cmd ("pr", "print", no_class, 1, &showlist);
|
||||||
|
|
||||||
add_setshow_uinteger_cmd ("elements", no_class, &print_max, _("\
|
add_setshow_uinteger_cmd ("elements", no_class,
|
||||||
|
&user_print_options.print_max, _("\
|
||||||
Set limit on string chars or array elements to print."), _("\
|
Set limit on string chars or array elements to print."), _("\
|
||||||
Show limit on string chars or array elements to print."), _("\
|
Show limit on string chars or array elements to print."), _("\
|
||||||
\"set print elements 0\" causes there to be no limit."),
|
\"set print elements 0\" causes there to be no limit."),
|
||||||
|
@ -1502,7 +1517,8 @@ Show limit on string chars or array elements to print."), _("\
|
||||||
show_print_max,
|
show_print_max,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("null-stop", no_class, &stop_print_at_null, _("\
|
add_setshow_boolean_cmd ("null-stop", no_class,
|
||||||
|
&user_print_options.stop_print_at_null, _("\
|
||||||
Set printing of char arrays to stop at first null char."), _("\
|
Set printing of char arrays to stop at first null char."), _("\
|
||||||
Show printing of char arrays to stop at first null char."), NULL,
|
Show printing of char arrays to stop at first null char."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1510,7 +1526,7 @@ Show printing of char arrays to stop at first null char."), NULL,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_uinteger_cmd ("repeats", no_class,
|
add_setshow_uinteger_cmd ("repeats", no_class,
|
||||||
&repeat_count_threshold, _("\
|
&user_print_options.repeat_count_threshold, _("\
|
||||||
Set threshold for repeated print elements."), _("\
|
Set threshold for repeated print elements."), _("\
|
||||||
Show threshold for repeated print elements."), _("\
|
Show threshold for repeated print elements."), _("\
|
||||||
\"set print repeats 0\" causes all elements to be individually printed."),
|
\"set print repeats 0\" causes all elements to be individually printed."),
|
||||||
|
@ -1518,28 +1534,32 @@ Show threshold for repeated print elements."), _("\
|
||||||
show_repeat_count_threshold,
|
show_repeat_count_threshold,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("pretty", class_support, &prettyprint_structs, _("\
|
add_setshow_boolean_cmd ("pretty", class_support,
|
||||||
|
&user_print_options.prettyprint_structs, _("\
|
||||||
Set prettyprinting of structures."), _("\
|
Set prettyprinting of structures."), _("\
|
||||||
Show prettyprinting of structures."), NULL,
|
Show prettyprinting of structures."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_prettyprint_structs,
|
show_prettyprint_structs,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("union", class_support, &unionprint, _("\
|
add_setshow_boolean_cmd ("union", class_support,
|
||||||
|
&user_print_options.unionprint, _("\
|
||||||
Set printing of unions interior to structures."), _("\
|
Set printing of unions interior to structures."), _("\
|
||||||
Show printing of unions interior to structures."), NULL,
|
Show printing of unions interior to structures."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_unionprint,
|
show_unionprint,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("array", class_support, &prettyprint_arrays, _("\
|
add_setshow_boolean_cmd ("array", class_support,
|
||||||
|
&user_print_options.prettyprint_arrays, _("\
|
||||||
Set prettyprinting of arrays."), _("\
|
Set prettyprinting of arrays."), _("\
|
||||||
Show prettyprinting of arrays."), NULL,
|
Show prettyprinting of arrays."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
show_prettyprint_arrays,
|
show_prettyprint_arrays,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("address", class_support, &addressprint, _("\
|
add_setshow_boolean_cmd ("address", class_support,
|
||||||
|
&user_print_options.addressprint, _("\
|
||||||
Set printing of addresses."), _("\
|
Set printing of addresses."), _("\
|
||||||
Show printing of addresses."), NULL,
|
Show printing of addresses."), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1578,15 +1598,8 @@ Use 'show input-radix' or 'show output-radix' to independently show each."),
|
||||||
&showlist);
|
&showlist);
|
||||||
|
|
||||||
add_setshow_boolean_cmd ("array-indexes", class_support,
|
add_setshow_boolean_cmd ("array-indexes", class_support,
|
||||||
&print_array_indexes, _("\
|
&user_print_options.print_array_indexes, _("\
|
||||||
Set printing of array indexes."), _("\
|
Set printing of array indexes."), _("\
|
||||||
Show printing of array indexes"), NULL, NULL, show_print_array_indexes,
|
Show printing of array indexes"), NULL, NULL, show_print_array_indexes,
|
||||||
&setprintlist, &showprintlist);
|
&setprintlist, &showprintlist);
|
||||||
|
|
||||||
/* Give people the defaults which they are used to. */
|
|
||||||
prettyprint_structs = 0;
|
|
||||||
prettyprint_arrays = 0;
|
|
||||||
unionprint = 1;
|
|
||||||
addressprint = 1;
|
|
||||||
print_max = PRINT_MAX_DEFAULT;
|
|
||||||
}
|
}
|
||||||
|
|
103
gdb/valprint.h
103
gdb/valprint.h
|
@ -21,45 +21,98 @@
|
||||||
#ifndef VALPRINT_H
|
#ifndef VALPRINT_H
|
||||||
#define VALPRINT_H
|
#define VALPRINT_H
|
||||||
|
|
||||||
extern int prettyprint_arrays; /* Controls pretty printing of arrays. */
|
/* This is used to pass formatting options to various value-printing
|
||||||
extern int prettyprint_structs; /* Controls pretty printing of structures */
|
functions. */
|
||||||
extern int prettyprint_arrays; /* Controls pretty printing of arrays. */
|
struct value_print_options
|
||||||
|
{
|
||||||
|
/* Pretty-printing control. */
|
||||||
|
enum val_prettyprint pretty;
|
||||||
|
|
||||||
extern int vtblprint; /* Controls printing of vtbl's */
|
/* Controls pretty printing of arrays. */
|
||||||
extern int unionprint; /* Controls printing of nested unions. */
|
int prettyprint_arrays;
|
||||||
extern int addressprint; /* Controls pretty printing of addresses. */
|
|
||||||
extern int objectprint; /* Controls looking up an object's derived type
|
|
||||||
using what we find in its vtables. */
|
|
||||||
|
|
||||||
extern unsigned int print_max; /* Max # of chars for strings/vectors */
|
/* Controls pretty printing of structures. */
|
||||||
|
int prettyprint_structs;
|
||||||
|
|
||||||
/* Flag to low-level print routines that this value is being printed
|
/* Controls printing of virtual tables. */
|
||||||
in an epoch window. We'd like to pass this as a parameter, but
|
int vtblprint;
|
||||||
every routine would need to take it. Perhaps we can encapsulate
|
|
||||||
this in the I/O stream once we have GNU stdio. */
|
|
||||||
extern int inspect_it;
|
|
||||||
|
|
||||||
/* Print repeat counts if there are more than this many repetitions of an
|
/* Controls printing of nested unions. */
|
||||||
element in an array. Referenced by the low level language dependent
|
int unionprint;
|
||||||
print routines. */
|
|
||||||
extern unsigned int repeat_count_threshold;
|
|
||||||
|
|
||||||
extern int output_format;
|
/* Controls printing of addresses. */
|
||||||
|
int addressprint;
|
||||||
|
|
||||||
extern int stop_print_at_null; /* Stop printing at null char? */
|
/* Controls looking up an object's derived type using what we find
|
||||||
|
in its vtables. */
|
||||||
|
int objectprint;
|
||||||
|
|
||||||
|
/* Maximum number of chars to print for a string pointer value or vector
|
||||||
|
contents, or UINT_MAX for no limit. Note that "set print elements 0"
|
||||||
|
stores UINT_MAX in print_max, which displays in a show command as
|
||||||
|
"unlimited". */
|
||||||
|
unsigned int print_max;
|
||||||
|
|
||||||
|
/* Print repeat counts if there are more than this many repetitions
|
||||||
|
of an element in an array. */
|
||||||
|
unsigned int repeat_count_threshold;
|
||||||
|
|
||||||
|
/* The global output format letter. */
|
||||||
|
int output_format;
|
||||||
|
|
||||||
|
/* The current format letter. This is set locally for a given call,
|
||||||
|
e.g. when the user passes a format to "print". */
|
||||||
|
int format;
|
||||||
|
|
||||||
|
/* Stop printing at null character? */
|
||||||
|
int stop_print_at_null;
|
||||||
|
|
||||||
|
/* True if this value is being printed in an epoch window. */
|
||||||
|
int inspect_it;
|
||||||
|
|
||||||
|
/* True if we should print the index of each element when printing
|
||||||
|
an array. */
|
||||||
|
int print_array_indexes;
|
||||||
|
|
||||||
|
/* If nonzero, then dereference references, otherwise just print
|
||||||
|
them like pointers. */
|
||||||
|
int deref_ref;
|
||||||
|
|
||||||
|
/* If nonzero, print static fields. */
|
||||||
|
int static_field_print;
|
||||||
|
|
||||||
|
/* If nonzero, print static fields for Pascal. FIXME: C++ and Java
|
||||||
|
share one flag, why not Pascal too? */
|
||||||
|
int pascal_static_field_print;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The global print options set by the user. In general this should
|
||||||
|
not be directly accessed, except by set/show commands. Ordinary
|
||||||
|
code should call get_user_print_options instead. */
|
||||||
|
extern struct value_print_options user_print_options;
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options. */
|
||||||
|
extern void get_user_print_options (struct value_print_options *opts);
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options, but with
|
||||||
|
pretty-printing disabled. */
|
||||||
|
extern void get_raw_print_options (struct value_print_options *opts);
|
||||||
|
|
||||||
|
/* Initialize *OPTS to be a copy of the user print options, but using
|
||||||
|
FORMAT as the formatting option. */
|
||||||
|
extern void get_formatted_print_options (struct value_print_options *opts,
|
||||||
|
char format);
|
||||||
|
|
||||||
extern int print_array_indexes_p (void);
|
|
||||||
|
|
||||||
extern int get_array_bounds (struct type *type, long *low_bound,
|
extern int get_array_bounds (struct type *type, long *low_bound,
|
||||||
long *high_bound);
|
long *high_bound);
|
||||||
|
|
||||||
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
|
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream,
|
||||||
enum val_prettyprint pretty);
|
const struct value_print_options *options);
|
||||||
|
|
||||||
extern void val_print_array_elements (struct type *, const gdb_byte *,
|
extern void val_print_array_elements (struct type *, const gdb_byte *,
|
||||||
CORE_ADDR, struct ui_file *, int,
|
CORE_ADDR, struct ui_file *, int,
|
||||||
int, int, enum val_prettyprint,
|
const struct value_print_options *,
|
||||||
unsigned int);
|
unsigned int);
|
||||||
|
|
||||||
extern void val_print_type_code_int (struct type *, const gdb_byte *,
|
extern void val_print_type_code_int (struct type *, const gdb_byte *,
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "dfp.h"
|
#include "dfp.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "python/python.h"
|
#include "python/python.h"
|
||||||
|
|
||||||
|
@ -708,9 +709,11 @@ show_values (char *num_exp, int from_tty)
|
||||||
|
|
||||||
for (i = num; i < num + 10 && i <= value_history_count; i++)
|
for (i = num; i < num + 10 && i <= value_history_count; i++)
|
||||||
{
|
{
|
||||||
|
struct value_print_options opts;
|
||||||
val = access_value_history (i);
|
val = access_value_history (i);
|
||||||
printf_filtered (("$%d = "), i);
|
printf_filtered (("$%d = "), i);
|
||||||
value_print (val, gdb_stdout, 0, Val_pretty_default);
|
get_user_print_options (&opts);
|
||||||
|
value_print (val, gdb_stdout, &opts);
|
||||||
printf_filtered (("\n"));
|
printf_filtered (("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,7 +972,9 @@ show_convenience (char *ignore, int from_tty)
|
||||||
{
|
{
|
||||||
struct internalvar *var;
|
struct internalvar *var;
|
||||||
int varseen = 0;
|
int varseen = 0;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
|
get_user_print_options (&opts);
|
||||||
for (var = internalvars; var; var = var->next)
|
for (var = internalvars; var; var = var->next)
|
||||||
{
|
{
|
||||||
if (!varseen)
|
if (!varseen)
|
||||||
|
@ -978,7 +983,7 @@ show_convenience (char *ignore, int from_tty)
|
||||||
}
|
}
|
||||||
printf_filtered (("$%s = "), var->name);
|
printf_filtered (("$%s = "), var->name);
|
||||||
value_print (value_of_internalvar (var), gdb_stdout,
|
value_print (value_of_internalvar (var), gdb_stdout,
|
||||||
0, Val_pretty_default);
|
&opts);
|
||||||
printf_filtered (("\n"));
|
printf_filtered (("\n"));
|
||||||
}
|
}
|
||||||
if (!varseen)
|
if (!varseen)
|
||||||
|
|
18
gdb/value.h
18
gdb/value.h
|
@ -32,6 +32,7 @@ struct symbol;
|
||||||
struct type;
|
struct type;
|
||||||
struct ui_file;
|
struct ui_file;
|
||||||
struct language_defn;
|
struct language_defn;
|
||||||
|
struct value_print_options;
|
||||||
|
|
||||||
/* The structure which defines the type of a value. It should never
|
/* The structure which defines the type of a value. It should never
|
||||||
be possible for a program lval value to survive over a call to the
|
be possible for a program lval value to survive over a call to the
|
||||||
|
@ -526,8 +527,8 @@ extern void print_floating (const gdb_byte *valaddr, struct type *type,
|
||||||
extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
|
extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
|
||||||
struct ui_file *stream);
|
struct ui_file *stream);
|
||||||
|
|
||||||
extern int value_print (struct value *val, struct ui_file *stream, int format,
|
extern int value_print (struct value *val, struct ui_file *stream,
|
||||||
enum val_prettyprint pretty);
|
const struct value_print_options *options);
|
||||||
|
|
||||||
extern void value_print_array_elements (struct value *val,
|
extern void value_print_array_elements (struct value *val,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int format,
|
||||||
|
@ -537,19 +538,18 @@ extern struct value *value_release_to_mark (struct value *mark);
|
||||||
|
|
||||||
extern int val_print (struct type *type, const gdb_byte *valaddr,
|
extern int val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
int embedded_offset, CORE_ADDR address,
|
int embedded_offset, CORE_ADDR address,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse,
|
const struct value_print_options *options,
|
||||||
enum val_prettyprint pretty,
|
|
||||||
const struct language_defn *language);
|
const struct language_defn *language);
|
||||||
|
|
||||||
extern int common_val_print (struct value *val,
|
extern int common_val_print (struct value *val,
|
||||||
struct ui_file *stream, int format,
|
struct ui_file *stream, int recurse,
|
||||||
int deref_ref, int recurse,
|
const struct value_print_options *options,
|
||||||
enum val_prettyprint pretty,
|
|
||||||
const struct language_defn *language);
|
const struct language_defn *language);
|
||||||
|
|
||||||
extern int val_print_string (CORE_ADDR addr, int len, int width,
|
extern int val_print_string (CORE_ADDR addr, int len, int width,
|
||||||
struct ui_file *stream);
|
struct ui_file *stream,
|
||||||
|
const struct value_print_options *options);
|
||||||
|
|
||||||
extern void print_variable_value (struct symbol *var,
|
extern void print_variable_value (struct symbol *var,
|
||||||
struct frame_info *frame,
|
struct frame_info *frame,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "wrapper.h"
|
#include "wrapper.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
#include "valprint.h"
|
||||||
|
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
@ -1791,6 +1792,7 @@ value_get_print_value (struct value *value, enum varobj_display_formats format)
|
||||||
struct ui_file *stb;
|
struct ui_file *stb;
|
||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
char *thevalue;
|
char *thevalue;
|
||||||
|
struct value_print_options opts;
|
||||||
|
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1798,8 +1800,9 @@ value_get_print_value (struct value *value, enum varobj_display_formats format)
|
||||||
stb = mem_fileopen ();
|
stb = mem_fileopen ();
|
||||||
old_chain = make_cleanup_ui_file_delete (stb);
|
old_chain = make_cleanup_ui_file_delete (stb);
|
||||||
|
|
||||||
common_val_print (value, stb, format_code[(int) format], 1, 0, 0,
|
get_formatted_print_options (&opts, format_code[(int) format]);
|
||||||
current_language);
|
opts.deref_ref = 0;
|
||||||
|
common_val_print (value, stb, 0, &opts, current_language);
|
||||||
thevalue = ui_file_xstrdup (stb, &dummy);
|
thevalue = ui_file_xstrdup (stb, &dummy);
|
||||||
|
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue