Commit Graph

1705 Commits

Author SHA1 Message Date
Stephen Wilson dd3a948527 StopInfo now lives in the lldb_private namespace. Qualify.
llvm-svn: 122839
2011-01-04 21:44:13 +00:00
Stephen Wilson 905d814977 Use default implementation of Thread::GetStackFrameCount and Thread::GetStackFrameAtIndex.
llvm-svn: 122838
2011-01-04 21:43:19 +00:00
Stephen Wilson 20d1cfd717 Do not load sections manually when launching a Linux process.
This code was a temporary workaround due to the lack of a dynamic loader plugin
for the Linux platform that has bit rotted over time.  Instead of replacing this
hack with another a proper plugin will be developed instead.

llvm-svn: 122837
2011-01-04 21:42:31 +00:00
Stephen Wilson 8c7795d26a Update ProcessLinux method signatures to be in line with LLDB's current API.
llvm-svn: 122836
2011-01-04 21:41:31 +00:00
Stephen Wilson 9212d7f7ae Host::StopMonitoringChildProcess has been removed. Provide a substitute.
llvm-svn: 122835
2011-01-04 21:40:25 +00:00
Stephen Wilson 5a8feeaf8a Replace old "CurrentThread" calls with equivalent "SelectedThread" calls.
llvm-svn: 122834
2011-01-04 21:39:27 +00:00
Sean Callanan e4f98722be Fixed a problem where constant results of expressions
were not being created in the proper way, meaning
results were getting lost.

llvm-svn: 122800
2011-01-04 02:41:41 +00:00
Greg Clayton bc114c6b20 Fixed the file ordering (alphabetic) in the Commands folder.
llvm-svn: 122797
2011-01-04 01:17:46 +00:00
Johnny Chen c77e5b2f44 Fix typo of the test method name.
llvm-svn: 122770
2011-01-03 20:40:08 +00:00
Johnny Chen 9ebe1724e3 Updated comment.
llvm-svn: 122767
2011-01-03 19:55:37 +00:00
Johnny Chen d71ffbcb24 Uncomment the two failed 'expression' commands regarding fully qualified namespace variables.
And decorate the test cases as @expectedFailure.

llvm-svn: 122525
2010-12-23 23:26:05 +00:00
Johnny Chen 31c39dac6d Add a simple command: 'version' to the command interpreter, and an accompanying
test case test_help_version().

llvm-svn: 122515
2010-12-23 20:21:44 +00:00
Jim Ingham a2cf2637da For the language check in GetObjectDescription, if we can't find a language runtime for the value we're looking at, BUT it IS at least a pointer, try the ObjCRuntime language. That's currently the only language runtime that has an object description method anyway...
llvm-svn: 122465
2010-12-23 02:29:54 +00:00
Jim Ingham ff471a9402 "frame variable" requires that the process be running and paused or there aren't any frames... So mark the command properly as such.
llvm-svn: 122464
2010-12-23 02:17:54 +00:00
Johnny Chen d5f66fcbac Add a test case for the SBFrame APIs. In particular, it uses the frame API to
get the argument values of the call stacks when stopped on the breakpoint.

Radar has been filed for the expected failures:
test failure: ./dotest.py -v -w -t -p TestFrames (argument values are wrong)

llvm-svn: 122460
2010-12-23 01:12:19 +00:00
Johnny Chen cdbe594841 No need to pass an empty string as an arg or as an env string to the SBTarget.LaunchProcess() API.
llvm-svn: 122450
2010-12-22 22:56:19 +00:00
Johnny Chen 858718a9e2 Simplify the breakpoint command function. Instead of fetching the command interpreter
and run the "process continue" command, use the SBProcess.Continue() API.

llvm-svn: 122434
2010-12-22 20:36:29 +00:00
Johnny Chen d161a85700 Broadcaster::AddListener(): Bail out early if the passed in Listener pointer is
NULL, instead of registering a NULL listener and to crash later.

llvm-svn: 122429
2010-12-22 19:29:31 +00:00
Johnny Chen 73f7fa82e5 Modify one assertion message.
llvm-svn: 122428
2010-12-22 19:23:44 +00:00
Jason Molenda f830e481c2 RegisterContextLLDB.cpp (InitializeNonZerothFrame): If we get a
0 mid-stack, stop backtracing.

SectionLoadList.cpp (ResolveLoadAddress): Don't assert on an
out-of-range address, just return an invalid Address object.
The unwinder may be passing in invalid addresses on the final
stack frame and the assert is a problem.

llvm-svn: 122386
2010-12-22 02:02:45 +00:00
Johnny Chen 77c4697735 Fix some typos in the docstrings and also update the test method names.
llvm-svn: 122382
2010-12-22 00:56:47 +00:00
Johnny Chen f2df189b72 Add test cases for registering a listener object with the broadcaster of a process
and waiting for two expected state changed events to arrive: "running" followed by
"stopped".

llvm-svn: 122380
2010-12-22 00:32:54 +00:00
Johnny Chen 3635eae697 Rename the test methods to be more meaningful.
llvm-svn: 122352
2010-12-21 19:52:54 +00:00
Johnny Chen 4f8caab924 Set the debugger to asynchronous mode before using the Python API call to kill
the process.  The custom thread started before this point is running in a loop
waiting for events to come.

llvm-svn: 122316
2010-12-21 05:43:37 +00:00
Greg Clayton 6bcfafa0fe Updated Xcode build version to lldb-37 and debugserver-123.
llvm-svn: 122308
2010-12-21 02:23:58 +00:00
Johnny Chen 0b0c57806b Fix typo.
llvm-svn: 122306
2010-12-21 02:10:18 +00:00
Johnny Chen f667ab526b Added python_api/event/TestEvents.py to get the listener object associated with the
debugger and to exercise some event APIs.

llvm-svn: 122304
2010-12-21 02:06:56 +00:00
Greg Clayton bdea7cee67 Remove an assertion that is causing crashes. We do need to find a way to reproduce when this assertion asserts, but we should crash our debug session because of it. For now we log to stderr in hope of tracking it down.
llvm-svn: 122290
2010-12-20 23:42:12 +00:00
Johnny Chen 25c04838e9 The recent change in argument parsing is messing up the emacs lldb mode's capability to properly
scan the debugger output for program counter when it comes to the output of 'Up Stack' or 'Down Stack'
gud commands.  Remove the single quotes around the argument strings for "settings set frame-format"
and "settings set thread-format" commands to avoid the single quotes which were being emitted as part
of the debugger output.

