Commit Graph

45 Commits

Author SHA1 Message Date
Johnny Chen b49440fa92 http://llvm.org/bugs/show_bug.cgi?id=11618
lldb::SBValue::AddressOf does not work on dereferenced registers in synthetic children provider

Patch submitted by Enrico Granata.

llvm-svn: 147637
2012-01-06 00:35:38 +00:00
Johnny Chen b456b792e0 http://llvm.org/bugs/show_bug.cgi?id=11588
valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider

Patch from Enrico Granata:

The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem.

The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own.
Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly.

llvm-svn: 146768
2011-12-16 23:04:52 +00:00
Johnny Chen f031bb192f Fix objc runtime warnings from the inferior program.
llvm-svn: 144717
2011-11-15 22:42:53 +00:00
Johnny Chen e5b190304d Removed the @expectedFailure decorators from test cases. They have been fixed with the r142717 check-in.
llvm-svn: 142823
2011-10-24 18:11:16 +00:00
Jim Ingham eb6ba39033 Fix the last testsuite regression from the apple-names stuff.
llvm-svn: 141468
2011-10-08 01:11:42 +00:00
Sean Callanan 0886e5657b Fixed a problem with the IR interpreter that caused
it to generate result variables that were not bound
to their underlying data.  This allowed the SBValue
class to use the interpreter (if possible).

Also made sure that any result variables that point
to stack allocations in the stack frame of the
interpreted expressions do not get live data.

llvm-svn: 140285
2011-09-22 00:41:11 +00:00
Johnny Chen d0b0f4920c Add four new expectedFailre decorators to new failures most likely due to r139772 check-in.
llvm-svn: 140150
2011-09-20 17:31:05 +00:00
Enrico Granata 9128ee2f7a Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
   a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
   in frozen objects ; now such reads transparently move from host to target as required
 - as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
   removed code that enabled to recognize an expression result VO as such
 - introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
   representing a T* or T[], and doing dereferences transparently
   in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
 - as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
   en lieu of doing the raw read itself
 - introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
   this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
   in public layer this returns an SBData, just like GetPointeeData()
 - introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
   the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
   of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
 - added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
 of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
 addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types

llvm-svn: 139160
2011-09-06 19:20:51 +00:00
Johnny Chen ba3b99ef1c Fix compile warning.
llvm-svn: 138465
2011-08-24 19:35:24 +00:00
Johnny Chen a68135aed0 Remove the expectedFailure decorator. The test has been passing for some time now.
llvm-svn: 138452
2011-08-24 18:10:09 +00:00
Sean Callanan bccce81340 Added support for persistent types to the
expression parser.  You can use a persistent
type like this:

(lldb) expr struct $foo { int a; int b; };
(lldb) struct $foo i; i.a = 2; i.b = 3; i
($foo) $0 = {
  (int) a = 2
  (int) b = 3
}

typedefs work similarly.

This patch affects the following files:

