Commit Graph

530 Commits

Author SHA1 Message Date
Johnny Chen 9633214507 Fix wrong test logic -- should pass "-s address" option to "image dump symtab"
in order to sort the output by address.

llvm-svn: 122071
2010-12-17 18:02:08 +00:00
Johnny Chen 62f68ee564 Use SBModule.GetDescription(SBStream) API to get the module description to match
against.

llvm-svn: 121989
2010-12-16 18:37:46 +00:00
Johnny Chen de442a6878 Update the comment section of blacklist.py with the command line to reproduce the crash.
llvm-svn: 121986
2010-12-16 18:10:16 +00:00
Johnny Chen 6becf1c924 Add python_api/symbol-context to test getting the symbol context while stopped
on a frame and to exercise the methods of SBSymbolContext.

llvm-svn: 121941
2010-12-16 01:41:37 +00:00
Johnny Chen 8e74416cd5 Fix one of the golden output of "frame variable -t *self" to be:
"(MyString) *self"

llvm-svn: 121907
2010-12-15 22:50:54 +00:00
Johnny Chen 763d1a17a1 Fix typos in SBBreakpoint::GetThreadIndex()/GetThreadName(), and test sequences
for the two API calls.

llvm-svn: 121898
2010-12-15 21:39:37 +00:00
Jim Ingham 5949cfe11b Added a test for finding the correct values for ivars when a property causes the ivar offsets
in the DWARF to be incorrect.

llvm-svn: 121894
2010-12-15 20:47:34 +00:00
Johnny Chen 7e0e537597 Add an entry for test case BasicExprCommandsTestCase.test_evaluate_expression_python,
due to crashes while running the entire test suite with clang-126.

To reproduce:

CC=clang ./dotest.py -v -w 2> ~/Developer/Log/lldbtest.log

To skip this test case:

CC=clang ./dotest.py -b blacklist.py -v -w 2> ~/Developer/Log/lldbtest.log

llvm-svn: 121887
2010-12-15 20:11:04 +00:00
Caroline Tice 739dee910d Add test cases to test various aspect of the 'alias' command.
llvm-svn: 121879
2010-12-15 19:04:51 +00:00
Greg Clayton 54979cddda Fixed the "expression" command object to use the StackFrame::GetValueForExpressionPath()
function and also hooked up better error reporting for when things fail.

Fixed issues with trying to display children of pointers when none are
supposed to be shown (no children for function pointers, and more like this).
This was causing child value objects to be made that were correctly firing
an assertion.

llvm-svn: 121841
2010-12-15 05:08:08 +00:00
Johnny Chen 8e1ab7b2bf Modify the test case to run under ['gcc', 'llvm-gcc', 'clang'] x ['x86_64', 'i386']
combinations.

llvm-svn: 121818
2010-12-15 00:58:49 +00:00
Caroline Tice 4fd4337b73 Add test cases to make sure the Command Interpreter is handling
command completion properly (e.g. abbreviated commands, which are
NOT the same as aliases).

llvm-svn: 121814
2010-12-14 23:50:59 +00:00
Johnny Chen f48b645423 Rearrange some statements so that the adding of teardown hook follows immediately
after the statement it wants to revert the effect of.

llvm-svn: 121813
2010-12-14 23:47:55 +00:00
Johnny Chen a245f933ba Make the TestSettings.py test cases use different output filenames:
o "output1.txt" for test_pass_host_env_vars() test case
o "output2.txt" for test_run_args_and_env_vars_with_dsym() test case
o "output2.txt" for test_run_args_and_env_vars_with_dwarf() test case

and add teardown hook to test_pass_host_env_vars() in order to properly
unset the host environment variables set while running the test case.

llvm-svn: 121811
2010-12-14 23:43:29 +00:00
Johnny Chen c12a1893d2 Execute the test case teardown hooks in a LIFO (last in, first out) order.
ALso add a teardown hook to the LoadUnloadTestCase.test_dyld_library_path()
test case to have it restore the DYLD_LIBRARY_PATH environment variable.

llvm-svn: 121802
2010-12-14 23:13:03 +00:00
Johnny Chen ea7215f5f8 Added a test case LoadUnloadTestCase.test_dyld_library_path to test launching a process
linked with a dylib which has been relocated by specifying the DYLD_LIBRARY_PATH environment
variable.  Test that the function name breakpoint defined in the dylib is resolved.

llvm-svn: 121796
2010-12-14 22:26:34 +00:00
Johnny Chen 94f928b83f Modify test cases to accomodate Python API change:
o SBFrame.LookupVar -> FindVariable
o SBFrame.LookupVarInScope -> FindValue

llvm-svn: 121782
2010-12-14 18:59:15 +00:00
Johnny Chen 6b4896fddb Change the golden output so that merely evaluating an existing persistent variable
does not result in a newly created persistent variable.  The old one is returned,
instead.