llvm-svn: 122286
2010-12-20 22:58:58 +00:00
Johnny Chen 592b50e9dc Patch from Stephen:
Provide a missing resolve_path argument in calls to FileSpec's
constructor for both Linux and FreeBSD code fragments.

llvm-svn: 122275
2010-12-20 21:52:18 +00:00
Johnny Chen 8c46c6fee1 Patch from Stephen Wilson:
Provide full qualification for #include's.

llvm-svn: 122274
2010-12-20 21:45:22 +00:00
Johnny Chen 622220b66d Change the test case test_set_prompt() to no longer require quotes around lldb2 in:
# Set prompt to 'lldb2'.
   self.runCmd("settings set prompt lldb2")

llvm-svn: 122272
2010-12-20 21:29:34 +00:00
Johnny Chen a6846833ea Patch from Stephen Wilson:
POSIX does not define sockaddr_un.sun_len.  Set only when required by
the platform.

llvm-svn: 122266
2010-12-20 21:07:54 +00:00
Greg Clayton af67cecd47 The LLDB API (lldb::SB*) is now thread safe!
llvm-svn: 122262
2010-12-20 20:49:23 +00:00
Johnny Chen 508265afa5 Patch from Stephen Wilson:
Fix a typo where a qualification was being interpreted as a label.

llvm-svn: 122260
2010-12-20 20:33:26 +00:00
Caroline Tice 3d6086f628 Add code to make sure InputReaders finish and are cleaned up when
a Debugger object is destroyed or re-set. (Thus making sure that, for
example, the Python interpreter finishes and exits cleanly rather than
being left in an undefined state.)

llvm-svn: 122255
2010-12-20 18:35:50 +00:00
Greg Clayton fff42e6241 Line tables were trying to be too clever and only use 24 bits for a line
table offset where the offset is within a section. Increased the section
offset for line table entries to be 32 bits (from 24 bits), giving each 
section a 4G offset, and increased the section index to 32 bits (from 8 bits).

llvm-svn: 122200
2010-12-19 22:07:39 +00:00
Greg Clayton 9906250fe2 Removed logging code that I accidentally left in after recent changes.
llvm-svn: 122198
2010-12-19 21:36:12 +00:00
Greg Clayton 6ad07dd9e9 Improved our argument parsing abilities to be able to handle stuff more like
a shell would interpret it. A few examples that we now handle correctly

INPUT: "Hello "world
OUTPUT: "Hello World"

INPUT: "Hello "' World'
OUTPUT: "Hello World"

INPUT: Hello" World"
OUTPUT: "Hello World"

This broke the setting of dictionary values for the "settings set" command
for things like:

(lldb) settings set target.process.env-vars ["MY_ENV_VAR"]=YES

since we would drop the quotes. I fixed the user settings controller to use
a regular expression so it can accept any of the following inputs for
dictionary setting:

settings set target.process.env-vars ["MY_ENV_VAR"]=YES
settings set target.process.env-vars [MY_ENV_VAR]=YES
settings set target.process.env-vars MY_ENV_VAR=YES

We might want to eventually drop the first two syntaxes, but I won't make
that decision right now.

This allows more natural setting of the envirorment variables:

settings set target.process.env-vars MY_ENV_VAR=YES ABC=DEF CWD=/tmp

llvm-svn: 122166
2010-12-19 03:41:24 +00:00
Greg Clayton 3b14763356 Linux patches from Stephen Wilson.
llvm-svn: 122130
2010-12-18 01:54:34 +00:00
Greg Clayton 5c844d51c8 Linux patches from Stephen Wilson.
llvm-svn: 122128
2010-12-18 01:52:51 +00:00
Greg Clayton deaeb2c18e Linux patches from Stephen Wilson.
llvm-svn: 122127
2010-12-18 01:52:08 +00:00
Greg Clayton b096dcae4a Linux patches from Stephen Wilson.
llvm-svn: 122126
2010-12-18 01:49:57 +00:00
Greg Clayton 082bb00bc4 Linux patches from Stephen Wilson.
llvm-svn: 122125
2010-12-18 01:48:09 +00:00
Sean Callanan ed85f908d6 Fixed the handling of the _cmd parameter in the i386
ABI.

llvm-svn: 122118
2010-12-18 00:32:25 +00:00
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
Greg Clayton 8f49e51853 Bumped Xcode project versions to for lldb-36 and debugserver-122.
llvm-svn: 122061
2010-12-17 15:59:24 +00:00
Greg Clayton 8ac365cc4e Removed darwin specific CPU type defines to make UnwindAssemblyProfiler_x86 able to compile on linux (patch from Stephen Wilson).
llvm-svn: 122060
2010-12-17 15:54:09 +00:00
Greg Clayton 442d7544ac Removed libunwind sources as we aren't using them anymore.
llvm-svn: 122059
2010-12-17 15:50:20 +00:00
Greg Clayton f028a1fb84 Added access to set the current stack frame within a thread so any command
line commands can use the current thread/frame.

Fixed an issue with expressions that get sandboxed in an objective C method
where unichar wasn't being passed down.

Added a "static size_t Scalar::GetMaxByteSize();" function in case we need
to know the max supported by size of something within a Scalar object.

llvm-svn: 122027
2010-12-17 02:26:24 +00:00
Johnny Chen 7ac81906ea Modify the regexp to match the debugger output of the 'Up Stack' and 'Down Stack'
gud commands in order to more reliably locate the program counter and to display
the file-and-line.

llvm-svn: 122020
2010-12-17 01:35:41 +00:00
Greg Clayton 3c310a1a79 Fixes for linux building from Stephen Wilson.
llvm-svn: 122002
2010-12-16 21:36:30 +00:00
Greg Clayton ce6d19a732 Fixes for linux building from Stephen Wilson.
llvm-svn: 122001
2010-12-16 21:33:41 +00:00
Greg Clayton ed6deadb46 Added header doc for the recently added Process::ReadUnsignedInteger (addr_t addr, size_t int_byte_size, Error &error) function.
llvm-svn: 121999
2010-12-16 20:15:34 +00:00
Greg Clayton 58a4c46766 Added the ability to read unsigned integers from the Process:
uint64_t Process::ReadUnsignedInteger (addr_t addr, size_t int_byte_size, Error &error);