test/expression_command/persistent_types/*
  A test case for persistent types,
  in particular structs and typedefs.

ClangForward.h
  Added TypeDecl, needed to declare some
  functions in ASTResultSynthesizer.h

ClangPersistentVariables.[h,cpp]
  Added a list of persistent types to the
  persistent variable store.

ASTResultSynthesizer.[h,cpp]
  Made the AST result synthesizer iterate
  across TypeDecls in the expression, and
  record any persistent types found.  Also
  made a minor documentation fix.

ClangUserExpression.[h,cpp]
  Extended the user expression class to
  keep the state needed to report the
  persistent variable store for the target
  to the AST result synthesizers. 

  Also introduced a new error code for
  expressions that executed normally but
  did not return a result.

CommandObjectExpression.cpp
  Improved output for expressions (like 
  declarations of new persistent types) that
  don't return a result.  This is no longer
  treated as an error.

llvm-svn: 138383
2011-08-23 21:20:51 +00:00
Greg Clayton fe42ac4d0a Cleaned up the SBType.h file to not include internal headers and reorganized
the SBType implementation classes.

Fixed LLDB core and the test suite to not use deprecated SBValue APIs.

Added a few new APIs to SBValue:

    int64_t
    SBValue::GetValueAsSigned(int64_t fail_value=0);

    uint64_t
    SBValue::GetValueAsUnsigned(uint64_t fail_value=0)

 

llvm-svn: 136829
2011-08-03 22:57:10 +00:00
Johnny Chen f57119bc21 Remove the @expectedFailure decorator since the bug has been fixed.
rdar://problem/9673664

llvm-svn: 136633
2011-08-01 18:26:32 +00:00
Johnny Chen b15c1dbfa1 Add regression test for rdar://problem/9531204.
llvm-svn: 136425
2011-07-28 23:17:20 +00:00
Johnny Chen 09f24bc769 Add test case for rdar://problem/9673664.
llvm-svn: 136409
2011-07-28 22:12:12 +00:00
Johnny Chen 1d3e880c2c Passing in os.ctermid() as the arg for SBTarget.Launch(...) for stdin_path, stdout_path, and stderr_path
is just wrong and resulted in the inferior's output getting mixed into the GDB remote communication's
log file.  Change all test cases to not pass os.ctermid() and either use SBTarget.LaunchSimple() or
SBTarget.Launch() and pass None as stdin_path/stdout_path/srderr_path to use a pseudo terminal.

rdar://problem/9716499 program output is getting mixed into the GDB remote communications

llvm-svn: 134940
2011-07-11 23:38:23 +00:00
Johnny Chen 9a07aba962 The lldbtest.TestBase.DebugSBValue(self, val) method call now does not need the frame argument.
Only the val (of SBValue type) argument is needed.

llvm-svn: 134915
2011-07-11 20:06:28 +00:00
Johnny Chen 6638174378 Add @expectedFailure for TestCallStdStringFunction.py (radar was filed) and
remove @expectedFailure from TestObjCMethods.py's print_ivars_correctly()
function (it has been passing for a while).

llvm-svn: 134022
2011-06-28 19:39:19 +00:00
Johnny Chen 5a0bee7c5f The extra burden for the Python API test case to assign its process object to self.process
in order to have its process cleaned up (terminated) upon tearDown is gone for good.
Let's simplify a bunch of Python API test cases.

llvm-svn: 133097
2011-06-15 22:14:12 +00:00
Johnny Chen 4ebd019b97 Now that we have added a post-processing step for adding truth value testing to
those lldb objects which implement the IsValid() method, let's change the rest of
the test suite to use the more compact truth value testing pattern (the Python way).

llvm-svn: 131970
2011-05-24 18:22:45 +00:00
Johnny Chen de303ad4cd Add radar info.
llvm-svn: 131681
2011-05-19 21:31:35 +00:00
Johnny Chen b146ad5cd3 Add TestCallStdStringFunction.py which calls std::string member functions while stopped on a breakpoint.
llvm-svn: 131680
2011-05-19 21:28:24 +00:00
Sean Callanan 775022652b Introduced support for UnknownAnyTy, the Clang type
representing variables whose type must be inferred
from the way they are used.  Functions without debug
information now return UnknownAnyTy and must be cast.

Variables with no debug information are not yet using
UnknownAnyTy; instead they are assumed to be void*.
Support for variables of unknown type is coming (and,
in fact, some relevant support functions are included
in this commit) but will take a bit of extra effort.

The testsuite has also been updated to reflect the new
requirement that the result of printf be cast, i.e.

expr (int) printf("Hello world!")

llvm-svn: 131263
2011-05-12 23:54:16 +00:00
Johnny Chen 40362a44c0 More string matching criterion.
llvm-svn: 131165
2011-05-10 22:46:13 +00:00
Johnny Chen 86f4f315ca Add TestObjCTypeQueryFromOtherCompileUnit.py to test that when stopped in the 'main.c'
compile unit, which has an external reference to symbols defined in foo.m, the type query:

    in this case, 'expression (NSArray*)array_token'

continues to work.

This test is to accompany http://llvm.org/viewvc/llvm-project?rev=131145&view=rev.

llvm-svn: 131154
2011-05-10 21:36:11 +00:00
Johnny Chen 339ac4369d Add TestExprs2.py for recent check-ins related to the 'expression' subsystem.
llvm-svn: 131111
2011-05-09 23:41:06 +00:00
Johnny Chen de90f1dd93 Change the rest of lldbutil.py's function names to all lower case formats to be consistent.
And modify the test cases accordingly.

llvm-svn: 130314
2011-04-27 17:43:07 +00:00
Johnny Chen d0fef81e38 For lldbutil.py, Change a bunch of function names to all lower case formats to be consistent.
And modify the test cases accordingly.

llvm-svn: 130174
2011-04-25 23:38:13 +00:00
Johnny Chen d762ff1faa Modify test scripts to accomodate SBTarget.Launch() API change.
llvm-svn: 124828
2011-02-03 23:15:53 +00:00
Greg Clayton 6f907e69e9 Deprecated old forms of SBTarget::Launch. There is not just one and no
SWIG renaming done to work around deprecated APIs.

llvm-svn: 124075
2011-01-23 17:46:22 +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
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
Johnny Chen 2bac54fe0c Add more module docstring.
llvm-svn: 121421
2010-12-09 22:11:59 +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 761c205274 Add two test cases to exercise many expression commands:
o test_many_expr_commands()
    o test_expr_commands_can_handle_quotes()

Mark test_expr_commands_can_handle_quotes()
as @expectedFailure:

    # rdar://problem/8686536
    # CommandInterpreter::HandleCommand is stripping \'s from input for WantsRawCommand commands

llvm-svn: 121019
2010-12-06 18:24:18 +00:00
Greg Clayton 39e746e7cf Use full command to avoid "expr" alias.
Add bug number for current expected failures.

llvm-svn: 120976
2010-12-06 02:47:48 +00:00
Greg Clayton f4b0c83e69 Added a simple test case that can be used to test out the expression parser
more completely. Example expressions are in the comments.

llvm-svn: 120975
2010-12-06 02:44:26 +00:00
Johnny Chen 1922a8dbea Remove @skip decorators for fixed crashes.
llvm-svn: 120479
2010-11-30 22:34:19 +00:00
Johnny Chen ed6b6055b4 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120432
2010-11-30 17:53:12 +00:00
Johnny Chen 27eb0bf281 Move the persistent_variables directory under expression_command directory.
llvm-svn: 118591
2010-11-09 17:57:37 +00:00
Johnny Chen 22c3f3028d Add a test for expression parser crash which has been fixed.
llvm-svn: 118590
2010-11-09 17:51:11 +00:00