Commit Graph

802 Commits

Author SHA1 Message Date
Jim Ingham 6c68fb4549 Add "-o" option to "expression" which prints the object description if available.
llvm-svn: 115115
2010-09-30 00:54:27 +00:00
Johnny Chen eb1db1c547 Verify that we have a valid breakpoint ID before proceeding with retrieving its
number of locations.  This fixed a crasher.

llvm-svn: 115092
2010-09-29 21:57:51 +00:00
Caroline Tice 9068d794fd Fix breakpoint id range testing to disallow ranges that specify breakpoint locations from
crossing major breakpoint boundaries (must be within a single breakpoint if specifying locations).

Add .* as a means of specifying all the breakpoint locations under a major breakpoint, e.g. "3.*"
means "all the breakpoint locations of breakpoint 3".

Fix error message to make more sense, if user attempts to specify a breakpoint command when there
isn't a target yet.

llvm-svn: 115077
2010-09-29 19:42:33 +00:00
Johnny Chen d8ed43cde0 Simple refactoring.
llvm-svn: 115075
2010-09-29 19:36:25 +00:00
Johnny Chen b19cd0fff4 Wrapped the regexp grokking of data type within a try:expect: instead of letting
the Python runtime take over in case there isn't a match.

llvm-svn: 115073
2010-09-29 19:29:42 +00:00
Johnny Chen 2c48dbec96 Added an example 'frame variable' output to demonstrate how the generic_type_tester
groks the data type of the variable.

llvm-svn: 115070
2010-09-29 19:12:10 +00:00
Johnny Chen c0ba019a19 Added @expectedFailure decorators for test suite failures:
# rdar://problem/8493023
    # test/types failures for Test*TypesExpr.py: element offset computed wrong?

llvm-svn: 115065
2010-09-29 19:02:20 +00:00
Johnny Chen cfd405fb42 Turn on generic type tester for expression parser; preparing to file bugs.
llvm-svn: 115063
2010-09-29 18:46:14 +00:00
Caroline Tice bd13b8d5ce Fix various timing/threading problems in IOChannel & Driver that
were causing the prompt to be stomped on, mangled or omitted occasionally.

llvm-svn: 115059
2010-09-29 18:35:42 +00:00
Johnny Chen f3d3d1c743 Removed the two @skip class decorators. The assert failures have been fixed.
llvm-svn: 115055
2010-09-29 18:14:50 +00:00
Johnny Chen 2e566e040a Updated the comment section for running 'expr self->string' and 'expr self->date'.
The failures are similar in nature to the radar already filed:

        # rdar://problem/8492646
        # test/foundation fails after updating to tot r115023
        # self->str displays nothing as output

llvm-svn: 115052
2010-09-29 18:05:03 +00:00
Johnny Chen 8eb3850886 Added two @expectedFailure decorators for test_data_type_and_expr_with_dsym() and
test_data_type_and_expr_with_dwarf().

rdar://problem/8492646
test/foundation fails after updating to tot r115023: self->str displays nothing as output

llvm-svn: 115050
2010-09-29 17:58:12 +00:00
Johnny Chen 620f9d1548 Updated to reflect the updated tot r115023. Will be filing a bug next.
llvm-svn: 115046
2010-09-29 17:50:35 +00:00
Johnny Chen 3801fbdee8 Removed the two @expectedFailure decorators for expression parser, they have been fixed.
Also chnaged the expected string for 'frame variable this' from '(class C *const) this ='
to 'C *const) this =' for the time being, while investigating the different output for
tot r115023.

runCmd: frame variable this
output: (struct C *const) this = 0x0000000100000c2e
llvm-svn: 115042
2010-09-29 17:29:13 +00:00
Greg Clayton 1437224a7c Updated LLVM to: --revision '{2010-09-28T19:30}'
This gets us the new clang::CXXRecordDecl improvments in clang so that when we
add fields, methods and other things to the clang::CXXRecordDecl, the correct
bits are automatically set by clang::CXXRecordDecl itself instead of having 
SEMA and our lldb_private::ClangASTContext functions that create types for
DWARF do it all manually. This allows the clang::ASTContext deep copying of
types to work correctly and it means that the expression parser can now 
evaluate expressions in the context of a class method correctly. Previously
when a class was copied from the DWARF generated ASTContext over into the
expression ASTContext, we were losing CXXRecordDecl bits in the conversion
which caused all classes to think they were at offset zero because the the 
bools for empty, POD, and others would end up being incorrect.