llvm-svn: 121996
2010-12-16 20:01:20 +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
Jason Molenda 4f75c691a5 Remove #include of non-existant lldb/Expression/ASTSplitConsumer.h
(from Sean's commit a minute ago)

llvm-svn: 121954
2010-12-16 03:23:53 +00:00
Sean Callanan e4ec90e990 Implemented a feature where the expression parser
can avoid running the code in the target if the
expression's result is known and the expression
has no side effects.

Right now this feature is quite conservative in
its guess about side effects, and it only computes
integer results, but the machinery to make it more
sophisticated is there.

llvm-svn: 121952
2010-12-16 03:17:46 +00:00
Johnny Chen 13eb0eaea7 Patch from Stephen Wilson:
Extend Swig's include search path.

   Cover both /usr/include and /usr/local/include.  This should allow Swig to find
   system headers such as stdint.h on all platforms we currently support.

llvm-svn: 121943
2010-12-16 02:03:06 +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 4b33209a04 Patch by Stephen Wilson to make Swig happy building on linux.
Pass the test suite on Mac OS X Snow Leopard.

llvm-svn: 121924
2010-12-16 00:01:06 +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
Greg Clayton e2956eeb87 Fix invalid conversion from "const char *" to "char *" for linux systems. strchr() on darwin returns "char *" so we weren't seeing this issue on MacOSX.
llvm-svn: 121897
2010-12-15 20:52:40 +00:00
Greg Clayton bdf4c6ac4f Fixed an error where the thread index was being returned as zero in "uint32_t SBBreakpoint::GetThreadIndex() const" even when it isn't specified. It should be UINT32_MAX to indicate there is no thread index set for the breakpoint (the breakpoint isn't thread specific). Also fixed the ThreadSpec.cpp to use UINT32_MAX instead of -1. Fixed the logging Printf statement in "uint32_t SBBreakpoint::GetThreadIndex() const" to not print the address of the "index" function from <string.h>!
llvm-svn: 121896
2010-12-15 20:50:06 +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 a51174af72 Add termination instructions when entering the interactive script interpreter.
llvm-svn: 121884
2010-12-15 19:51:12 +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
Jason Molenda 3f8688b614 Move the demangle-failed indication out a bit so other failing cases
also get marked as having failed (so we don't try to demangle the
same symbol multiple times).

llvm-svn: 121835
2010-12-15 04:27:04 +00:00
Jason Molenda b690fbbaec Fix a crash on some platforms where a dSYM for a system library lists a DW_AT_mips_linkage_name for
a non-mangled function - we pass the non mangled string down through abi::__cxa_demangle and it
crashes.  Usually passing non mangled strings to abi::__cxa_demangle works out fine but not
always, apparently.

llvm-svn: 121834
2010-12-15 04:20:25 +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
Greg Clayton d695334156 Fixed a crasher in the DWARF log channel code.
llvm-svn: 121810
2010-12-14 23:43:15 +00:00
Greg Clayton 48ebb0c767 Updated the code signing instructions to be more complete.
llvm-svn: 121804
2010-12-14 23:19:04 +00:00
Greg Clayton 30ddd1d012 Removed unused files that were out of date and causing issues with the
linux build.

llvm-svn: 121803
2010-12-14 23:13:51 +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
Jim Ingham fe0c425308 Fix the completion of "fr " and the like.
llvm-svn: 121785
2010-12-14 19:56:01 +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
Caroline Tice 472362e6ed Fix small bugs:
- Make sure cmd_obj & cmd_obj_sp contain a valid objects before attempting to 
dereference, in CommandObjectCommandsAlias::Execute and 
CommandInterpreter::HandleCommand.

- Modify CommandInterpreter::GetCommandSPExact to properly handle
multi-word command inputs.

llvm-svn: 121779
2010-12-14 18:51:39 +00:00
Greg Clayton 69b582fa94 Changed:
SBValue SBFrame::LookupVar(const char *name);
To
	SBValue SBFrame::FindVariable (const char *name);

Changed:
	SBValue LookupVarInScope (const char *name, const char *scope);
to
	SBValue FindValue (const char *name, ValueType value_type);

The latter makes it possible to not only find variables (params, locals, globals, and statics), but we can also now get register sets, registers and persistent variables using the frame as the context.

llvm-svn: 121777
2010-12-14 18:39:31 +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 e85d9cb8e2 Fixed rdar://problem/8767055 test suite failure TestStaticVariables.py (ToT r121745).
Populate the variable list from the stack frame, first.

llvm-svn: 121773
2010-12-14 17:40:04 +00:00
Greg Clayton 72eff18ae4 Fixed SBFrame to properly check to make sure it has a valid m_opaque_sp object
before trying to use it.

llvm-svn: 121748
2010-12-14 04:58:53 +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
Sean Callanan 9d48e80426 Bugfixes for the new "self" pointer handling. Specifically,
the code to pass the _cmd pointer has been improved, and _cmd
is now set to the value of _cmd for the current context, as
opposed to being simply NULL.

llvm-svn: 121739
2010-12-14 00:42:36 +00:00
Sean Callanan 1782783095 Added support for generating expressions that have
access to the members of the Objective-C self object.

The approach we take is to generate the method as a
@category on top of the self object, and to pass the
"self" pointer to it.  (_cmd is currently NULL.)

Most changes are in ClangExpressionDeclMap, but the
change that adds support to the ABIs to pass _cmd
touches a fair amount of code.

llvm-svn: 121722
2010-12-13 22:46:15 +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
Caroline Tice 01cb3ea2ee Revert a small but important part of the EOF handling code that Greg
missed in his previous revert.

llvm-svn: 121712
2010-12-13 20:05:03 +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
Greg Clayton c30abdfa7d Fixed a crasher where when a ProcessGDBRemote class was being destroyed, it would eventually destroy the dynamic loader (when the lldb_private::Process::m_dynamic_loader_ap destroys itself in the object member destructor chain). The dynamic loader was calling a pure virtual method in Process which was causing a crash. The quick fix is to reset the auto pointer in the ProcessGDBRemote destructor when ProcessGDBRemote is still a valid object with all its pure virtual functions intact.
llvm-svn: 121704
2010-12-13 18:11:18 +00:00
Sean Callanan 481144790c Updated to latest Clang revision. This involved
very minor changes, changing how we get the target
type from a TypedefType, adding a parameter to
EnumDecl::Create(), and other minor tweaks.