llvm-svn: 121775
2010-12-14 17:48:26 +00:00
Greg Clayton 8b2fe6dcbd Modified LLDB expressions to not have to JIT and run code just to see variable
values or persistent expression variables. Now if an expression consists of
a value that is a child of a variable, or of a persistent variable only, we
will create a value object for it and make a ValueObjectConstResult from it to
freeze the value (for program variables only, not persistent variables) and
avoid running JITed code. For everything else we still parse up and JIT code
and run it in the inferior. 

There was also a lot of clean up in the expression code. I made the 
ClangExpressionVariables be stored in collections of shared pointers instead
of in collections of objects. This will help stop a lot of copy constructors on
these large objects and also cleans up the code considerably. The persistent
clang expression variables were moved over to the Target to ensure they persist
across process executions.

Added the ability for lldb_private::Target objects to evaluate expressions.
We want to evaluate expressions at the target level in case we aren't running
yet, or we have just completed running. We still want to be able to access the
persistent expression variables between runs, and also evaluate constant 
expressions. 

Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects
can now dump their contents with the UUID, arch and full paths being logged with
appropriate prefix values.

Thread hardened the Communication class a bit by making the connection auto_ptr
member into a shared pointer member and then making a local copy of the shared
pointer in each method that uses it to make sure another thread can't nuke the
connection object while it is being used by another thread.

Added a new file to the lldb/test/load_unload test that causes the test a.out file
to link to the libd.dylib file all the time. This will allow us to test using
the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else.

llvm-svn: 121745
2010-12-14 02:59:59 +00:00
Johnny Chen 0a3d1ca28e Add TestBreakpointIgnoreCount.py to exercise the breakpoint ignore count features,
with both command line and Python API tests.

llvm-svn: 121717
2010-12-13 21:49:58 +00:00
Johnny Chen 68300da996 Make the test case SourceManagerTestCase.display_source_python stronger by also
matching the source line number displayed.

llvm-svn: 121706
2010-12-13 18:59:27 +00:00
Johnny Chen f6eaba85a8 Add test_display_source_python() test case to TestSourceManager.py which uses
the lldb PyThon API SBSourceManager to display source files.

To accomodate this, the C++ SBSourceManager API has been changed to take an
lldb::SBStream as the destination for display of source lines.  Modify SBStream::ctor()
so that its opaque pointer is initialized with an StreamString instance.

llvm-svn: 121605
2010-12-11 01:20:39 +00:00
Johnny Chen de1451ef4b Make sure that @python_api_test is only used to decorate a test method, not the
test class.

llvm-svn: 121538
2010-12-10 21:33:31 +00:00
Johnny Chen 240f8c7dd1 Do not specify both '-a' and '+a' at the same time.
llvm-svn: 121501
2010-12-10 19:02:23 +00:00
Johnny Chen f3e22ac3c7 Add a '+a' command line option to the test driver to run only the Python API tests.
Add an attribute __python_api_test__ (set to True) to the @python_api_test decorated
test method to distinguish them from the lldb command line tests.

llvm-svn: 121500
2010-12-10 18:52:10 +00:00
Johnny Chen 47ed69e72c Add the @python_api_test decorator for two test cases.
llvm-svn: 121499
2010-12-10 18:42:07 +00:00
Johnny Chen 63d045d560 Fix some typo in method names and docstrings.
llvm-svn: 121494
2010-12-10 17:15:34 +00:00
Jim Ingham 484ef8003e Added some tests for ObjC stepping, step into ordinary and stret methods, and stepping
through a KVO swizzled object's method calls.

llvm-svn: 121457
2010-12-10 02:33:02 +00:00
Johnny Chen a47d7cb9b9 Add @python_api_test decorator to the remaining Test*.py files.
llvm-svn: 121448
2010-12-10 01:21:27 +00:00
Johnny Chen 8906814057 Fix a test method docstring.
llvm-svn: 121446
2010-12-10 00:58:18 +00:00
Johnny Chen 7c7d936e48 Add an infrastructure to mark the Python APIs only test using a decorator.
Example:

    @python_api_test
    def test_evaluate_expression_python(self):
        """Test SBFrame.EvaluateExpression() API for evaluating an expression."""
    ...

The opposite of Python APIs only test is an lldb command line test, which sends
commands to the lldb command interpreter.  Add a '-a' option to the test driver
to skip Python API only tests.

Modify TestExprs.py to mark a test as @python_api_test and remove an @expectedFailure
decorator as the bug has been fixed.

llvm-svn: 121442
2010-12-10 00:51:23 +00:00
Jim Ingham a58f548369 Added the source file for some ObjC stepping tests. No test yet.
llvm-svn: 121440
2010-12-10 00:27:27 +00:00
Johnny Chen 2bac54fe0c Add more module docstring.
llvm-svn: 121421
2010-12-09 22:11:59 +00:00
Johnny Chen de2c8bd877 Minor docstring change.
llvm-svn: 121419
2010-12-09 22:06:05 +00:00
Johnny Chen 67f73ac7f2 Remove unnecessary imports.
llvm-svn: 121393
2010-12-09 18:38:52 +00:00
Johnny Chen 5b3a357dec Add a test/source-manager directory for testing lldb core component SourceManager.
Initial test case test_modify_source_file_while_debugging() in TestSourceManager.py
tests the caching mechanism of the source manager.