llvm-svn: 115023
2010-09-29 03:44:17 +00:00
Greg Clayton 6d01ad92c7 Fixed an LLVM/Clang assertion that would happen for C++ and ObjC methods if the DWARF doesn't specify the accessibility for the method. Currently gcc 4.2 and clang++ do not set the accessibility correctly on methods. We currently shouldn't default to private since public methods don't have the accessibility specified.
Bottom line: we currently default to public for both C++ and ObjC if the accessibility isn't set.

llvm-svn: 115016
2010-09-29 01:57:37 +00:00
Greg Clayton 1be10fca5f Fixed the forward declaration issue that was present in the DWARF parser after
adding methods to C++ and objective C classes. In order to make methods, we
need the function prototype which means we need the arguments. Parsing these
could cause a circular reference that caused an  assertion.

Added a new typedef for the clang opaque types which are just void pointers:
lldb::clang_type_t. This appears in lldb-types.h.

This was fixed by enabling struct, union, class, and enum types to only get
a forward declaration when we make the clang opaque qual type for these
types. When they need to actually be resolved, lldb_private::Type will call
a new function in the SymbolFile protocol to resolve a clang type when it is
not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
us to be a lot more lazy when parsing clang types and keeps down the amount
of data that gets parsed into the ASTContext for each module. 

Getting the clang type from a "lldb_private::Type" object now takes a boolean
that indicates if a forward declaration is ok:

    clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
    
So function prototypes that define parameters that are "const T&" can now just
parse the forward declaration for type 'T' and we avoid circular references in
the type system.

llvm-svn: 115012
2010-09-29 01:12:09 +00:00
Sean Callanan 58c6273b84 Removed a dreadful hack to get at the name of the
intrinsic being used.  Thanks to Chris Lattner for
pointing out the proper way to do it.

llvm-svn: 115006
2010-09-28 23:55:00 +00:00
Johnny Chen bc84b99f16 Removed the @expectedFailure decorator from test_persistent_variables().
llvm-svn: 115000
2010-09-28 22:47:28 +00:00
Sean Callanan 46ae9e51cc Fixed two bugs in the expression parser:
- the guard variable for the static result
   variable was being mistaken for the actual
   result value, causing IRForTarget to fail

 - LLVM builtins like memcpy were not being
   properly resolved; now they are resolved
   to the corresponding function in the target

llvm-svn: 114990
2010-09-28 21:13:03 +00:00
Johnny Chen 06325d3020 Added TestIntegerTypesExpr.py and TestFloatTypesExpr.py which exercise 'expr'
command on the various basic types, similar to TestIntegerTypes.py and
TestFloatTypes.py, which exercise 'frame variable' on the various basic types.

Right now, they don't employ the self.expect() facility to compare against the
golden output.  They just invoke the self.runCmd() method to run the 'expr'
command.  Decorated the two classes with @unittest2.skip decorators for the time
being.

llvm-svn: 114987
2010-09-28 21:03:58 +00:00
Johnny Chen 7bfa538551 Sanity check the print representations of SBThread, SBFrame, and SBValue.
llvm-svn: 114970
2010-09-28 18:13:04 +00:00
Johnny Chen c0cd18d1f7 Another patch from Jean-Daniel. Thanks.
Error in dbg server -> MachProcess::SetProcessID() and misc changes to make clang++ happy.

llvm-svn: 114962
2010-09-28 16:34:56 +00:00
Johnny Chen d440bccb16 Fix from Jean-Daniel. Thanks.
Error in object runtime language detection code	(spurious '; ')
Also replace false by NULL in a place where the compiler expects a pointer instead of a bool.

llvm-svn: 114957
2010-09-28 16:10:54 +00:00
Jim Ingham a8298d3ba5 Make sure we've read in the ObjC runtime library data before trying to use it...
llvm-svn: 114956
2010-09-28 16:06:31 +00:00
Jim Ingham 5a369128f6 Replace the vestigial Value::GetOpaqueCLangQualType with the more correct Value::GetValueOpaqueClangQualType.
But mostly, move the ObjC Trampoline handling code from the MacOSX dyld plugin to the AppleObjCRuntime classes.

llvm-svn: 114935
2010-09-28 01:25:32 +00:00
Greg Clayton 6adffa27ba Added a DIE to clang opaque type map.
Removed code that shouldn't have been checked in.