llvm-svn: 121663
2010-12-13 01:26:27 +00:00
Greg Clayton bfae66ae1d Fixed a multi-threaded race condition that could happen when communication classes are shutting down. We currently don't protect communication connection classes against multi-threaded access. The connection is stored in the lldb_private::Communication.m_connection_ap auto_ptr member. We either need to add protections when accessing this class or not let anything racy occur. With this fix, we are doing the latter.
llvm-svn: 121647
2010-12-12 21:50:57 +00:00
Greg Clayton 7d07a45fff Fixed an issue where the macosx dynamic loader, on the first shared library loaded notification, wasn't properly removing shared libraries from the target that didn't get loaded. This usually happens when a different shared library is loaded in place of another due to DYLD_LIBRARY_PATH or DYLD_FRAMEWORK_PATH environment variables. We now properly remove any images that didn't make it into the executable.
llvm-svn: 121641
2010-12-12 21:03:32 +00:00
Greg Clayton ac2eb9b1ec Added the ability for SBTarget to resolve load addresses (convert lldb::addr_t values into resolved SBAddress objects). These SBAddress objects can then be used to resolve a symbol context using "lldb::SBSymbolContext ResolveSymbolContextForAddress (const lldb::SBAddress& addr, uint32_t resolve_scope);".
llvm-svn: 121638
2010-12-12 19:25:26 +00:00
Caroline Tice 01274c098b Fix bug where using incomplete strings for command names causes
lldb to crash (because of attempt to look for full names when full
names were not used).

llvm-svn: 121607
2010-12-11 08:16:56 +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
Sean Callanan 7fddd4c1f2 Made all LLDB-generated ASTContexts have valid
DiagnosticClients, and removed code that was patching
over the original problem.

llvm-svn: 121601
2010-12-11 00:08:56 +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
Sean Callanan a43f20df95 Simplified the code that handles overloaded
operator names.

llvm-svn: 121511
2010-12-10 19:51:54 +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
Sean Callanan bfeff8c4a2 Fixed detection of overloaded operators in type
information.  Previously, "operator[]" was not
being recognized because the detector was looking
for "operator " as a prefix.  Now we handle both
cases.

llvm-svn: 121456
2010-12-10 02:15:55 +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
Caroline Tice 2d5289d621 Various fixes mostly relating to the User Settings stuff:
- Added new utility function to Arg, GetQuotedCommandString, which re-assembles
the args into a string, replacing quotes that were originally there.

- Modified user settings stuff to always show individual elements when printing out
arrays and dictionaries.

- Added more extensive help to 'settings set', explaining more about dictionaries
and arrays (including current dictionary syntax).

- Fixed bug in user settings  where quotes were being stripped and lost, so that
sometimes array or dictionary elements that ought to have been a single element
were being split up.

llvm-svn: 121438
2010-12-10 00:26:54 +00:00
Jim Ingham 957373fc84 Changing the ObjC find method implementation to use a ClangUtilityFunction inserted into the target. Consolidate all the
logic for finding the target of a method dispatch into this function, insert & call it.  Gets calls to super, and all the
fixup & fixedup variants working properly.  Also gets the class from the object so that we step through KVO wrapper methods
into the actual user code.

llvm-svn: 121437
2010-12-10 00:26:25 +00:00
Caroline Tice 844d230332 Modify HandleCommand to not do any argument processing until it has determined whether or
not the command should take raw input, then handle & dispatch the arguments appropriately.

Also change the 'alias' command to be a command that takes raw input.  This is necessary to
allow aliases to be created for other commands that take raw input and might want to include
raw input in the alias itself.

Fix a bug in the aliasing mechanism when creating aliases for commands with 3-or-more words.

Raw input should now be properly handled by all the command and alias mechanisms.

llvm-svn: 121423
2010-12-09 22:52:49 +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
Jim Ingham bb9caf73fa process launch now asks to kill the current process if it is alive, and if you affirm, does so for you.
Also added #pragma mark for the command objects defined in the file.

llvm-svn: 121396
2010-12-09 18:58:16 +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
Greg Clayton 8d846daa81 Any arguments that are not options to the "lldb" command line driver, now get
used as the arguments for the inferior program. So for example you can do

% lldb /bin/ls /tmp ~/Documents

And "lldb" will use "/bin/ls" as the program and send arguments "/tmp" and
"~/Documents" as the launch args.

If you specify a file, then all remaining args after option parsing
will be used for program arguments:

% lldb -f /bin/ls /tmp ~/Documents

If you need to pass option values to your inferior program, just terminate
the "lldb" command line driver options with "--":

% lldb -- /bin/ls -AFl /tmp

The arguments are placed into the "settings" variable named 
"target.process.run-args". This allows you to just run the program using
"process launch" and, if no args are specified on that command, the 
"target.process.run-args" values will be used:

% lldb -- /bin/ls -AFl /tmp
Current executable set to '/bin/ls' (x86_64).
(lldb) settings show target.process.run-args 
target.process.run-args (array):
  [0]: '-AFl'
  [1]: '/tmp'
(lldb) 
(lldb) r
Process 56753 launched: '/bin/ls' (x86_64)
lrwxr-xr-x@ 1 root  wheel  11 Nov 19  2009 /tmp@ -> private/tmp

llvm-svn: 121295
2010-12-08 22:23:24 +00:00
Greg Clayton 9625d08cec Fixed an issue in our source manager where we were permanently caching source
file data, so if a source file was modified, we would always show the first
cached copy of the source data. We now check file modification times when
displaying source info so we can show the update source info.

llvm-svn: 121278
2010-12-08 20:16: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
Greg Clayton 5e0ab134c6 Bumped lldb Xcode version to 35 for lldb-35, and debugserver to 121 for
debugserver-121.

llvm-svn: 121237
2010-12-08 05:24:05 +00:00
Greg Clayton 10177aa05e Added the ability to dump sections to a certain depth (for when sections
have children sections).

Modified SectionLoadList to do it's own multi-threaded protected on its map.
The ThreadSafeSTLMap class was difficult to deal with and wasn't providing
much utility, it was only getting in the way.

Make sure when the communication read thread is about to exit, it clears the
thread in the main class.

Fixed the ModuleList to correctly ignore architectures and UUIDs if they aren't
valid when searching for a matching module. If we specified a file with no arch,
and then modified the file and loaded it again, it would not match on subsequent
searches if the arch was invalid since it would compare an invalid architecture
to the one that was found or selected within the shared library or executable.
This was causing stale modules to stay around in the global module list when they
should have been removed.

Removed deprecated functions from the DynamicLoaderMacOSXDYLD class.

Modified "ProcessGDBRemote::IsAlive" to check if we are connected to a gdb
server and also make sure our process hasn't exited.

llvm-svn: 121236
2010-12-08 05:08:21 +00:00
Greg Clayton bc5cad6c6b Fixed up the error message for when a file is not supported.
llvm-svn: 121235
2010-12-08 04:55:11 +00:00
Sean Callanan e97ae90da0 Fixed a problem where the AST importer would assert()
because the diagnostic client for one of the AST
contexts is NULL.  Now we provide a form of Miranda
rights to AST contexts: they are provided with a very
simple diagnostic client if they do not have one
themselves.

