From 6c9125356b197ff5256c1a7ac700f60c283245ff Mon Sep 17 00:00:00 2001 From: qiyao Date: Tue, 27 Aug 2013 05:20:56 +0000 Subject: Add options to skip unavailable locals This is the patch to add new option '--skip-unavailable' to MI commands '-stack-list-{locals, arguments, variables}'. This patch extends list_args_or_locals to add a new parameter 'skip_unavailable', and don't list locals or arguments if values are unavailable and 'skip_unavailable' is true. This is inspecting a trace frame (tfind mode), where only a few locals have been collected. -stack-list-locals, no switch vs new switch: -stack-list-locals --simple-values ^done,locals=[{name="array",type="unsigned char [2]"},{name="i",type="int",value=""}] -stack-list-locals --skip-unavailable --simple-values ^done,locals=[{name="array",type="unsigned char [2]"}] -stack-list-arguments, no switch vs new switch: -stack-list-arguments --simple-values ^done,stack-args=[frame={level="0",args=[{name="j",type="int",value="4"},{name="s",type="char *",value=""}]},frame={level="1",args=[]}] -stack-list-arguments --skip-unavailable --simple-values ^done,stack-args=[frame={level="0",args=[{name="j",type="int",value="4"}]},frame={level="1",args=[]}] -stack-list-variables, no switch vs new switch: -stack-list-variables --simple-values ^done,variables=[{name="j",arg="1",type="int",value="4"},{name="s",arg="1",type="char *",value=""},{name="array",type="unsigned char [2]"},{name="i",type="int",value=""}] -stack-list-variables --skip-unavailable --simple-values ^done,variables=[{name="j",arg="1",type="int",value="4"},{name="array",type="unsigned char [2]"}] tests are added to test these new options. gdb: 2013-08-27 Pedro Alves Yao Qi * mi/mi-cmd-stack.c (list_args_or_locals): Adjust prototype. (parse_no_frames_option): Remove. (mi_cmd_stack_list_locals): Handle --skip-unavailable. (mi_cmd_stack_list_args): Adjust. (mi_cmd_stack_list_variables): Handle --skip-unavailable. (list_arg_or_local): Add new parameter 'skip_unavailable'. Return early if SKIP_UNAVAILABLE is true and ARG->val is unavailable. Caller update. (list_args_or_locals): New parameter 'skip_unavailable'. Handle it. * valprint.c (scalar_type_p): Rename to ... (val_print_scalar_type_p): ... this. Make extern. (val_print, value_check_printable): Adjust. * valprint.h (val_print_scalar_type_p): Declare. * value.c (value_entirely_unavailable): New function. * value.h (value_entirely_unavailable): Declare. * NEWS: Mention the new option "--skip-unavailable" to MI commands '-stack-list-locals', '-stack-list-arguments' and '-stack-list-variables'. gdb/doc: 2013-08-27 Pedro Alves Yao Qi * gdb.texinfo (GDB/MI Stack Manipulation) <-stack-list-locals>: Document new --skip-unavailable option. <-stack-list-variables>: Document new --skip-unavailable option. gdb/testsuite: 2013-08-27 Yao Qi * gdb.trace/entry-values.exp: Test unavailable entry value is not shown when option '--skip-unavailable' is specified. * gdb.trace/mi-trace-unavailable.exp (test_trace_unavailable): Add tests for new option '--skip-unavailable'. --- gdb/doc/ChangeLog | 7 +++++++ gdb/doc/gdb.texinfo | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 61a6f4151ba..67d33206877 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-27 Pedro Alves + Yao Qi + + * gdb.texinfo (GDB/MI Stack Manipulation) <-stack-list-locals>: + Document new --skip-unavailable option. + <-stack-list-variables>: Document new --skip-unavailable option. + 2013-08-26 Doug Evans * gdb.texinfo (Maintenance Commands): "maint print objfiles" now takes diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index c88ee65a6fb..21250feafa9 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -31249,7 +31249,7 @@ For a stack with frame levels 0 through 11: @subsubheading Synopsis @smallexample - -stack-list-arguments [ --no-frame-filters ] @var{print-values} + -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] @var{print-values} [ @var{low-frame} @var{high-frame} ] @end smallexample @@ -31269,6 +31269,9 @@ type and value for simple data types, and the name and type for arrays, structures and unions. If the option @code{--no-frame-filters} is supplied, then Python frame filters will not be executed. +If the @code{--skip-unavailable} option is specified, arguments that +are not available are not listed. Partially available arguments +are still displayed, however. Use of this command to obtain arguments in a single frame is deprecated in favor of the @samp{-stack-list-variables} command. @@ -31453,7 +31456,7 @@ Show a single frame: @subsubheading Synopsis @smallexample - -stack-list-locals [ --no-frame-filters ] @var{print-values} + -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] @var{print-values} @end smallexample Display the local variable names for the selected frame. If @@ -31467,6 +31470,10 @@ other data types when the user wishes to explore their values in more detail. If the option @code{--no-frame-filters} is supplied, then Python frame filters will not be executed. +If the @code{--skip-unavailable} option is specified, local variables +that are not available are not listed. Partially available local +variables are still displayed, however. + This command is deprecated in favor of the @samp{-stack-list-variables} command. @@ -31497,7 +31504,7 @@ This command is deprecated in favor of the @subsubheading Synopsis @smallexample - -stack-list-variables [ --no-frame-filters ] @var{print-values} + -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] @var{print-values} @end smallexample Display the names of local variables and function arguments for the selected frame. If @@ -31508,6 +31515,10 @@ type and value for simple data types, and the name and type for arrays, structures and unions. If the option @code{--no-frame-filters} is supplied, then Python frame filters will not be executed. +If the @code{--skip-unavailable} option is specified, local variables +and arguments that are not available are not listed. Partially +available arguments and local variables are still displayed, however. + @subsubheading Example @smallexample -- cgit v1.2.1