llvm-svn: 114932
2010-09-28 01:04:25 +00:00
Sean Callanan 8fd3244af3 Added type lookup, so variables with user-defined types
can be allocated and manipulated.

llvm-svn: 114928
2010-09-27 23:54:58 +00:00
Johnny Chen ecb17ffca1 Trivial assert message modification.
llvm-svn: 114927
2010-09-27 23:53:07 +00:00
Johnny Chen 58aa345df6 Use a better name for the abstract base class which contains the generic_type_tester()
method.  Renamed it to be AbstractBase.py, which contains the GenericTester class that
both IntegerTypesTestCase and FloatTypesTestCase inherit from.

llvm-svn: 114926
2010-09-27 23:46:46 +00:00
Johnny Chen 6316021bae Added "float" and "double" to types/TestBasicTypes.py. Abstracted the generic
type tester method into its own abstarct base class 'AbstractBase'.  And
added TestIntegerTypes.py and TestFloatTypes.py.

Added an option "-p reg-exp-pattern" to the test driver to specify a regular
expression pattern to match against eligible filenames as our test cases.

An example: 

/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v -p "TestFloat.*" types
----------------------------------------------------------------------
Collected 4 tests

test_double_type_with_dsym (TestFloatTypes.FloatTypesTestCase)
Test that double-type variables are displayed correctly. ... ok
test_double_type_with_dwarf (TestFloatTypes.FloatTypesTestCase)
Test that double-type variables are displayed correctly. ... ok
test_float_type_with_dwarf (TestFloatTypes.FloatTypesTestCase)
Test that float-type variables are displayed correctly. ... ok
test_float_types_with_dsym (TestFloatTypes.FloatTypesTestCase)
Test that float-type variables are displayed correctly. ... ok

----------------------------------------------------------------------
Ran 4 tests in 5.592s

OK

llvm-svn: 114923
2010-09-27 23:29:54 +00:00
Caroline Tice 988efc1ba2 Fix one-liner Python breakpoint commands to be wrapped up in an automatically
generated Python function, and passed the stoppoint context frame and
bp_loc as parameters.

llvm-svn: 114894
2010-09-27 21:35:15 +00:00
Greg Clayton 594e5ed939 Hooked up detach for ProcessGDBRemote.
Remove the GetUserData()/SetUserData() from the DWARFDebugInfoEntry
class. We now track everything with dense maps.

llvm-svn: 114876
2010-09-27 21:07:38 +00:00
Johnny Chen ff745c02ff Modified doc string.
llvm-svn: 114875
2010-09-27 21:04:54 +00:00
Johnny Chen ca54e280d5 Added @expectedFailure decorator for the "long long" and "unsigned long long"
test cases.

llvm-svn: 114872
2010-09-27 20:55:52 +00:00
Johnny Chen e1030cd883 Added "long long" and "unsigned long long" to the TestBasicTypes.py.
Added a special "clean" target to the types/Makefile to clean up all the *.o/.d
files.

The generic_type_tester() method is modified to take a set of atoms, instead of
type string as a required parameter, for example:

o unsigned int => set(['unsigned', 'int'])
o unsigned long long => set(['unsigned', 'long long'])
o long long => set(['long long'])

llvm-svn: 114871
2010-09-27 20:44:46 +00:00
Caroline Tice 18474c933c Automatically wrap *all* Python code entered for a breakpoint command inside
an auto-generated Python function, and pass the stoppoint context frame and
breakpoint location as parameters to the function (named 'frame' and 'bp_loc'),
to be used inside the breakpoint command Python code, if desired.

llvm-svn: 114849
2010-09-27 18:00:20 +00:00
Johnny Chen 23cb3716df Updated test case to "settings set prompt 'lldb2'" since the '-o' option is gone.
Also added "settings set -r prompt" to reset the prompt afterwards.

llvm-svn: 114846
2010-09-27 17:36:59 +00:00
Caroline Tice 0f564dbc8c Change command option "--no_override" to "--no-override" (hypen instead of underscore).
llvm-svn: 114840
2010-09-27 16:58:16 +00:00
Caroline Tice 1559a46b3e Create more useful instance names for target, process and thread instances.
Change default 'set' behavior so that all instance settings for the specified variable will be
updated, unless the "-n" ("--no_override") command options is specified.

llvm-svn: 114808
2010-09-27 00:30:10 +00:00
Greg Clayton 384b0dec68 Bumped Xcode lldb build number to 25 for lldb-25 and debugserver build to
113 for debugserver-113.