llvm-svn: 121225
2010-12-08 01:51:31 +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
Sean Callanan a162ebafdb More logging for use in debugging the interactions
between clients of the LLDB API and the expression
parser.

llvm-svn: 121193
2010-12-07 22:55:01 +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
Greg Clayton 2a43368a03 Cleanup before making the objective C ivar changes.
llvm-svn: 121158
2010-12-07 18:26:09 +00:00
Greg Clayton f66935840d Improved the "image dump section" command output by making sure
it indents and shows things correctly. When we are debugging DWARF
in .o files with debug map, we can see the remapped sections by
dumping the sections for the .o files by explicitly dumping the
module by name. For example, debugging the lldb/test/class_types
example on MacOSX without a dSYM file we can make a query that 
causes the main.o file to be loaded, then we can do a:

(lldb) image dump section main.o

This will show the exact section map that is used and can help
track down when things are going wrong with DWARF in .o files with
debug map.

llvm-svn: 121154
2010-12-07 18:05:22 +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
Sean Callanan c673a6e93e Logging improvements to help identify major events in
LLDB expression execution.
We also now print the argument structure after execution,
to allow us to verify that the expression did indeed
execute correctly.

llvm-svn: 121126
2010-12-07 10:00:20 +00:00
Greg Clayton 65e364e5da Fixed an issue when debugging with DWARF in the .o files where
if two functions had the same demangled names (constructors where
we have the in charge and not in charge version) we could end up
mixing the two up when making the function in the DWARF. This was
because we need to lookup the symbol by name and we need to use the
mangled name if there is one. This ensures we get the correct address
and that we resolve the linked addresses correctly for DWARf with debug
map.

llvm-svn: 121116
2010-12-07 07:37:38 +00:00
Greg Clayton 75dbe3c799 Forgot to qualify SBSymbol with the lldb namespace for SWIG.
llvm-svn: 121115
2010-12-07 05:59:16 +00:00
Greg Clayton bbdabce2f7 Added symbol table access through the module for now. We might need to expose
a SBSymtab class, but for now, we expose the symbols through the module.

llvm-svn: 121112
2010-12-07 05:40:31 +00:00
Jim Ingham 895c9824d2 Handle the case where you make a ClangExpressionDeclMap without a selected frame.
llvm-svn: 121099
2010-12-07 01:56:02 +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
Sean Callanan f6c7308bb1 Fixes to make id work as well as well as fix minor errors
when calling built-ins.

llvm-svn: 121070
2010-12-06 23:53:20 +00:00
Greg Clayton a4d7830017 When shared libraries are unloaded, they are now removed from the target
ModuleList so they don't show up in the images. Breakpoint locations that are
in shared libraries that get unloaded will persist though so that if you
have plug-ins that load/unload and you have a breakpoint set on functions
in the plug-ins, the hit counts will persist between loads/unloads.

llvm-svn: 121069
2010-12-06 23:51:26 +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
Johnny Chen 8dcb6b96c5 Minor comment string change.
llvm-svn: 121063
2010-12-06 22:51:46 +00:00
Johnny Chen e0e7febe1a More descriptive comment string.
llvm-svn: 121062
2010-12-06 22:49:11 +00:00
Johnny Chen 35986634bc Modify Test_Selector's comment string, too.
llvm-svn: 121052
2010-12-06 22:34:54 +00:00
Johnny Chen 3a820b5e54 Disambiguate the comment strings in order to be used from the .py test file.
llvm-svn: 121051
2010-12-06 22:33:00 +00:00
Sean Callanan 88339f0fd1 Fixed a bug in which the SEL type was being resolved
wrongly as the target of a pointer rather than the
SEL pointer itself.  This caused incorrect behavior
when dealing with Objective-C selector variables.

llvm-svn: 121048
2010-12-06 22:16:55 +00:00
Johnny Chen 73b7b93d42 Modified main.m and TestObjCMethods.py to unbreak the test/foundation directory.
llvm-svn: 121046
2010-12-06 22:09:04 +00:00
Johnny Chen ccdf435a96 Forgot to also check in this file with the previous r121036 change:
/lldb/trunk/test/load_unload/TestLoadUnload.py

llvm-svn: 121045
2010-12-06 22:07:36 +00:00
Johnny Chen 224af79e80 Fail fast by raising an exception if the 'string_to_match' cannot be located
within the file 'filename'.

llvm-svn: 121039
2010-12-06 21:48:08 +00:00
Johnny Chen 42dd3ce1ae Add a test case test_lldb_process_load_and_unload_commands() for using lldb commands
'process load' and 'process unload' to load and unload shared library from lldb command
lines.

llvm-svn: 121036
2010-12-06 21:08:51 +00:00
Greg Clayton 6125206e80 Added more test case functions to cover more objective C functionality.
llvm-svn: 121027
2010-12-06 19:08:45 +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
Sean Callanan 14f0b0e8d5 Fixed a problem in which non-external variables
(for example, string literals) were being flagged
erroneously as undefined external variables.

llvm-svn: 120972
2010-12-06 00:56:39 +00:00
Greg Clayton f7d6a2a6a8 Added a less than operator that will compare the internal opaque pointer values so SBBroadcaster objects can be contained in ordered containers or sorted.
llvm-svn: 120967
2010-12-05 23:14:19 +00:00
Greg Clayton c5f5783044 Fixed an issue where SBProcess::LoadImage(...) was not returning the image
token.

llvm-svn: 120954
2010-12-05 20:38:01 +00:00
Greg Clayton 1c2f283864 Added "void SBBroadcaster::Clear ();" method to SBBroadcaster.
llvm-svn: 120949
2010-12-05 19:36:39 +00:00
Greg Clayton 920c696c54 Fixed a crasher when trying to get event data flavors on events that don't
have event data.

llvm-svn: 120948
2010-12-05 19:21:02 +00:00
Greg Clayton a9ff306151 Make sure that STDOUT and STDERR events in lldb_private::Process carry along
a ProcessEventData so clients can get the process from these events.

llvm-svn: 120947
2010-12-05 19:16:56 +00:00
Greg Clayton 87408b61af Bumped Xcode project build version to 34 for lldb-34.
llvm-svn: 120886
2010-12-04 02:47:38 +00:00
Greg Clayton d46c87a1a8 More reverting of the EOF stuff as the API was changed which we don't want to
do. Closing on EOF is an option that can be set on the 
lldb_private::Communication or the lldb::SBCommunication objects after they
are created. Of course the EOF support isn't hooked up, so they don't do 
anything at the moment, but they are left in so when the code is fixed, it 
will be easy to get working again.

