[Lldb-commits] [lldb] r169961 - in /lldb/trunk: source/Commands/CommandObjectExpression.cpp source/Interpreter/CommandInterpreter.cpp source/Interpreter/OptionGroupValueObjectDisplay.cpp test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/lang/objc/foundation/TestObjCMethods.py test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py

Enrico Granata egranata at apple.com
Fri Dec 14 14:33:43 PST 2012


Hi Filipe,

There are a couple reasons why I did not feel that was necessary:
	1) we are trying to use long option names consistently in the test suite
	2) I believe there is a test case that checks that short options work at the command interpreter level, so I expect we would quickly catch regressions in that area
	3) "po" is defined as "expr -O --" so any test that uses "po" is implicitly checking that -O does the right thing

With all the above said, I am not opposed to adding a command to an existing test case that does "expr -O <something>" just for completeness.

Enrico Granata
✉ egranata@.com
✆ (408) 972-7683

On Dec 14, 2012, at 12:33 PM, Filipe Cabecinhas <filcab at gmail.com> wrote:

> Hi Enrico,
> 
> Shouldn't at least one or two tests actually use the '-O' short option? Just to exercise that code path at least once.
> 
> Thanks,
> 
>   Filipe
> 
>   F
> 
> 
> 
> On Tue, Dec 11, 2012 at 7:23 PM, Enrico Granata <egranata at apple.com> wrote:
> Author: enrico
> Date: Tue Dec 11 21:23:37 2012
> New Revision: 169961
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=169961&view=rev
> Log:
> Option changes:
> the option to print the runtime-specific description has been modified in the frame variable, memory read and expression command.
> 
> All three commands now support a --object-description option, with a shortcut of -O (uppercase letter o)
> 
> This is a breaking change:
> frame variable used --objc as the long option name
> expression used -o as a shortcut
> memory read uses --objd as the long option name
> 
> Hopefully, most users won't be affected by the change since people tend to access "expression --object-description" under the alias "po" which still works
> 
> The test suite has been tweaked accordingly.
> 
> 
> Modified:
>     lldb/trunk/source/Commands/CommandObjectExpression.cpp
>     lldb/trunk/source/Interpreter/CommandInterpreter.cpp
>     lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
>     lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>     lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py
>     lldb/trunk/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
> 
> Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Dec 11 21:23:37 2012
> @@ -56,7 +56,7 @@
>      { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "dynamic-value",      'd', required_argument, NULL, 0, eArgTypeBoolean,    "Upcast the value resulting from the expression to its dynamic type if available."},
>      { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout",            't', required_argument, NULL, 0, eArgTypeUnsignedInteger,  "Timeout value for running the expression."},
>      { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error",    'u', required_argument, NULL, 0, eArgTypeBoolean,    "Clean up program state if the expression causes a crash, breakpoint hit or signal."},
> -    { LLDB_OPT_SET_2                 , false, "object-description", 'o', no_argument,       NULL, 0, eArgTypeNone,       "Print the object description of the value resulting from the expression."},
> +    { LLDB_OPT_SET_2                 , false, "object-description", 'O', no_argument,       NULL, 0, eArgTypeNone,       "Print the object description of the value resulting from the expression."},
>  };
> 
> 
> @@ -113,7 +113,7 @@
>          }
>          break;
> 
> -    case 'o':
> +    case 'O':
>          print_object = true;
>          break;
> 
> 
> Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
> +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Dec 11 21:23:37 2012
> @@ -279,7 +279,7 @@
>          AddOrReplaceAliasOptions ("call", alias_arguments_vector_sp);
> 
>          alias_arguments_vector_sp.reset (new OptionArgVector);
> -        ProcessAliasOptionsArgs (cmd_obj_sp, "-o --", alias_arguments_vector_sp);
> +        ProcessAliasOptionsArgs (cmd_obj_sp, "-O --", alias_arguments_vector_sp);
>          AddAlias ("po", cmd_obj_sp);
>          AddOrReplaceAliasOptions ("po", alias_arguments_vector_sp);
>      }
> 
> Modified: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
> +++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp Tue Dec 11 21:23:37 2012
> @@ -33,17 +33,17 @@
>  static OptionDefinition
>  g_option_table[] =
>  {
> -    { LLDB_OPT_SET_1, false, "dynamic-type",     'd', required_argument, g_dynamic_value_types, 0, eArgTypeNone,      "Show the object as its full dynamic type, not its static type, if available."},
> -    { LLDB_OPT_SET_1, false, "synthetic-type",   'S', required_argument, NULL, 0, eArgTypeBoolean,   "Show the object obeying its synthetic provider, if available."},
> -    { LLDB_OPT_SET_1, false, "depth",            'D', required_argument, NULL, 0, eArgTypeCount,     "Set the max recurse depth when dumping aggregate types (default is infinity)."},
> -    { LLDB_OPT_SET_1, false, "flat",             'F', no_argument,       NULL, 0, eArgTypeNone,      "Display results in a flat format that uses expression paths for each variable or member."},
> -    { LLDB_OPT_SET_1, false, "location",         'L', no_argument,       NULL, 0, eArgTypeNone,      "Show variable location information."},
> -    { LLDB_OPT_SET_1, false, "objc",             'O', no_argument,       NULL, 0, eArgTypeNone,      "Print as an Objective-C object."},
> -    { LLDB_OPT_SET_1, false, "ptr-depth",        'P', required_argument, NULL, 0, eArgTypeCount,     "The number of pointers to be traversed when dumping values (default is zero)."},
> -    { LLDB_OPT_SET_1, false, "show-types",       'T', no_argument,       NULL, 0, eArgTypeNone,      "Show variable types when dumping values."},
> -    { LLDB_OPT_SET_1, false, "no-summary-depth", 'Y', optional_argument, NULL, 0, eArgTypeCount,     "Set the depth at which omitting summary information stops (default is 1)."},
> -    { LLDB_OPT_SET_1, false, "raw-output",       'R', no_argument,       NULL, 0, eArgTypeNone,      "Don't use formatting options."},
> -    { LLDB_OPT_SET_1, false, "show-all-children",'A', no_argument,       NULL, 0, eArgTypeNone,      "Ignore the upper bound on the number of children to show."},
> +    { LLDB_OPT_SET_1, false, "dynamic-type",       'd', required_argument, g_dynamic_value_types, 0, eArgTypeNone,      "Show the object as its full dynamic type, not its static type, if available."},
> +    { LLDB_OPT_SET_1, false, "synthetic-type",     'S', required_argument, NULL, 0, eArgTypeBoolean,   "Show the object obeying its synthetic provider, if available."},
> +    { LLDB_OPT_SET_1, false, "depth",              'D', required_argument, NULL, 0, eArgTypeCount,     "Set the max recurse depth when dumping aggregate types (default is infinity)."},
> +    { LLDB_OPT_SET_1, false, "flat",               'F', no_argument,       NULL, 0, eArgTypeNone,      "Display results in a flat format that uses expression paths for each variable or member."},
> +    { LLDB_OPT_SET_1, false, "location",           'L', no_argument,       NULL, 0, eArgTypeNone,      "Show variable location information."},
> +    { LLDB_OPT_SET_1, false, "object-description", 'O', no_argument,       NULL, 0, eArgTypeNone,      "Print as an Objective-C object."},
> +    { LLDB_OPT_SET_1, false, "ptr-depth",          'P', required_argument, NULL, 0, eArgTypeCount,     "The number of pointers to be traversed when dumping values (default is zero)."},
> +    { LLDB_OPT_SET_1, false, "show-types",         'T', no_argument,       NULL, 0, eArgTypeNone,      "Show variable types when dumping values."},
> +    { LLDB_OPT_SET_1, false, "no-summary-depth",   'Y', optional_argument, NULL, 0, eArgTypeCount,     "Set the depth at which omitting summary information stops (default is 1)."},
> +    { LLDB_OPT_SET_1, false, "raw-output",         'R', no_argument,       NULL, 0, eArgTypeNone,      "Don't use formatting options."},
> +    { LLDB_OPT_SET_1, false, "show-all-children",  'A', no_argument,       NULL, 0, eArgTypeNone,      "Ignore the upper bound on the number of children to show."},
>      { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
>  };
> 
> 
> Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
> +++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Dec 11 21:23:37 2012
> @@ -420,9 +420,9 @@
>          self.expect('expr -d true -- @"Hello"',
>              substrs = ['Hello'])
> 
> -        self.expect('expr -d true -o -- @"Hello"',
> +        self.expect('expr -d true --object-description -- @"Hello"',
>              substrs = ['Hello'])
> -        self.expect('expr -d true -o -- @"Hello"', matching=False,
> +        self.expect('expr -d true --object-description -- @"Hello"', matching=False,
>              substrs = ['@"Hello" Hello'])
> 
> 
> 
> Modified: lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py (original)
> +++ lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py Tue Dec 11 21:23:37 2012
> @@ -204,7 +204,7 @@
>          #
>          # Test new feature with r115115:
>          # Add "-o" option to "expression" which prints the object description if available.
> -        self.expect("expression -o -- my", "Object description displayed correctly",
> +        self.expect("expression --object-description -- my", "Object description displayed correctly",
>              patterns = ["Hello from.*a.out.*with timestamp: "])
> 
>      # See: <rdar://problem/8717050> lldb needs to use the ObjC runtime symbols for ivar offsets
> 
> Modified: lldb/trunk/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py?rev=169961&r1=169960&r2=169961&view=diff
> ==============================================================================
> --- lldb/trunk/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py (original)
> +++ lldb/trunk/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Tue Dec 11 21:23:37 2012
> @@ -64,62 +64,62 @@
> 
>          self.common_setup()
> 
> -        self.expect("expr -o -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["foo"])
> 
> -        self.expect("expr -o -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["foo"])
> 
> -        self.expect("expr -o -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["bar"])
> 
> -        self.expect("expr -o -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["bar"])
> 
> -        self.expect("expr -o -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["value"])
> 
> -        self.expect("expr -o -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["value"])
> 
> -        self.expect("expr -o -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["object"])
> 
> -        self.expect("expr -o -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["object"])
> 
> -        self.expect("expr -o -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSArray", "foo", "bar"])
> 
> -        self.expect("expr -o -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSDictionary", "key", "object"])
> 
> -        self.expect("expr -o -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", str(ord('a'))])
> 
> -        self.expect("expr -o -- @1", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @1", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "1"])
> 
> -        self.expect("expr -o -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "1"])
> 
> -        self.expect("expr -o -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "1"])
> 
> -        self.expect("expr -o -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "1"])
> 
> -        self.expect("expr -o -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "1"])
> 
> -        self.expect("expr -o -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "123.45"])
> -        self.expect("expr -o -- @123.45f", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @123.45f", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "123.45"])
> 
> -        self.expect("expr -o -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSNumber", "4"])
> -        self.expect("expr -o -- @(\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
> +        self.expect("expr --object-description -- @(\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
>              substrs = ["NSString", "world"])
> 
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20121214/b46ddaeb/attachment.html>


More information about the lldb-commits mailing list