llvm-svn: 114777
2010-09-25 00:31:52 +00:00
Greg Clayton 943cdebb63 Added two needed exports.
llvm-svn: 114775
2010-09-24 23:57:12 +00:00
Greg Clayton 5573fde342 Cleaned a few build related things up:
Added a virtual destructor to ClangUtilityFunction with a body to it cleans
itself up.

Moved our SharingPtr into the lldb_private namespace to keep it easy to make
an exports file that exports only what is needed ("lldb::*").

llvm-svn: 114771
2010-09-24 23:07:41 +00:00
Johnny Chen cdf612277a Commented out a debug stmt.
llvm-svn: 114770
2010-09-24 22:57:32 +00:00
Johnny Chen febf65f6fe Added 'char'/'unsigned char'/'short'/'unsigned short' to the test suite.
Extended generic_type_tester() method to take an additional keyword argument
quoteDisplay (default to False) to facilitate comparison with frame variable
display output of character types.

llvm-svn: 114769
2010-09-24 22:54:18 +00:00
Johnny Chen 264d65924b Added comments about the usage of int(string, 0) and long(string, 0) which pass
a base of 0 so that the radix of the string is determined based on the contents
of string.

llvm-svn: 114764
2010-09-24 21:52:37 +00:00
Johnny Chen c01b78e7b2 Added two new .cpp files to be tested via TestBasicTypes.py for correct display
of various combinations of data structures with unsigned int or unsigned long
builtin types.

llvm-svn: 114756
2010-09-24 20:41:17 +00:00
Johnny Chen 61464fa6e7 Made 'frame variable' printing of unsigned types more readable, like gdb.
llvm-svn: 114739
2010-09-24 17:33:29 +00:00
Greg Clayton 0fffff5816 Added the ability to create an objective C method for an objective C
interface in ClangASTContext. Also added two bool returning functions that
indicated if an opaque clang qual type is a CXX class type, and if it is an
ObjC class type.

Objective C classes now will get their methods added lazily as they are
encountered. The reason for this is currently, unlike C++, the 
DW_TAG_structure_type and owns the ivars, doesn't not also contain the
member functions. This means when we parse the objective C class interface
we either need to find all functions whose names start with "+[CLASS_NAME"
or "-[CLASS_NAME" and add them all to the class, or when we parse each objective
C function, we slowly add it to the class interface definition. Since objective
C's class doesn't change internal bits according to whether it has certain types
of member functions (like C++ does if it has virtual functions, or if it has
user ctors/dtors), I currently chose to lazily populate the class when each
functions is parsed. Another issue we run into with ObjC method declarations
is the "self" and "_cmd" implicit args are not marked as artificial in the
DWARF (DW_AT_artifical), so we currently have to look for the parameters by
name if we are trying to omit artificial function args if the language of the
compile unit is ObjC or ObjC++.

llvm-svn: 114722
2010-09-24 05:15:53 +00:00
Johnny Chen b052f6c595 Added a generic_type_tester() to the TestBasicTypes class to be used for
testing various combinations of displaying variales of basic types.

The generic_type_tester() works by first capturing the golden output produced
by the printf stmts of ./a.out, creating a list of (var, value) pairs, and then
running the a.out to a stop point, and comparing the 'frame variable var' output
against the list of (var, value) pairs.

Modified int_type() and added long_type() to use generic_type_tester().

Also modified TestBase.expect() such that substring matching also return ok if
the substring starts at the 0-th position.

llvm-svn: 114708
2010-09-23 23:35:28 +00:00
Jim Ingham e4284b719c Add GetSP to the StackFrame.
llvm-svn: 114674
2010-09-23 17:40:12 +00:00
Johnny Chen 820b4c5153 Fixed a typo in member name; should be m_b, not b_a.
llvm-svn: 114660
2010-09-23 16:49:40 +00:00
Johnny Chen 99052de1de Changed 'frame variable' output to match '(const char *)' instead of '(char const *)'.
llvm-svn: 114652
2010-09-23 16:04:46 +00:00
Johnny Chen 0a241de067 Changed 'frame variable' output to match '(const char *)' instead of '(char const *)'.
llvm-svn: 114649
2010-09-23 15:57:32 +00:00
Sean Callanan e2ef6e380b Updated to latest LLVM. Major LLVM changes:
- Sema is now exported (and there was much rejoicing.)

 - Storage classes are now centrally defined.

Also fixed some bugs that the new LLVM picked up.