llvm-svn: 120885
2010-12-04 02:39:47 +00:00
Greg Clayton 7788e5fd64 Reverted the close on EOF stuff again as it was crashing Xcode.
llvm-svn: 120883
2010-12-04 02:22:36 +00:00
Johnny Chen 80554b804d Add a test method test_pass_host_env_vars to 'class SettingsCommandTestCase(TestBase)'
which tests the recently added lldb feature of automatically passing the host environment
variables to the launched process.

llvm-svn: 120871
2010-12-04 00:44:56 +00:00
Greg Clayton eed4b5b230 Bumped lldb version to lldb-33 and debugserver to debugserver-120.
llvm-svn: 120864
2010-12-04 00:16:27 +00:00
Greg Clayton 5c5f1a1267 Added the ability to display the new "target.process.inherit-env" setting.
llvm-svn: 120863
2010-12-04 00:12:24 +00:00
Greg Clayton 85851dde89 Added the ability for a process to inherit the current host environment. This
was done as an settings variable in the process for now. We will eventually
move all environment stuff over to the target, but we will leave it with the
process for now. The default setting is for a process to inherit the host
environment. This can be disabled by setting the "inherit-env" setting to
false in the process.

llvm-svn: 120862
2010-12-04 00:10:17 +00:00
Johnny Chen f10af38ba5 Forgot to also check in this file along with the TestBreakpointConditions.py change.
llvm-svn: 120861
2010-12-04 00:07:24 +00:00
Johnny Chen 038d436ac8 Test that "breakpoint modify -c ''" clears the condition for the last created
breakpoint, so that when the breakpoint hits, val = 1 instead of 3.

llvm-svn: 120859
2010-12-03 23:57:17 +00:00
Jim Ingham e0a978487d Documentation fix - explain how to unset conditions. Also fix unsetting -x and -t so they work.
llvm-svn: 120851
2010-12-03 23:04:19 +00:00
Jim Ingham a571c010ab Document the fact that "breakpoint modify" with no breakpoint acts on the
last created breakpoint.

llvm-svn: 120850
2010-12-03 22:37:19 +00:00
Greg Clayton 6997489661 Make sure to index the DWARF if we already haven't so we can resolve forward
declarations when they haven't been found yet.

llvm-svn: 120840
2010-12-03 21:42:06 +00:00
Johnny Chen 729c339a1c Add the '-F' option to the test driver, which makes the running of test suite failfast.
As soon as an error or a failure is encountered, it stops the test suite.

llvm-svn: 120837
2010-12-03 19:59:35 +00:00
Sean Callanan d6e04ae5e7 Eliminated a redundant code path.
llvm-svn: 120834
2010-12-03 19:51:05 +00:00
Caroline Tice f8da863196 Add '-no-stdio' option to 'process launch' command, which causes the
inferior to be launched without setting up terminal stdin/stdout for it
(leaving the lldb command line accessible while the program is executing).
Also add a user settings variable, 'target.process.disable-stdio' to allow
the user to set this globally rather than having to use the command option
each time the process is launched.

llvm-svn: 120825
2010-12-03 18:46:09 +00:00
Greg Clayton ab843393f2 Fixed an issue that would cause an assertion to fire when an inlined function was found during a regex function find call.
llvm-svn: 120814
2010-12-03 17:49:14 +00:00
Greg Clayton eb5596b4af Make sure timed_out is initialized to false just to be on the safe side.
llvm-svn: 120813
2010-12-03 17:47:00 +00:00
Greg Clayton e521966054 Fixed a race condition that could cause ProcessGDBRemote::DoResume() to return
an error saying the resume timed out. Previously the thread that was trying
to resume the process would eventually call ProcessGDBRemote::DoResume() which
would broadcast an event over to the async GDB remote thread which would sent the
continue packet to the remote gdb server. Right after this was sent, it would
set a predicate boolean value (protected by a mutex and condition) and then the
thread that issued the ProcessGDBRemote::DoResume() would then wait for that
condition variable to be set. If the async gdb thread was too quick though, the
predicate boolean value could have been set to true and back to false by the
time the thread that issued the ProcessGDBRemote::DoResume() checks the boolean
value. So we can't use the predicate value as a handshake. I have changed the code
over to using a Event by having the GDB remote communication object post an
event: 

	GDBRemoteCommunication::eBroadcastBitRunPacketSent

This allows reliable handshaking between the two threads and avoids the erroneous
ProcessGDBRemote::DoResume() errors.

Added a host backtrace service to allow in process backtraces when trying to track
down tricky issues. I need to see if LLVM has any backtracing abilities abstracted
in it already, and if so, use that, but I needed something ASAP for the current issue
I was working on. The static function is:

void
Host::Backtrace (Stream &strm, uint32_t max_frames);

And it will backtrace at most "max_frames" frames for the current thread and can be
used with any of the Stream subclasses for logging.

llvm-svn: 120793
2010-12-03 06:02:24 +00:00
Sean Callanan 4a5fcbb92b Removed a compiler warning.
llvm-svn: 120788
2010-12-03 03:02:31 +00:00
Sean Callanan 979f74d1dd Fixed object lifetimes in ClangExpressionDeclMap
so that it is not referring to potentially stale
state during IR execution.

This was done by introducing modular state (like
ClangExpressionVariable) where groups of state
variables have well-defined lifetimes:

- m_parser_vars are specific to parsing, and only
  exist between calls to WillParse() and DidParse().

- m_struct_vars survive for the entire execution
  of the ClangExpressionDeclMap because they
  provide the template for a materialized set of
  expression variables.

- m_material_vars are specific to a single
  instance of materialization, and only exist
  between calls to Materialize() and
  Dematerialize().

I also removed unnecessary references to long-
lived state that really didn't need to be referred
to at all, and also introduced several assert()s
that helped me diagnose a few bugs (fixed too).

llvm-svn: 120778
2010-12-03 01:38:59 +00:00
Greg Clayton 621801846e Fixed DoResume to watch for the correct return value from WaitForIsRunning to avoid spurious errors due to previous fix.
llvm-svn: 120762
2010-12-03 00:27:48 +00:00
Greg Clayton a975990111 Fixed bad logic that was trying to determine if the gdb remote resumed a process or not.
llvm-svn: 120761
2010-12-03 00:19:58 +00:00
Johnny Chen eb3411dc41 Log just the thread name, not process/thread id for easier human reading.
llvm-svn: 120751
2010-12-02 23:31:02 +00:00
Greg Clayton 38a614034a Updated to latest LLVM/Clang for external AST source changes that allow
TagDecl subclasses and Objective C interfaces to complete themselves through
the ExternalASTSource class.

