From e18b27534c2181c92dc9b685adc05bcf6b685817 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 9 Oct 2011 19:34:19 +0000 Subject: gdb/ Display @entry parameter values (without references). * dwarf2expr.c (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): New functions. * dwarf2expr.h (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset): New declarations. * dwarf2loc.c (dwarf2_find_location_expression): Support location list entry record. (dwarf_entry_parameter_to_value, value_of_dwarf_reg_entry) (value_of_dwarf_block_entry, locexpr_read_variable_at_entry): New functions. (dwarf2_locexpr_funcs): Install locexpr_read_variable_at_entry. (loclist_read_variable_at_entry): New function. (dwarf2_loclist_funcs): Install loclist_read_variable_at_entry. * dwarf2read.c (read_call_site_scope): Support also DW_OP_fbreg in DW_AT_location, call dwarf_block_to_sp_offset for it. * frame.h (print_entry_values_no, print_entry_values_only) (print_entry_values_preferred, print_entry_values_if_needed) (print_entry_values_both, print_entry_values_compact) (print_entry_values_default, print_entry_values): New declarations. (struct frame_arg): New field entry_kind. (read_frame_arg): New parameter entryargp. * mi/mi-cmd-stack.c (list_arg_or_local): New gdb_assert for arg->entry_kind. Optionally print the `@entry' suffix. (list_args_or_locals): New variable entryarg, initialize it. Initialize also entry_kind of arg and entryarg. Conditionalize list_arg_or_local for arg, add list_arg_or_local for entryarg. Call xfree for entryarg.error. * stack.c (print_entry_values_no, print_entry_values_only) (print_entry_values_preferred, print_entry_values_if_needed) (print_entry_values_both, print_entry_values_compact) (print_entry_values_default, print_entry_values_choices) (print_entry_values): New variables. (print_frame_arg): New gdb_assert for arg->entry_kind. Optionally print the `@entry' suffix, possibly in combination for print_entry_values_compact. (read_frame_arg): New parameter entryargp, new variables entryval, entryval_error and val_equal. Read in also entryargp, respect print_entry_values, compare the values using val_equal, fill in also argp->entry_kind (together with entryargp->entry_kind). (print_frame_args): New variable entryarg, initialize it. Conditionalize print_frame_arg for arg, add print_frame_arg for entryarg. Call xfree for entryarg.error. (_initialize_stack): Call add_setshow_enum_cmd for `entry-values'. * symtab.h (struct symbol_computed_ops): New field read_variable_at_entry. gdb/doc/ Display @entry parameter values (without references). * gdb.texinfo (Tail Call Frames): Add anchor. Add self tail call example. (Print Settings): New description of set print entry-values and show print entry-values. gdb/testsuite/ Display @entry parameter values (without references). * gdb.arch/amd64-entry-value.cc (locexpr, stacktest, data, data2) (different, validity, invalid): New functions. (main): Call them. * gdb.arch/amd64-entry-value.exp: New breakpoints breakhere_locexpr, stacktest, breakhere_stacktest, different, breakhere_different, breakhere_validity and breakhere_invalid. (entry: bt): Update for @entry. (entry_locexpr: *, entry_stack: *, entry_equal: *, entry_different: *) (entry_validity: *, entry_invalid: *): Many new tests. * gdb.base/break.exp (run until breakpoint set at small function, optimized file): Accept also the @entry suffix. * gdb.mi/Makefile.in (PROGS): Add mi2-amd64-entry-value. * gdb.mi/mi2-amd64-entry-value.c: New files. * gdb.mi/mi2-amd64-entry-value.exp: New files. --- gdb/mi/mi-cmd-stack.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'gdb/mi/mi-cmd-stack.c') diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 2e32eff..e1393f0 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -256,11 +256,17 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, || values == PRINT_SIMPLE_VALUES || (values == PRINT_ALL_VALUES && (arg->val != NULL || arg->error != NULL))); + gdb_assert (arg->entry_kind == print_entry_values_no + || (arg->entry_kind == print_entry_values_only + && (arg->val || arg->error))); if (values != PRINT_NO_VALUES || what == all) cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (arg->sym)); + fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb->stream); + if (arg->entry_kind == print_entry_values_only) + fputs_filtered ("@entry", stb->stream); + ui_out_field_stream (uiout, "name", stb); if (what == all && SYMBOL_IS_ARGUMENT (arg->sym)) ui_out_field_int (uiout, "arg", 1); @@ -380,7 +386,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values, if (print_me) { struct symbol *sym2; - struct frame_arg arg; + struct frame_arg arg, entryarg; if (SYMBOL_IS_ARGUMENT (sym)) sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym), @@ -391,6 +397,10 @@ list_args_or_locals (enum what_to_list what, enum print_values values, memset (&arg, 0, sizeof (arg)); arg.sym = sym2; + arg.entry_kind = print_entry_values_no; + memset (&entryarg, 0, sizeof (entryarg)); + entryarg.sym = sym2; + entryarg.entry_kind = print_entry_values_no; switch (values) { @@ -401,13 +411,17 @@ list_args_or_locals (enum what_to_list what, enum print_values values, && TYPE_CODE (type) != TYPE_CODE_UNION) { case PRINT_ALL_VALUES: - read_frame_arg (sym2, fi, &arg); + read_frame_arg (sym2, fi, &arg, &entryarg); } break; } - list_arg_or_local (&arg, what, values); + if (arg.entry_kind != print_entry_values_only) + list_arg_or_local (&arg, what, values); + if (entryarg.entry_kind != print_entry_values_no) + list_arg_or_local (&entryarg, what, values); xfree (arg.error); + xfree (entryarg.error); } } if (BLOCK_FUNCTION (block)) -- cgit v1.1