llvm-svn: 114622
2010-09-23 03:01:22 +00:00
Jim Ingham 2277701c7b Committing the skeleton of Language runtime plugin classes.
llvm-svn: 114620
2010-09-23 02:01:19 +00:00
Greg Clayton a51ed9bb49 Added motheds to C++ classes as we parse them to keep clang happy.
llvm-svn: 114616
2010-09-23 01:09:21 +00:00
Caroline Tice dac97f31a3 Remove all the __repr__ methods from the API/*.h files, and put them
into python-extensions.swig, which gets included into lldb.swig, and
adds them back into the classes when swig generates it's C++ file.  This
keeps the Python stuff out of the general API classes.

Also fixed a small bug in the copy constructor for SBSymbolContext.

llvm-svn: 114602
2010-09-22 23:01:29 +00:00
Johnny Chen c70b02a324 Checked in an initial template for the types directory. Right now, it doesn't
actually test-and-compare anything yet.  The lldbtest.TestBase has an added
method setTearDownCleanup(dictionary=None) to facilitate running the cleanup
right after each data type test is run.  The test case can pass a dictionary
object when registering the test case cleanup.

There is currently only int_type test in the repository.

llvm-svn: 114600
2010-09-22 23:00:20 +00:00
Johnny Chen 6594b8cc9b Changed to facilitate 'breakpoint set -n Puts', then 'thread step-out' to workaround
rdar://problem/8464339 test/types directory: b basic_type.cpp:171 does not work, while gdb does work.

llvm-svn: 114557
2010-09-22 17:46:07 +00:00
Caroline Tice 7740412f2b Remove SBCommandContext which was not needed or doing anything.
Add SBValueList.h & SBStream.h to build-swig-Python.sh; add SBValueList.h to lldb.swig

llvm-svn: 114549
2010-09-22 16:41:52 +00:00
Jason Molenda 0c7cc85649 Add a new ArchVolatileRegs plugin class to identify
whether a given register number is treated as volatile
or not for a given architecture/platform.

approx 450 lines of boilerplate, 50 lines of actual code. :)

llvm-svn: 114537
2010-09-22 07:37:07 +00:00
Greg Clayton a4ddf7f802 Added the start of a test case that will test all basic types and all the
variety of ways they can be displayed in variable views.

llvm-svn: 114530
2010-09-22 04:50:38 +00:00
Greg Clayton 4f432e719b Added some comments explaining why we currently have to manually set CXXRecordDecl variables. This is because SEMA is actually calling the accessors that should be built into the CXXRecordDecl class. We have an internal bug tracking this change and will remove the affected work around code when a solution is available.
llvm-svn: 114516
2010-09-22 00:40:49 +00:00
Sean Callanan c31ba26e0c Improved the logging for ASTs generated on the
expression parser's behalf so that now we see the
full TranslationUnitDecl instead of just the
FunctionDecl.

llvm-svn: 114514
2010-09-22 00:33:31 +00:00
Johnny Chen 9bb7dade7b Sanity check the print representation of lldb.SBProcess object.
llvm-svn: 114513
2010-09-22 00:25:33 +00:00
Greg Clayton 60e1aa56f7 Fixed CXXRecordDecl declaration settings for whether a class in a POD type
or not.

llvm-svn: 114512
2010-09-22 00:24:45 +00:00
Greg Clayton d7aa114ecc Fixed a build warning where no return values was being returned.
llvm-svn: 114511
2010-09-22 00:23:59 +00:00
Johnny Chen d64c3e7913 Trivial change of a trace output string.
llvm-svn: 114505
2010-09-21 23:47:01 +00:00
Johnny Chen 9c48b8d79c Added a subtest to exercise the capability of lldb Python objects to print
themselves.  Right now, it tests a breakpoint both before and after it has been
resolved.

Updated lldbtest.TestBase.expect() with an additional keyword argument 'exe' (
default to True), which if set to False, will treat the mandatory first argument
as just the string to be matched/or not-matched against the golden input.

llvm-svn: 114501
2010-09-21 23:33:30 +00:00
Caroline Tice 867b185d8d Update help text for breakpoint command one-liners.
Fix minor bug in 'commands alias'; alias commands can now handle command options 
and arguments in the same alias.  Also fixes problem that disallowed "process launch --" as
an alias.

Fix typo in comment in Python script interpreter.

llvm-svn: 114499
2010-09-21 23:25:40 +00:00
Johnny Chen 90312a8492 Wrapped the subclass-specific cleanup call within a try:except: clause.
And removed the informational output from the conditional_break test case.

llvm-svn: 114493
2010-09-21 22:34:45 +00:00
Greg Clayton 9e826e3292 Fixed an issue with the clang type creation code for C++ classes where we wouldn't set a CXXRecordDecl to be NOT empty if we had base classes that were not empty or had virtual functions.
llvm-svn: 114484
2010-09-21 21:22:23 +00:00
Johnny Chen ea88e94318 Added a more complex test case of breakpoint commands, which executes a sequence
of 'breakpoint command add/list/remove' commands to set breakpoint callbacks,
list them, and then remove one.

Modified the lldbtest.TestBase.expect() method to add two additional keyword
arguments:

o matching (default to True), which, if set to False, reverses the semantics of
  'expect' to 'expect not'

o patterns (default to None), which specifies a list of regexp patterns to match
  against the output from running the command

TestBreakpointCommand.py uses the matching=False and the patterns=[...] expect()
API.

llvm-svn: 114480
2010-09-21 21:08:53 +00:00
Caroline Tice 650b92683a Re-write/clean up code that generated Python breakpoint commands.
Add a warning if no command was attached to the breakpoint.
Update the help slightly.

llvm-svn: 114467
2010-09-21 19:25:28 +00:00
Johnny Chen 2989bfa88b Decorated PersistentVariablesTestCase.test_persistent_variables() with
@expectedFailure as of r114384.

llvm-svn: 114466
2010-09-21 19:12:39 +00:00
Sean Callanan fc55f5d1b0 Removed the hacky "#define this ___clang_this" handler
for C++ classes.  Replaced it with a less hacky approach:

 - If an expression is defined in the context of a
   method of class A, then that expression is wrapped as
   ___clang_class::___clang_expr(void*) { ... }
   instead of ___clang_expr(void*) { ... }.

 - ___clang_class is resolved as the type of the target
   of the "this" pointer in the method the expression
   is defined in.

 - When reporting the type of ___clang_class, a method
   with the signature ___clang_expr(void*) is added to
   that class, so that Clang doesn't complain about a
   method being defined without a corresponding
   declaration.

 - Whenever the expression gets called, "this" gets
   looked up, type-checked, and then passed in as the
   first argument.

This required the following changes:

 - The ABIs were changed to support passing of the "this"
   pointer as part of trivial calls.

 - ThreadPlanCallFunction and ClangFunction were changed
   to support passing of an optional "this" pointer.

 - ClangUserExpression was extended to perform the
   wrapping described above.

 - ClangASTSource was changed to revert the changes
   required by the hack.

 - ClangExpressionParser, IRForTarget, and
   ClangExpressionDeclMap were changed to handle
   different manglings of ___clang_expr flexibly.  This
   meant no longer searching for a function called
   ___clang_expr, but rather looking for a function whose
   name *contains* ___clang_expr.

 - ClangExpressionParser and ClangExpressionDeclMap now
   remember whether "this" is required, and know how to
   look it up as necessary.

A few inheritance bugs remain, and I'm trying to resolve
these.  But it is now possible to use "this" as well as
refer implicitly to member variables, when in the proper
context.

llvm-svn: 114384
2010-09-21 00:44:12 +00:00
Johnny Chen 958da040e4 Changed the order of two assignment stmts.
llvm-svn: 114381
2010-09-21 00:16:09 +00:00
Johnny Chen 209cdbef64 Added the capability to source the configFile specified via the "-c" option in
order to customize the running of the test suite.  For the time being, the
supported customizations are:

o redirecting stdout and/or stderr
o specifying a list of compilers to build the test programs
o specifying a list of architectures to build the test programs for

Also checked into the examples/test directory some example files which
demonstrate the usage for the above customizations.

$ ./dotest.py -v -c ~/.lldbtest-config persistent_variables
$ cat ~/.lldbtest-config
sys.stderr = open("/tmp/lldbtest-stderr", "w")
sys.stdout = open("/tmp/lldbtest-stdout", "w")
compilers = ["gcc", "llvm-gcc"]
archs = ["x86_64", "i386"]
$ cat /tmp/lldbtest-stderr
----------------------------------------------------------------------
Collected 1 test


Configuration: arch=x86_64 compiler=gcc
test_persistent_variables (TestPersistentVariables.PersistentVariablesTestCase)
Test that lldb persistent variables works correctly. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.397s

OK

Configuration: arch=x86_64 compiler=llvm-gcc
test_persistent_variables (TestPersistentVariables.PersistentVariablesTestCase)
Test that lldb persistent variables works correctly. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.282s

OK

Configuration: arch=i386 compiler=gcc
test_persistent_variables (TestPersistentVariables.PersistentVariablesTestCase)
Test that lldb persistent variables works correctly. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.297s

OK

Configuration: arch=i386 compiler=llvm-gcc
test_persistent_variables (TestPersistentVariables.PersistentVariablesTestCase)
Test that lldb persistent variables works correctly. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.269s

OK
$ cat /tmp/lldbtest-stdout
$ 

llvm-svn: 114380
2010-09-21 00:09:27 +00:00
Johnny Chen dba0a0fbef Changed this breakpoint callback function to print to the stdout instead of
stderr so as not to disrupt the information emitted by the unittest framework.

llvm-svn: 114377
2010-09-20 23:51:27 +00:00
Caroline Tice 75f9f34009 Make the short option print out before the long option in the
command options detailed help section (since it's sorted by short option).

llvm-svn: 114364
2010-09-20 21:52:58 +00:00
Caroline Tice 12cecd741d Make GetInstanceSettingsValue methods take an Error * rather than an Error &,
and have them return a bool to indicate success or not.

llvm-svn: 114361
2010-09-20 21:37:42 +00:00
Caroline Tice daccaa9e83 Add UserSettings to Target class, making Target settings
the parent of Process settings;   add 'default-arch' as a
class-wide setting for Target.    Replace            lldb::GetDefaultArchitecture
with Target::GetDefaultArchitecture & Target::SetDefaultArchitecture.

Add 'use-external-editor' as user setting to Debugger class & update
code appropriately.

Add Error parameter to methods that get user settings, for easier
reporting of bad requests.

Fix various other minor related bugs.

Fix test cases to work with new changes.

llvm-svn: 114352
2010-09-20 20:44:43 +00:00
Johnny Chen daebb6d805 More modularizations.
llvm-svn: 114333
2010-09-20 18:07:50 +00:00
Johnny Chen a4b9aa0538 Added comments.
llvm-svn: 114332
2010-09-20 17:25:45 +00:00
Johnny Chen 433d7741bd Fixed wrong logic in validating term-width value; should be && instead of ||.
llvm-svn: 114330
2010-09-20 17:04:41 +00:00
Johnny Chen ea9fc18163 Fixed lldb 'settings set term-widt 70' command not working.
rdar://problem/8449849

llvm-svn: 114328
2010-09-20 16:36:43 +00:00
Caroline Tice 201a88591d Fix indentations.
llvm-svn: 114326
2010-09-20 16:21:41 +00:00
Caroline Tice dde9cff32a Add GetDescription() and __repr__ () methods to most API classes, to allow
"print" from inside Python to print out the objects in a more useful
manner.

llvm-svn: 114321
2010-09-20 05:20:02 +00:00
Johnny Chen 8409284a32 Added @expectedFailure decorator for test_set_term_width().
llvm-svn: 114307
2010-09-19 02:47:18 +00:00
Greg Clayton 1b65488229 Added code that will allow completely customizable prompts for use in
replacing the "(lldb)" prompt, the "frame #1..." displays when doing
stack backtracing and the "thread #1....". This will allow you to see 
exactly the information that you want to see where you want to see it.
This currently isn't hookup up to the prompts yet, but it will be soon.

So what is the format of the prompts? Prompts can contain variables that
have access to the current program state. Variables are text that appears
in between a prefix of "${" and ends with a "}". Some of the interesting
variables include:

// The frame index (0, 1, 2, 3...)
${frame.index}

// common frame registers with generic names
${frame.pc}
${frame.sp}
${frame.fp}
${frame.ra}
${frame.flags}

// Access to any frame registers by name where REGNAME is any register name:
${frame.reg.REGNAME}

// The current compile unit file where the frame is located
${file.basename}
${file.fullpath}

// Function information
${function.name}
${function.pc-offset}

// Process info
${process.file.basename}
${process.file.fullpath}
${process.id}
${process.name}

// Thread info
${thread.id}
${thread.index}
${thread.name}
${thread.queue}
${thread.stop-reason}

// Target information
${target.arch}

// The current module for the current frame (the shared library or executable
// that contains the current frame PC value):
${module.file.basename}
${module.file.fullpath}

// Access to the line entry for where the current frame is when your thread
// is stopped:
${line.file.basename}
${line.file.fullpath}
${line.number}
${line.start-addr}
${line.end-addr}

Many times the information that you might have in your prompt might not be
available and you won't want it to print out if it isn't valid. To take care
of this you can enclose everything that must resolve into a scope. A scope
is starts with '{' and ends with '}'. For example in order to only display
the current file and line number when the information is available the format
would be:

"{ at {$line.file.basename}:${line.number}}"

Broken down this is:

start the scope: "{"

format whose content will only be displayed if all information is available:
        "at {$line.file.basename}:${line.number}"

end the scope: "}"

We currently can represent the infomration we see when stopped at a frame:

frame #0: 0x0000000100000e85 a.out`main + 4 at test.c:19

with the following format:

"frame #${frame.index}: ${frame.pc} {${module.file.basename}`}{${function.name}{${function.pc-offset}}{ at ${line.file.basename}:${line.number}}\n"

This breaks down to always print:

        "frame #${frame.index}: ${frame.pc} "

only print the module followed by a tick if we have a valid module:

        "{${module.file.basename}`}"
        
print the function name with optional offset:
        "{${function.name}{${function.pc-offset}}"

print the line info if it is available:
        
        "{ at ${line.file.basename}:${line.number}}"

then finish off with a newline:

        "\n"

Notice you can also put newlines ("\n") and tabs and everything else you
are used to putting in a format string when desensitized with the \ character.

Cleaned up some of the user settings controller subclasses. All of them 
do not have any global settings variables and were all implementing stubs
for the get/set global settings variable. Now there is a default version
in UserSettingsController that will do nothing.

llvm-svn: 114306
2010-09-19 02:33:57 +00:00
Johnny Chen dd4da82c92 Removed the @expectedFailure decorators; it was fixed with r114258.
llvm-svn: 114305
2010-09-19 02:31:53 +00:00
Greg Clayton 340b2baa24 Added a better error message to the "frame variable" when you try to view
frame variables and are not stopped in a valid frame.

llvm-svn: 114267
2010-09-18 04:06:15 +00:00
Greg Clayton f5fb427d85 Fixed an issue with:
(lldb) frame variable --location

Where the address of variables wasn't being formatted consistently.

llvm-svn: 114266
2010-09-18 04:00:06 +00:00
Greg Clayton ed8a705cea General command line help cleanup:
- All single character options will now be printed together
- Changed all options that contains underscores to contain '-' instead
- Made the help come out a little flatter by showing the long and short
  option on the same line.
- Modified the short character for "--ignore-count" options to "-i"

llvm-svn: 114265
2010-09-18 03:37:20 +00:00
Greg Clayton 6ba7815115 Bug #: 8447030
Fixed an issue with ClangASTContext::GetIndexOfChildMemberWithName() 
where objective C ivars were not being found correctly if they were
the second or higher child.

llvm-svn: 114258
2010-09-18 02:11:07 +00:00
Greg Clayton a701509229 Fixed the way set/show variables were being accessed to being natively
accessed by the objects that own the settings. The previous approach wasn't
very usable and made for a lot of unnecessary code just to access variables
that were already owned by the objects.

While I fixed those things, I saw that CommandObject objects should really
have a reference to their command interpreter so they can access the terminal
with if they want to output usaage. Fixed up all CommandObjects to take
an interpreter and cleaned up the API to not need the interpreter to be
passed in.

Fixed the disassemble command to output the usage if no options are passed
down and arguments are passed (all disassebmle variants take options, there
are no "args only").

llvm-svn: 114252
2010-09-18 01:14:36 +00:00
Johnny Chen 49b415de1f Added a hook for the test driver to take an optional config file to customize
the running of the test suite.  Right now, it doesn't do anything with the
config file.

Pass "-c myConfigFile" to specify the config file.

llvm-svn: 114245
2010-09-18 00:16:47 +00:00
Johnny Chen aa90292126 Fixed a typo and supplied a more appropriate assert message.
llvm-svn: 114232
2010-09-17 22:45:27 +00:00
Johnny Chen b330786d1f Added test cases to FoundationTestCase to exercise lookup of objc data types and
to evaluate expressions.  Marked with @expectedFailure decorators for the time
being.

Enhanced the lldbtest.TestBase.expect() API to allow an additional keyword arg
named "error".  If the client passes "error=True", it signifies that an error
while running the command is expected.  The golden input is then compared
against the return object's error output.

llvm-svn: 114228
2010-09-17 22:28:51 +00:00