llvm-svn: 120749
2010-12-02 23:20:03 +00:00
Johnny Chen 7528af2f86 When logging, enable process and thread ID recordings. Also add 'state' to the lldb
log-categories, so it now becomes "event process expr state".

llvm-svn: 120745
2010-12-02 22:47:52 +00:00
Johnny Chen c4221e47b0 Fixed a typo in comment.
llvm-svn: 120733
2010-12-02 20:53:05 +00:00
Sean Callanan d7a1ca2a12 Fixed IRForTarget so that it errors out when function
pointers are used.  Previously, they caused a crash
in the JIT because we didn't resolve them correctly.

llvm-svn: 120728
2010-12-02 19:47:57 +00:00
Johnny Chen 20d0b2198b For lldb loggings, prepend log lines with a timestamp. And change the default log options:
o lldb => event process expr
o gdb-remote => packets process

llvm-svn: 120725
2010-12-02 18:35:13 +00:00
Caroline Tice 82305fc59a Add proper EOF handling to Communication & Connection classes:
Add bool member to Communication class indicating whether the
Connection should be closed on receiving an EOF or not.  Update the
Connection read to return an EOF status when appropriate.  Modify the
Communication class to pass the EOF along or not, and to close the
Connection or not, as appropriate.

llvm-svn: 120723
2010-12-02 18:31:56 +00:00
Johnny Chen 5f46b89df2 On second thought, inserting a delay of 1.0 second slows down the test suite
for the types directory quite a bit and masking out potential problems.  Enable
the delay via an environment variable, instead.

llvm-svn: 120719
2010-12-02 18:03:37 +00:00
Johnny Chen 560befce38 GenericTester.generic_type_expr_tester():
Don't overwhelm the expression mechanism.  Previously, there was no delay
    between successive invocations of 'expression' command.  The test suite
    run has experienced 'Resume timed out' or similar error messages.  Now we
    currently add a sleep of 1.0 second before issuing the next 'expression'
    command.

llvm-svn: 120626
2010-12-01 23:46:33 +00:00
Johnny Chen b91cb31490 Add a mechanism of overwriting the default 1.0 second wait time between test
cases when specifying '-w' to the test driver, by using an environment variable
LLDB_TIME_WAIT_BETWEEN_TEST_CASES.

llvm-svn: 120625
2010-12-01 23:35:13 +00:00
Johnny Chen d6c05708eb Remove @expectedFailure decorator as the bug has been fixed.
llvm-svn: 120624
2010-12-01 23:15:58 +00:00
Johnny Chen 6bc1366366 TestBase.setUp() needs to make sure lldb.blacklist is not None
before iterating on it.

llvm-svn: 120623
2010-12-01 23:07:36 +00:00
Johnny Chen 75739045d3 Add a '-b blacklistFile' option to the test driver to take a file specifying the
test classes or test cases to be excludued from the test suite.

Check in an example blacklist file: blacklist.py:

"""
'blacklist' is a Python dictionary, it stores the mapping of a string describing
either a testclass or a testcase, i.e, testclass.testmethod, to the reason (a
string) it is blacklisted.

Following is an example which states that test class IntegerTypesExprTestCase
should be skipped because 'This test class crashed' and the test case
FoundationTestCase.test_data_type_and_expr_with_dsym should be skipped because
it is 'Temporarily disabled'.

blacklist = {'IntegerTypesExprTestCase': 'This test class crashed',
             'FoundationTestCase.test_data_type_and_expr_with_dsym': 'Temporarily disabled'
             }
"""

blacklist = {}

An example of invoking the test driver and specifying a blacklist file:

./dotest.py -b blacklist.py -v types

This runs the tests under 'types' directory but excludes the tests specified in
balcklist.py.

llvm-svn: 120620
2010-12-01 22:47:54 +00:00
Greg Clayton 3c14438fe8 Fixed 32 bit debugging after recent architecture changes to debugserver.
llvm-svn: 120618
2010-12-01 22:45:40 +00:00
Sean Callanan 3670ba5c87 Fixed ClangUserExpression's wrapping of expressions
in C++ methods.  There were two fixes involved:

 - For an object whose contents are not known, the
   expression should be treated as a non-member, and
   "this" should have no meaning.

 - For a const object, the method should be declared
   const as well.

llvm-svn: 120606
2010-12-01 21:35:54 +00:00
Johnny Chen 5237e90cbe Add test cases to test that:
1. 'help image du sym' is ambiguous.
2. 'help image du line' is not ambiguous.

llvm-svn: 120587
2010-12-01 19:10:59 +00:00
Sean Callanan 83b0918938 Allowed ClangExpressionDeclMap to dematerialize
persistent variables even after the parser has
finished running.

llvm-svn: 120521
2010-12-01 01:29:06 +00:00
Sean Callanan 1d47cafc1c Whitespace fix.
llvm-svn: 120520
2010-12-01 01:28:23 +00:00
Johnny Chen ce81496fab Make CommandObjectMultiword::GetSubcommandSP() more robust by appending the
exactly-matched sub_cmd to the passed in 'matches' string list.

llvm-svn: 120516
2010-12-01 01:04:22 +00:00
Johnny Chen 19e302bc70 Remove the @expectedFailure decorator as the bug has been fixed.
llvm-svn: 120515
2010-12-01 01:01:23 +00:00
Jim Ingham 97253e62e9 GetCommandObject returns no matches in the match array when there is only one match. That's odd, but I don't want to change that right now, just cope with it where I'm doing the command matching.
llvm-svn: 120511
2010-12-01 00:42:17 +00:00
Johnny Chen c7c03d919a Add @expectedFailure decorator for a known bug:
rdar://problem/8689814 test failure: test/macosx/universal (the i386 slice does not break?)

llvm-svn: 120505
2010-12-01 00:03:17 +00:00
Johnny Chen be6fb3a85f Add expectedFailure decorator for test_help_image_dump_symtab_should_not_crash().
Possibly due to http://llvm.org/viewvc/llvm-project?rev=120484&view=rev.

llvm-svn: 120503
2010-11-30 23:57:58 +00:00
Jim Ingham 271ad29a4e Fix completion for multi-word commands in the "help" command.
llvm-svn: 120484
2010-11-30 22:59:37 +00:00
Johnny Chen 1922a8dbea Remove @skip decorators for fixed crashes.
llvm-svn: 120479
2010-11-30 22:34:19 +00:00
Sean Callanan f5a998643c Fixed a problem where m_register_info was not being
copied by the copy constructor for ClangExpressionVariable.
This meant that a NULL m_register_info wouldn't be
copied, and instead the field was uninitialized, potentially
confusing the materializer.

