diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:34:19 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:34:19 +0000 |
commit | e18b27534c2181c92dc9b685adc05bcf6b685817 (patch) | |
tree | 2098d8656520c417bd086ec4b4e37d601665ea45 /gdb/doc | |
parent | 93d86cefdf1902d003f0d54f27777b8ea4f75b13 (diff) | |
download | gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.zip gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.tar.gz gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.tar.bz2 |
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.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 141 |
2 files changed, 150 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8c9d9b5..7763cce 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,6 +1,15 @@ 2011-10-09 Jan Kratochvil <jan.kratochvil@redhat.com> Eli Zaretskii <eliz@gnu.org> + 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. + +2011-10-09 Jan Kratochvil <jan.kratochvil@redhat.com> + Eli Zaretskii <eliz@gnu.org> + Recognize virtual tail call frames. * gdb.texinfo (Optimized Code): Add reference to Tail Call Frames. (Tail Call Frames): New node. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index fdf66c3..9de96c1 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -7941,6 +7941,120 @@ thus speeding up the display of each Ada frame. @item show print frame-arguments Show how the value of arguments should be displayed when printing a frame. +@item set print entry-values @var{value} +@kindex set print entry-values +Set printing of frame argument values at function entry. In some cases +@value{GDBN} can determine the value of function argument which was passed by +the function caller, even if the value was modified inside the called function +and therefore is different. With optimized code, the current value could be +unavailable, but the entry value may still be known. + +The default value is @code{default} (see below for its description). Older +@value{GDBN} behaved as with the setting @code{no}. Compilers not supporting +this feature will behave in the @code{default} setting the same way as with the +@code{no} setting. + +This functionality is currently supported only by DWARF 2 debugging format and +the compiler has to produce @samp{DW_TAG_GNU_call_site} tags. With +@value{NGCC}, you need to specify @option{-O -g} during compilation, to get +this information. + +The @var{value} parameter can be one of the following: + +@table @code +@item no +Print only actual parameter values, never print values from function entry +point. +@smallexample +#0 equal (val=5) +#0 different (val=6) +#0 lost (val=<optimized out>) +#0 born (val=10) +#0 invalid (val=<optimized out>) +@end smallexample + +@item only +Print only parameter values from function entry point. The actual parameter +values are never printed. +@smallexample +#0 equal (val@@entry=5) +#0 different (val@@entry=5) +#0 lost (val@@entry=5) +#0 born (val@@entry=<optimized out>) +#0 invalid (val@@entry=<optimized out>) +@end smallexample + +@item preferred +Print only parameter values from function entry point. If value from function +entry point is not known while the actual value is known, print the actual +value for such parameter. +@smallexample +#0 equal (val@@entry=5) +#0 different (val@@entry=5) +#0 lost (val@@entry=5) +#0 born (val=10) +#0 invalid (val@@entry=<optimized out>) +@end smallexample + +@item if-needed +Print actual parameter values. If actual parameter value is not known while +value from function entry point is known, print the entry point value for such +parameter. +@smallexample +#0 equal (val=5) +#0 different (val=6) +#0 lost (val@@entry=5) +#0 born (val=10) +#0 invalid (val=<optimized out>) +@end smallexample + +@item both +Always print both the actual parameter value and its value from function entry +point, even if values of one or both are not available due to compiler +optimizations. +@smallexample +#0 equal (val=5, val@@entry=5) +#0 different (val=6, val@@entry=5) +#0 lost (val=<optimized out>, val@@entry=5) +#0 born (val=10, val@@entry=<optimized out>) +#0 invalid (val=<optimized out>, val@@entry=<optimized out>) +@end smallexample + +@item compact +Print the actual parameter value if it is known and also its value from +function entry point if it is known. If neither is known, print for the actual +value @code{<optimized out>}. If not in MI mode (@pxref{GDB/MI}) and if both +values are known and identical, print the shortened +@code{param=param@@entry=VALUE} notation. +@smallexample +#0 equal (val=val@@entry=5) +#0 different (val=6, val@@entry=5) +#0 lost (val@@entry=5) +#0 born (val=10) +#0 invalid (val=<optimized out>) +@end smallexample + +@item default +Always print the actual parameter value. Print also its value from function +entry point, but only if it is known. If not in MI mode (@pxref{GDB/MI}) and +if both values are known and identical, print the shortened +@code{param=param@@entry=VALUE} notation. +@smallexample +#0 equal (val=val@@entry=5) +#0 different (val=6, val@@entry=5) +#0 lost (val=<optimized out>, val@@entry=5) +#0 born (val=10) +#0 invalid (val=<optimized out>) +@end smallexample +@end table + +For analysis messages on possible failures of frame argument values at function +entry resolution see @ref{set debug entry-values}. + +@item show print entry-values +Show the method being used for printing of frame argument values at function +entry. + @item set print repeats @cindex repeated array elements Set the threshold for suppressing display of repeated array @@ -9600,6 +9714,7 @@ tries to show at least all the unambiguous top tail callers and all the unambiguous bottom tail calees, if any. @table @code +@anchor{set debug entry-values} @item set debug entry-values @kindex set debug entry-values When set to on, enables printing of analysis messages for both frame argument @@ -9675,6 +9790,32 @@ also ambigous. The only non-ambiguous frame is the one for function @code{a}, therefore this one is displayed to the user while the ambiguous frames are omitted. +There can be also reasons why printing of frame argument values at function +entry may fail: + +@smallexample +int v; +static void __attribute__((noinline, noclone)) c (int i) @{ v++; @} +static void __attribute__((noinline, noclone)) a (int i); +static void __attribute__((noinline, noclone)) b (int i) @{ a (i); @} +static void __attribute__((noinline, noclone)) a (int i) +@{ if (i) b (i - 1); else c (0); @} +int main (void) @{ a (5); return 0; @} + +(gdb) bt +#0 c (i=i@@entry=0) at t.c:2 +#1 0x0000000000400428 in a (DW_OP_GNU_entry_value resolving has found +function "a" at 0x400420 can call itself via tail calls +i=<optimized out>) at t.c:6 +#2 0x000000000040036e in main () at t.c:7 +@end smallexample + +@value{GDBN} cannot find out from the inferior state if and how many times did +function @code{a} call itself (via function @code{b}) as these calls would be +tail calls. Such tail calls would modify thue @code{i} variable, therefore +@value{GDBN} cannot be sure the value it knows would be right - @value{GDBN} +prints @code{<optimized out>} instead. + @node Macros @chapter C Preprocessor Macros |