llvm-svn: 121389
2010-12-09 18:22:12 +00:00
Johnny Chen b340e6bb15 Add more docstring for the lldb_iter() utility function which provides a compact
way of iterating through an aggregate data structure.  The added example usage
is from an actual use in test/foundation/TestSymbolTable.py:

    2. Pass a container of aggregate which provides APIs to get to the size and
       the element of the aggregate:

    # Module is a container of symbol table 
    module = target.FindModule(filespec)
    for symbol in lldb_iter(module, 'GetNumSymbols', 'GetSymbolAtIndex'):
        name = symbol.GetName()
        ...

llvm-svn: 121271
2010-12-08 19:19:08 +00:00
Johnny Chen 7b81dfd1cc Modify the TestObjCMethods2.py test to fix a typo (should be str_id, not id).
Also, add bug info for expected failures that remain:

    <rdar://problem/8741897> Expressions should support properties

llvm-svn: 121268
2010-12-08 18:14:20 +00:00
Johnny Chen 025d1b8f95 For SBTarget.Launch()/LaunchProcess(), there's no need to pass an empty string
as the args and the envs to the launched process.

o lldbtest.py:

  Forgot to check in some assertion messages changes for lldbtest.py.

o dotest.py:

  Also add "api" category to the default lldb log option list.

llvm-svn: 121220
2010-12-08 01:25:21 +00:00
Johnny Chen 0ecec99eb2 Add test_evaluate_expression_python() to exercise SBFrame.EvaluateExpression() Python API.
Launch the process with ['X', 'Y', 'Z'] as the args to make argc == 4 and verify that's the case,
plus some other EvaluateExpression() calls.

llvm-svn: 121218
2010-12-08 01:08:27 +00:00
Johnny Chen aa92f631b4 Use Python raw string literal to avoid escaping the escape sequence and to make
the command given to lldb command interpreter more readable.

llvm-svn: 121199
2010-12-07 23:12:51 +00:00
Johnny Chen 56d8ac4e80 Make the various expression command test sequences more strict by also verifying
the results against our golden ones.

llvm-svn: 121185
2010-12-07 21:17:12 +00:00
Johnny Chen 74481444ab Add a test sequence for test_expr_commands_can_handle_quotes(self):
# runCmd: command alias print_hi expression printf ("\n\tHi!")
        # output: 
        self.runCmd('command alias print_hi expression printf ("\\n\\tHi!")')
        # This fails currently.
        self.runCmd('print_hi')

and modify existing test sequences to escape the escape character '\ to prevent it
from being interpreted by Python before passing on to the lldb command interpreter.

llvm-svn: 121183
2010-12-07 20:52:36 +00:00
Johnny Chen 5be1db9c71 Remove comment no longer applied.
llvm-svn: 121178
2010-12-07 20:22:32 +00:00
Caroline Tice d9d63369df - Fix alias-building & resolving to properly handle optional arguments for command options.
- Add logging for command resolution ('log enable lldb commands')
- Fix alias resolution to properly handle commands that take raw input (resolve the alias, but
  don't muck up the raw arguments).

Net result:  Among other things, 'expr' command can now take strings with escaped characters and
not have the command handling & alias resolution code muck up the escaped characters. E.g.
 'expr printf ("\n\n\tHello there!")' should now work properly.


Not working yet:  Creating aliases with raw input for commands that take raw input.  Working on that.
e.g. 'command alias print_hi expr printf ("\n\tHi!")' does not work yet.

llvm-svn: 121171
2010-12-07 19:58:26 +00:00
Johnny Chen d43384f608 Add test/foundation/TestSymbolTable.py to exercise accessing the symbol table
entries (including synthesized properties) through the lldb Python APIs.

llvm-svn: 121168
2010-12-07 19:37:52 +00:00
Johnny Chen d732156bed 'thread backtrace', not 'thread backtrac'.
llvm-svn: 121151
2010-12-07 17:10:46 +00:00
Johnny Chen 74721273c6 The do_simple_disasm() also needs to be modified to accommodate the recent changes
to main.m.

llvm-svn: 121150
2010-12-07 17:08:16 +00:00
Johnny Chen 50ca1a4328 Add expect matching patterns for some self.expect() statements.
llvm-svn: 121077
2010-12-07 00:31:29 +00:00
Johnny Chen 3f4dc2a8a6 Add TestObjCMethods2.py to exercise more expression command sequences with objc.
Mark NSArray_expr() and NSString_expr() as currently failing.  Both are called
from dsym and dwarf builds.  So that makes the num of expected failures equal 4.

----------------------------------------------------------------------
Ran 6 tests in 19.856s

OK (expected failures=4)

llvm-svn: 121068
2010-12-06 23:50:52 +00:00