llvm-svn: 120472
2010-11-30 22:01:58 +00:00
Johnny Chen 876e6b31f5 Skip two test classes due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120462
2010-11-30 21:09:06 +00:00
Johnny Chen 4bb6ceb764 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120434
2010-11-30 17:59:40 +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 ad6e34609d Skipped two test cases due to seg fault while hadnling command:
Application Specific Information:
HandleCommand(command = "expression self->str")


radar:8711052

llvm-svn: 120431
2010-11-30 17:46:46 +00:00
Johnny Chen aa9bc2eca5 Entire test class skipped due to:
rdar://problem/8710994 Assertion failed: (reg_info) GDBRemoteRegisterContext.cpp, line 199

llvm-svn: 120430
2010-11-30 17:35:58 +00:00
Jim Ingham f48169bb4f Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process. This required a bunch of renaming.
Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.

Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.

llvm-svn: 120386
2010-11-30 02:22:11 +00:00
Sean Callanan 348b5897f9 Added a feature where registers can be referred to
using special $-variables from expressions.

(lldb) expr $rip

These variables are available for reading and
writing.

llvm-svn: 120367
2010-11-30 00:27:43 +00:00
Johnny Chen a994070040 Add comment for a branch of test logic which applies to ['clang', 'llvm-gcc'] only.
llvm-svn: 120355
2010-11-29 23:58:04 +00:00
Johnny Chen 11d2bae187 Minor comment fix.
llvm-svn: 120352
2010-11-29 23:47:40 +00:00
Jason Molenda c1903406e5 Fix build error when lldb is being built i386.
llvm-svn: 120322
2010-11-29 21:38:58 +00:00
Johnny Chen c9ea0f8425 Add an expect() statement within breakpoint_conditions() method which tests that
the process status is indeed 'stopped' before invoking 'frame variable -t val'
command to inspect the frame variable.  When I run the test suite, it sometimes
emits an output like:

runCmd: frame variable -t val
runCmd failed!
error: you must be stopped in a valid stack frame to view frame variables.

The expect() statement inserted is to make sure that the process is stopped and
we have a valid frame.

llvm-svn: 120318
2010-11-29 20:49:09 +00:00
Johnny Chen 4921b11320 Change the variable TestBase.timeWait to the more descriptive timeWaitNextLaunch.
Increase the delta between successive test cases, enabled with the '-w' option to
the test driver, from 0.5 to 1.0 second, to arrive at a cleaner state before the
next test case.

llvm-svn: 120315
2010-11-29 20:20:34 +00:00
Johnny Chen bbda8ed39a Add comment.
llvm-svn: 120295
2010-11-29 17:52:43 +00:00
Johnny Chen 46389e9ddf When looping through the test suite more than once (repeat count > 1), we should
ignore and not enforce the signleton pattern for the LLDBTestResult class.

llvm-svn: 120294
2010-11-29 17:50:10 +00:00
Greg Clayton facfd06c4f When we resolve a forward declaration type, be sure to put it into the m_die_to_type map so we don't assert later when someone tries to resolve the type.
llvm-svn: 119910
2010-11-20 19:16:50 +00:00
Sean Callanan fbfd7ba547 Removed a stray dump() that made it into top-of-tree.
llvm-svn: 119890
2010-11-20 02:23:49 +00:00
Sean Callanan a3aa0cf6e6 Made GetVariableValue() more robust in the face
of failures in the AST importer.  Also ensured
that a variable will not be blindly added if
GetVariableValue() returns an error.

llvm-svn: 119889
2010-11-20 02:19:29 +00:00
Sean Callanan 80eee3a989 Removed a stray dump().
llvm-svn: 119888
2010-11-20 02:06:01 +00:00
Jason Molenda 2d107dd02b Change the DWARFExpression::Evaluate methods to take an optional
RegisterContext* - normally this is retrieved from the ExecutionContext's
StackFrame but when we need to evaluate an expression while creating
the stack frame list this can be a little tricky.

Add DW_OP_deref_size, needed for the _sigtramp FDE expression.

Add support for processing DWARF expressions in RegisterContextLLDB.

Update callers to DWARFExpression::Evaluate.

llvm-svn: 119885
2010-11-20 01:28:30 +00:00
Greg Clayton cd55b1957e Revert the End of file stuff that was added as it was causing read threads
to hang around and take a ton of CPU time. Caroline will fix this when she
gets back from vacation.

llvm-svn: 119877
2010-11-20 00:17:57 +00:00
Greg Clayton a651b537d6 Updated to latest and greatest clang for a "print cvr-qualifiers on function
declarations" fix.

llvm-svn: 119847
2010-11-19 21:46:54 +00:00
Caroline Tice efed613172 Add the ability to catch and do the right thing with Interrupts (often control-c)
and end-of-file (often control-d).

llvm-svn: 119837
2010-11-19 20:47:54 +00:00
Johnny Chen 601e72c88a Add TestSignedTypes.py to test that variables with signed types display correctly.
llvm-svn: 119836
2010-11-19 20:35:15 +00:00
Sean Callanan 6abfabff61 Modifications to type handling logic. We no longer
perform recursive type lookups, because these are not
required for full type fidelity.  We also make the
SelectorTable last for the full lifetime of the Clang
compiler; this was the source of many bugs.

llvm-svn: 119835
2010-11-19 20:20:02 +00:00
Johnny Chen beae523a20 Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).
Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.

llvm-svn: 119811
2010-11-19 18:07:14 +00:00
Greg Clayton 35f1a0d58d Print out addresses with the correct width for 32 bit programs.
llvm-svn: 119786
2010-11-19 04:16:11 +00:00
Greg Clayton dbe5450898 Fixed an issue where the UserSettingsControllers were being created out of
order and this was causing the target, process and thread trees to not be
available.

llvm-svn: 119784
2010-11-19 03:46:01 +00:00
Sean Callanan f7c3e27f62 Added support for indicating to the expression parser
that the result of an expression should be coerced to
a specific type.  Also made breakpoint conditions pass
in the bool type for this type.

The expression parser ignores this indication for now.

llvm-svn: 119779
2010-11-19 02:52:21 +00:00
Greg Clayton 1b95a6ff95 Added some logging back and cleaned up the code to match LLDB's coding
conventions.

llvm-svn: 119771
2010-11-19 01:05:25 +00:00
Johnny Chen 835a88cb15 Add Python API tests for file and class static variables, too.
llvm-svn: 119758
2010-11-18 23:33:43 +00:00