Commit Graph

1561 Commits

Author SHA1 Message Date
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
Greg Clayton 99d0faf27e Cleaned up code that wasn't using the Initialize and Terminate paradigm by
changing it to use it. There was an extra parameter added to the static
accessor global user settings controllers that wasn't needed. A bool was being
used as a parameter to the accessor just so it could be used to clean up 
the global user settings controller which is now fixed by splitting up the
initialization into the "static void Class::Initialize()", access into the
"static UserSettingsControllerSP & Class::GetSettingsController()", and
cleanup into "static void Class::Terminate()".

Also added initialize and terminate calls to the logging code to avoid issues
when LLDB is shutting down. There were cases after the logging was switched
over to use shared pointers where we could crash if the global destructor
chain was being run and it causes the log to be destroyed and any any logging
occurred.

llvm-svn: 119757
2010-11-18 23:32:35 +00:00
Sean Callanan 7a55a32108 Fixed the logic in IRForTarget that recognizes
externally-defined variables to match up with
the code in ClangASTSource that produces them.

llvm-svn: 119750
2010-11-18 22:21:58 +00:00
Johnny Chen 3df7f94fd0 Add a test for displaying file and class static variables.
llvm-svn: 119734
2010-11-18 20:35:54 +00:00
Johnny Chen b4d59f477b Remove whitespace chars.
llvm-svn: 119732
2010-11-18 20:20:18 +00:00
Greg Clayton 4e78f60660 Added the ability to get more information on the SBThread's stop reason
by being able to get the data count and data. Each thread stop reason
has one or more data words that can help describe the stop. To do this
I added:

    size_t
	SBThread::GetStopReasonDataCount();

	uint64_t
	SBThread::GetStopReasonDataAtIndex(uint32_t idx);

llvm-svn: 119720
2010-11-18 18:52:36 +00:00
Greg Clayton ce02552b6a Added missing file.
llvm-svn: 119709
2010-11-18 17:29:15 +00:00
Greg Clayton 3af9ea56d3 Fixed Process::Halt() as it was broken for "process halt" after recent changes
to the DoHalt down in ProcessGDBRemote. I also moved the functionality that
was in ProcessGDBRemote::DoHalt up into Process::Halt so not every class has
to implement a tricky halt/resume on the internal state thread. The 
functionality is the same as it was before with two changes:
- when we eat the event we now just reuse the event we consume when the private
  state thread is paused and set the interrupted bool on the event if needed
- we also properly update the Process::m_public_state with the state of the
  event we consume.
  
Prior to this, if you issued a "process halt" it would eat the event, not 
update the process state, and then produce a new event with the interrupted
bit set and send it. Anyone listening to the event would get the stopped event
with a process that whose state was set to "running".

Fixed debugserver to not have to be spawned with the architecture of the
inferior process. This worked fine for launching processes, but when attaching
to processes by name or pid without a file in lldb, it would fail.

Now debugserver can support multiple architectures for a native debug session
on the current host. This currently means i386 and x86_64 are supported in
the same binary and a x86_64 debugserver can attach to a i386 executable.
This change involved a lot of changes to make sure we dynamically detect the
correct registers for the inferior process.

llvm-svn: 119680
2010-11-18 05:57:03 +00:00
Sean Callanan 19ca5608db Instructions for building LLDB with a debug LLVM
build under Xcode.

llvm-svn: 119679
2010-11-18 03:56:17 +00:00
Sean Callanan 79439e86d1 Updated to the LLVM/Clang of 2010-11-17 at 3:30pm.
llvm-svn: 119677
2010-11-18 02:56:27 +00:00
Jim Ingham 773d981ce2 The thread plan destructors may call Thread virtual methods. That means they have to get cleaned up in the derived class's destructor. Make sure that happens.
llvm-svn: 119675
2010-11-18 02:47:07 +00:00
Sean Callanan afe16a71f7 Added support for constant strings of the form @"this-is-a-string".
They are replaced with calls to the CoreFoundation function 
CFStringCreateWithBytes() by a portion of the IRForTarget pass.

llvm-svn: 119582
2010-11-17 23:00:36 +00:00
Sean Callanan ac6429fc9a Whitespace fix.
llvm-svn: 119581
2010-11-17 23:00:07 +00:00
Jim Ingham 978e071f16 Add a missing newline to the ThreadPlanAssemblyTracer output.
llvm-svn: 119553
2010-11-17 20:40:29 +00:00
Jim Ingham a80ef35902 Add a ThreadPlanAssemblyTracer that takes just a thread (since that's how we call it from ThreadPlanBase...)
llvm-svn: 119549
2010-11-17 20:19:50 +00:00
Jim Ingham 0d8bcc79f4 Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
with the Interrupted bit set.  Process::HandlePrivateEvent ignores Interrupted events.
DoHalt is changed to ensure that the stop even is processed, and an event with
the Interrupted event is posted.  Finally ClangFunction is rationalized to use this
facility so the that Halt is handled more deterministically.

llvm-svn: 119453
2010-11-17 02:32:00 +00:00
Johnny Chen 80e6db9c79 Make the string matching for 'frame variable' more stringent with respect to
output from clang and llvm-gcc compiled program; both generate the correct debug
info with respect to the typedef scoped inside a namespace.

Add a TestBase.getCompiler(self) method which returns the compiler in effect the
test suite is now running with.  Subclasses (like TestNamespace) can use it to
distinguish among different compilers.

llvm-svn: 119445
2010-11-17 00:52:41 +00:00
Johnny Chen ecb072d840 Add an option '-# count' to run the specified test suite for a said number of times.
This is not to be used during normal test suite run, but to be used to stress test
specific test sequences repeatedly.

Example:

./dotest.py -# 3 -v breakpoint_conditions

will repeat the test suite 3 times for tests under the breakpoint_conditions directory.

llvm-svn: 119399
2010-11-16 22:42:58 +00:00
Greg Clayton 47fbf1aecb Use different qualifier enums on the request of a clang engineer.
llvm-svn: 119396
2010-11-16 22:09:25 +00:00
Johnny Chen 43b3bad58b Initial check-in of a Python utility to run the lldb test suite and send the
result including the session logs of test failures/errors as a MIME message.

llvm-svn: 119371
2010-11-16 19:44:50 +00:00
Johnny Chen 7826b0a721 Disambiguate the name lookup for the data type of anon_uint variable.
llvm-svn: 119353
2010-11-16 18:11:55 +00:00
Caroline Tice ef5c6d02f5 Make processes use InputReaders for their input. Move the process
ReadThread stuff into the main Process class (out of the Process Plugins).
This has the (intended) side effect of disabling the command line tool
from reading input/commands while the process is running (the input is
directed to the running process rather than to the command interpreter).

llvm-svn: 119329
2010-11-16 05:07:41 +00:00
Jason Molenda 5920333be1 Add an UnwindPlan Row for the last instruction of a function when
we're using the stack pointer to define the CFA again.  Makes unwinds
while sitting at the 'ret' instruction work, assuming we have accurate
function address bounds.

llvm-svn: 119327
2010-11-16 03:01:20 +00:00
Greg Clayton 7fedea2c6f First attempt and getting "const" C++ method function signatures correct.
It currently isn't working, but it should be close. I will work on this more
when I figure out what I am not doing correctly.

llvm-svn: 119324
2010-11-16 02:10:54 +00:00
Johnny Chen 13e64a7411 Check in a test case for rdar://problem/8668740:
'frame variable' output for namespace variables look wrong

llvm-svn: 119172
2010-11-15 19:10:53 +00:00
Johnny Chen 8ed80e6360 Add radar info for failed expression command test sequences which are now commented out.
llvm-svn: 119171
2010-11-15 18:49:03 +00:00
Johnny Chen 913af510c7 Also add a test for "frame variable '(anonymous namespace)::i'",
plus expression command using fully qualified names.

llvm-svn: 119168
2010-11-15 18:40:06 +00:00
Johnny Chen 6ba9d1f944 Add test sequences for 'frame variable' address-of operator and 'frame variable' fully-qualified name variable.
Also add some comments.

llvm-svn: 119165
2010-11-15 18:27:57 +00:00
Johnny Chen 92dac7ae1b Add test sequence for 'frame variable this' and 'expression this' when stopped
inside a ctor.

llvm-svn: 119162
2010-11-15 18:04:54 +00:00
Johnny Chen deac523f7c Remove the @expectedFailure decorator and uncomment 'expression -- i + j" test,
as both rdar://problem/8659840 and rdar://problem/8660275 have been fixed.

llvm-svn: 119160
2010-11-15 17:42:22 +00:00
Greg Clayton cb7e3b3505 Added quotes around names that are being lookup up or inspected in the
expression logging.

Added some properties to the "objc" test. The expression parser can currently
display properties that are backed by the default functions "expr myStr.string"
will work. But it won't currently work when the property is backed by a 
different function such as "expr myStr.date".

llvm-svn: 119103
2010-11-15 01:47:11 +00:00
Greg Clayton 471da24dfa Added recursive name lookup logging with depth which is commented out and is currently only enabled when we blow the stack.
llvm-svn: 119101
2010-11-15 01:34:18 +00:00
Greg Clayton ce5c9a8f31 Added the address of operator for the "frame variable" command.
llvm-svn: 119100
2010-11-15 01:32:26 +00:00
Greg Clayton 5a2c6d583d Fixed the initWithNSString: function to properly initialize self.
llvm-svn: 119091
2010-11-14 23:12:29 +00:00
Greg Clayton 83c5cd9dfd Just like functions can have a basename and a mangled/demangled name, variable
can too. So now the lldb_private::Variable class has support for this.

Variables now have support for having a basename ("i"), and a mangled name 
("_ZN12_GLOBAL__N_11iE"), and a demangled name ("(anonymous namespace)::i").

Nowwhen searching for a variable by name, users might enter the fully qualified
name, or just the basename. So new test functions were added to the Variable 
and Mangled classes as:

	bool NameMatches (const ConstString &name);
	bool NameMatches (const RegularExpression &regex);

I also modified "ClangExpressionDeclMap::FindVariableInScope" to also search
for global variables that are not in the current file scope by first starting
with the current module, then moving on to all modules.

Fixed an issue in the DWARF parser that could cause a varaible to get parsed
more than once. Now, once we have parsed a VariableSP for a DIE, we cache
the result even if a variable wasn't made so we don't do any re-parsing. Some
DW_TAG_variable DIEs don't have locations, or are missing vital info that 
stops a debugger from being able to display anything for it, we parse a NULL
variable shared pointer for these DIEs so we don't keep trying to reparse it.

llvm-svn: 119085
2010-11-14 22:13:40 +00:00
Greg Clayton 32d2a48369 Fixed an issue where we were trying to resolve lldb_private::Type encoding
types to their full definitions more than we needed to. This caused an assertion
in the DWARF parser to fire -- which is an indication that we are parsing too much.

llvm-svn: 119020
2010-11-14 01:03:55 +00:00
Greg Clayton d7e054694e Fixed a crasher (an assert was firing in the DWARF parser) when setting
breakpoints on inlined functions by name. This involved fixing the DWARF parser
to correctly back up and parse the concrete function when we find inlined
functions by name, then grabbing any appropriate inlined blocks and returning
symbol contexts with the block filled in. After this was fixed, the breakpoint
by name resolver needed to correctly deal with symbol contexts that had the
inlined block filled in in the symbol contexts.

llvm-svn: 119017
2010-11-14 00:22:48 +00:00
Greg Clayton ba2d22d8ee Fixed an issue where we might not find global variables by name when we have
a debug map with DWARF in the .o files due to the attemted shortcut that was
being taken where the global variables were being searched for by looking in
the symbol table. The problem with the symbols in the symbol table is we don't
break apart the symbol names for symbols when they are mangled into basename
and the fully mangled name since this would take a lot of CPU time to chop up
the mangled names and try and find the basenames. The DWARF info typically has
this broken up for us where the basename of the variable is in a the DW_AT_name
attribute, and the mangled name is in the DW_AT_MIPS_linkage_name attribute.
Now we correctly find globals by searching all OSO's for the information so we
can take advantage of this split information. 

llvm-svn: 119012
2010-11-13 22:57:37 +00:00
Greg Clayton 580c5dacd0 Got namespace lookup working and was able to print a complex "this" as an
expression. This currently takes waaaayyyyy too much time to evaluate. We will
need to look at the expression parser and find ways to optimize the info we
provide and get this to evaluate quicker. I believe the performance issue is
currently related to us always providing a complete C++ class type when asked
about a C++ class which can cause a lot of information to be pulled since all
classes will be fully created (methods, base classes, members, all their 
types). We will need to give the classes back the parser and mark them as 
having external sources and get parser (Sema) to query us when it needs more
info. This should bring things up to an acceptable level.

llvm-svn: 118979
2010-11-13 04:18:24 +00:00
Greg Clayton 526e5afb2d Modified the lldb_private::Type clang type resolving code to handle three
cases when getting the clang type:
- need only a forward declaration
- need a clang type that can be used for layout (members and args/return types)
- need a full clang type

This allows us to partially parse the clang types and be as lazy as possible.
The first case is when we just need to declare a type and we will complete it
later. The forward declaration happens only for class/union/structs and enums.
The layout type allows us to resolve the full clang type _except_ if we have
any modifiers on a pointer or reference (both R and L value). In this case
when we are adding members or function args or return types, we only need to
know how the type will be laid out and we can defer completing the pointee
type until we later need it. The last type means we need a full definition for
the clang type.

Did some renaming of some enumerations to get rid of the old "DC" prefix (which
stands for DebugCore which is no longer around).

Modified the clang namespace support to be almost ready to be fed to the
expression parser. I made a new ClangNamespaceDecl class that can carry around
the AST and the namespace decl so we can copy it into the expression AST. I
modified the symbol vendor and symbol file plug-ins to use this new class.

llvm-svn: 118976
2010-11-13 03:52:47 +00:00
Johnny Chen 27e50be528 Implement TODO's of using expression command to set vaiables and to verify that
they are displayed correctly.

llvm-svn: 118930
2010-11-12 21:50:28 +00:00
Jason Molenda cabd1b71c7 I'm not thrilled with how I structured this but RegisterContextLLDB
needs to use the current pc and current offset in two ways:  To 
determine which function we are currently executing, and the decide
how much of that function has executed so far.  For the former use,
we need to back up the saved pc value by one byte if we're going to
use the correct function's unwind information -- we may be executing
a CALL instruction at the end of a function and the following instruction
belongs to a new function, or we may be looking at unwind information
which only covers the call instruction and not the subsequent instruction.

But when we're talking about deciding which row of an UnwindPlan to
execute, we want to use the actual byte offset in the function, not the
byte offset - 1.

Right now RegisterContextLLDB is tracking both the "real" offset and
an "offset minus one" and different parts of the class have to know 
which one to use and they need to be updated/set in tandem.  I want
to revisit this at some point.

The second change made in looking up eh_frame information; it was
formerly done by looking for the start address of the function we
are currently executing.  But it is possible to have unwind information
for a function which only covers a small section of the function's
address range.  In which case looking up by the start pc value may not
find the eh_frame FDE.

The hand-written _sigtramp() unwind info on Mac OS X, which covers
exactly one instruction in the middle of the function, happens to
trigger both of these issues.

I still need to get the UnwindPlan runner to handle arbitrary dwarf
expressions in the FDE but there's a good chance it will be easy to
reuse the DWARFExpression class to do this.

llvm-svn: 118882
2010-11-12 05:23:10 +00:00
Sean Callanan 8c9e538384 Added a thread plan tracer that prints lines of
assembly as well as registers that changed.

llvm-svn: 118879
2010-11-12 03:22:21 +00:00
Greg Clayton 0dd2c6277a Fixed more thread suspend/resume issues.
llvm-svn: 118877
2010-11-12 02:37:39 +00:00
Jim Ingham 929937286b Added OnStart and OnEnd methods to the tracer.
llvm-svn: 118876
2010-11-12 02:30:38 +00:00
Sean Callanan c126acc1a9 Temporary extension of the timeout for Objective-C
object diagnostic expressions while we work on the
logic for handling the timeout.

llvm-svn: 118873
2010-11-12 01:49:03 +00:00
Sean Callanan 6f86aa630f Removed redundant code for object introspection.
llvm-svn: 118872
2010-11-12 01:41:35 +00:00
Sean Callanan 36695cdecd Excised a version of the low-level function calling
logic that supported calling functions with arbitrary
arguments.  We use ClangFunction for this, and the
low-level logic is only required to support one or two
pointer arguments.

llvm-svn: 118871
2010-11-12 01:37:02 +00:00
Johnny Chen 6df2cd3fbf Add information for two bugs exposed by this test file.
llvm-svn: 118869
2010-11-12 01:00:56 +00:00
Johnny Chen 99ff489086 Run commands 'expression self->str' and 'expression self->date'.
They should not fail.

llvm-svn: 118868
2010-11-12 00:55:31 +00:00
Johnny Chen 064d7f5e4e Fix the @expectedFailure usage error and add a commented out section of code to
exercise 'expression' command on namespaced variables.

llvm-svn: 118867
2010-11-12 00:50:45 +00:00
Greg Clayton 1b946bf636 Fixed an issue with the MachThread class where we might not get the initial
thread basic info state and not realize that a thread was already suspended
or if a thread was starting up and not ready to be displayed to the user
(in an uninterruptable state). If it is not user ready yet, we don't add it
to our list of threads that can be played with.

llvm-svn: 118866
2010-11-12 00:49:23 +00:00
Johnny Chen 1e57493196 Add @expectedFailure decorator for test_with_dwarf_and_run_command() test method:
rdar://problem/8659840
    test failure: ./dotest.py -v -t -f NamespaceTestCase.test_with_dwarf_and_run_command

llvm-svn: 118861
2010-11-12 00:00:15 +00:00
Johnny Chen 285371e32a The session log entry containing the command to rerun the same test now also includes
the architecture and compiler specs.

llvm-svn: 118860
2010-11-11 23:54:12 +00:00
Johnny Chen 3d57ee7b43 Add TestNamespace.py to exercise printing of anonymous and named namespace variables.
llvm-svn: 118856
2010-11-11 23:29:54 +00:00
Johnny Chen 667429d6b1 Simplify Makefile.
llvm-svn: 118851
2010-11-11 22:58:37 +00:00
Johnny Chen 5f98696f51 Add help message for the scenario of using lldb.py module distributed by Xcode4
to invoke the test driver.

llvm-svn: 118847
2010-11-11 22:14:56 +00:00
Johnny Chen cdab9f1933 Make clang happy.
llvm-svn: 118839
2010-11-11 21:22:12 +00:00
Johnny Chen c043de11e8 Fixed compilation warnings emitted by clang.
Plus make finding the break line number in main.cpp more robust.

llvm-svn: 118832
2010-11-11 20:18:36 +00:00
Greg Clayton c3b849970d Fixed an issue with Function::GetPrologueByteSize() where if a function's first line table entry didn't have the same address as the start address of the function itself, we could end up returning and incorrect value.
llvm-svn: 118830
2010-11-11 20:13:30 +00:00
Jim Ingham 06e827cc43 Add ThreadPlanTracer class to allow instruction step tracing of execution.
Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean.

llvm-svn: 118824
2010-11-11 19:26:09 +00:00
Johnny Chen 07f06c4e96 Added a simple test for:
rdar://problem/8651752
    don't crash trying to ask clang how many children an empty record has

llvm-svn: 118820
2010-11-11 19:15:04 +00:00
Greg Clayton 6ed689bfcb Bumped Xcode versions to lldb-32 and debugserver-119.
llvm-svn: 118772
2010-11-11 02:22:58 +00:00
Greg Clayton a63012e9bf Fixed an issue where we might not be able to track down a real definition of
a forward declaration to a struct and hangle it gracefully (don't crash
trying to ask clang how many children an empty record has).

llvm-svn: 118770
2010-11-11 02:14:53 +00:00
Greg Clayton 62742b1402 Disable the debug logging I accidentally left enabled.
llvm-svn: 118758
2010-11-11 01:09:45 +00:00
Johnny Chen 5d6c464f46 Some rewordings of the assert messages for process stopped due to breakpoint.
llvm-svn: 118739
2010-11-10 23:46:38 +00:00
Greg Clayton 96d7d7453c Added initial support to the lldb_private::SymbolFile for finding
namespaces by name given an optional symbol context. I might end up
dressing up the "clang::NamespaceDecl" into a lldb_private::Namespace
class if we need to do more than is currenlty required of namespaces.
Currently we only need to be able to lookup a namespace by name when
parsing expressions, so I kept it simple for now. The idea here is
even though we are passing around a "clang::NamespaceDecl *", that
we always have it be an opaque pointer (it is forward declared inside
of "lldb/Core/ClangForward.h") and we only use clang::NamespaceDecl
implementations inside of ClangASTContext, or ClangASTType when we need
to extract information from the namespace decl object.

llvm-svn: 118737
2010-11-10 23:42:09 +00:00
Johnny Chen 378ed7f3e7 Slight changes to how to phrase the assert for Python API thread.GetStopReason().
llvm-svn: 118731
2010-11-10 23:14:41 +00:00
Johnny Chen e9ad7fecf0 Finish adding the actual stop reason as part of the assert message when asserting:
thread.GetStopReason() == lldb.eStopReasonBreakpoint

llvm-svn: 118713
2010-11-10 20:30:37 +00:00
Johnny Chen de0338bac9 Add the actual stop reason to an assert message for bitfields_variable_python()
test method when asserting:

    thread.GetStopReason() == lldb.eStopReasonBreakpoint

llvm-svn: 118711
2010-11-10 20:20:06 +00:00
Benjamin Kramer 2c88643a22 Silence a bunch of clang warnings.
llvm-svn: 118710
2010-11-10 20:16:47 +00:00
Greg Clayton cf7e9a0485 Don't keep appending to the current crash description with each formatted crash description call.
llvm-svn: 118703
2010-11-10 19:43:40 +00:00
Caroline Tice 5c2816d903 Move the embedded Python interpreter onto a separate thread, to prevent
main thread from having to wait on it (which was causing some I/O 
hangs).

llvm-svn: 118700
2010-11-10 19:18:14 +00:00
Johnny Chen fec456da47 Trivial fix for an error message.
llvm-svn: 118697
2010-11-10 19:02:11 +00:00
Johnny Chen b1a06f3fff Remove @skip decorator:
@unittest2.skip("rdar://problem/8648070 'expression *bar_ptr' seg faults")

It has been fixed by r118672.

llvm-svn: 118695
2010-11-10 18:25:18 +00:00
Jim Ingham 08feef8861 Remove an obsolete reference to immediate plans.
llvm-svn: 118691
2010-11-10 18:17:03 +00:00
Greg Clayton 2d95dc9b22 Modified lldb_private::SymboleFile to be able to override where its TypeList
comes from by using a virtual function to provide it from the Module's
SymbolVendor by default. This allows the DWARF parser, when being used to
parse DWARF in .o files with a parent DWARF + debug map parser, to get its
type list from the DWARF + debug map parser so when we go and find full 
definitions for types (that might come from other .o files), we can use the
type list from the debug map parser. Otherwise we ended up mixing clang types
from one .o file (say a const pointer to a forward declaration "class A") with
the a full type from another .o file. This causes expression parsing, when 
copying the clang types from those parsed by the DWARF parser into the 
expression AST, to fail -- for good reason. Now all types are created in the
same list.

Also added host support for crash description strings that can be set before
doing a piece of work. On MacOSX, this ties in with CrashReporter support
that allows a string to be dispalyed when the app crashes and allows 
LLDB.framework to print a description string in the crash log. Right now this
is hookup up the the CommandInterpreter::HandleCommand() where each command
notes that it is about to be executed, so if we crash while trying to do this
command, we should be able to see the command that caused LLDB to exit. For
all other platforms, this is a nop.

llvm-svn: 118672
2010-11-10 04:57:04 +00:00
Sean Callanan b1620224e6 Fixed a bug where the LLVM disassembler was
ignoring the show_address parameter.

llvm-svn: 118666
2010-11-10 01:38:28 +00:00
Johnny Chen cc78b0b67f Add more comments on LLDBTestResult class.
llvm-svn: 118655
2010-11-09 23:56:14 +00:00
Greg Clayton 7a34528d68 Did a lot of code cleanup.
Fixed the DWARF plug-in such that when it gets all attributes for a DIE, that
it omits the DW_AT_sibling and DW_AT_declaration when getting attributes
from a DW_AT_abstract_origin or DW_AT_specification DIE.

llvm-svn: 118654
2010-11-09 23:46:37 +00:00
Johnny Chen bb4f8e6f7b Rephrase the output message about session information; make it both "session logs".
llvm-svn: 118650
2010-11-09 23:42:00 +00:00
Johnny Chen 07569be70c When dumping the session log for a failed/errored test, also emit the command to
invoke the test driver to rerun the very same test.  Example output:

/Volumes/data/lldb/svn/trunk/test $ tail 2010-11-09-14_51_34/ExpectedFailure-TestSettings.SettingsCommandTestCase.test_set_output_path.log 

Traceback (most recent call last):
  File "/Volumes/data/lldb/svn/trunk/test/settings/TestSettings.py", line 136, in test_set_output_path
    "'stdout.txt' exists due to target.process.output-path.")
AssertionError: False is not True : 'stdout.txt' exists due to target.process.output-path.


To rerun this test, issue the following command from the 'test' directory:

./dotest.py -v -t -f SettingsCommandTestCase.test_set_output_path

llvm-svn: 118646
2010-11-09 22:56:12 +00:00
Sean Callanan 0617fcb1f1 Added a named container for the source QualType
in the type copy routine to make type problems
easier to debug.

llvm-svn: 118638
2010-11-09 22:37:10 +00:00
Johnny Chen 021d0e3173 Remove the @skip decorator for the whole class:
@unittest2.skip("rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults")

and add a @skip decorator for test_with_dwarf_and_run_command() method:

    @unittest2.skip("rdar://problem/8648070 'expression *bar_ptr' seg faults")

llvm-svn: 118632
2010-11-09 21:14:23 +00:00
Johnny Chen 94ce9711c1 We should make the class name of test cases which emphasize expression command
be different than the class name which uses frame variable command.

llvm-svn: 118602
2010-11-09 18:49:57 +00:00
Johnny Chen c0c67f275d Distinguish between the assert messages for runCmd and expect. The former now
takes the form:

    "Command '%s' returns successfully" % str

and the latter takes the form:

    "'%s' returns expected result" % str
    or
    "'%s' matches expected result" % str

llvm-svn: 118599
2010-11-09 18:42:22 +00:00
Johnny Chen 27eb0bf281 Move the persistent_variables directory under expression_command directory.
llvm-svn: 118591
2010-11-09 17:57:37 +00:00
Johnny Chen 22c3f3028d Add a test for expression parser crash which has been fixed.
llvm-svn: 118590
2010-11-09 17:51:11 +00:00
Johnny Chen 98d9c79e7d Make the specification of relative directory more robust.
llvm-svn: 118511
2010-11-09 17:09:20 +00:00
Greg Clayton 1ac093b9ea Bumped versions in Xcode projects to lldb-31 and debugserver-118.
llvm-svn: 118489
2010-11-09 04:43:39 +00:00
Greg Clayton c615ce4964 Fixed an issue in the DWARF parser that was causing forward declarations
to not get resolved.

Fixed the "void **isa_ptr" variable inside the objective C verifier to start
with a '$' character so we don't go looking for it in our program.

Moved the lookup for "$__lldb_class" into the part that knows we are looking
for internal types that start with a '$'.

llvm-svn: 118488
2010-11-09 04:42:43 +00:00
Jason Molenda b4f65501fc Implement RegisterContext::WriteRegisterBytes in RegisterContextLLDB.
I only did a tiny bit of testing; in the one case I tried changing the
contents of a radar in the middle of a stack and it was still current in
the live register context so it filtered down to frame 0 and was handed
over to the live register set RegisterContext.  I need to test a case
where a register is saved on the stack in memory before I check this
one off.

llvm-svn: 118486
2010-11-09 04:31:16 +00:00
Jason Molenda 8fed295cee Refactor UnwindLLDB so it doesn't populate the entire stack unless
the frame count is requested or each frame is individually requested.

In practice this doesn't seem to help anything because we have
functions like StackFrameList::GetNumFrames() which is going to
request each frame anyway.  And classes like ThreadPlanStepRange
and ThreadPlanStepOverRange get the stack depth in their ctor forcing
a full stack walk.  But at least UnwindLLDB will delay doing a full
walk if it can.

llvm-svn: 118477
2010-11-09 02:31:21 +00:00
Jason Molenda 45b4924550 Fix thinko in UnwindTable.cpp where it wouldn't provde a
FuncUnwinders object if the eh_frame section was missing
from an objfile.  Worked fine on x86_64 but on i386 where
eh_frame is unusual, that resulted in the arch default 
UnwindPlan being used all the time instead of picking up
an assembly profile based unwindplan.

llvm-svn: 118467
2010-11-09 01:21:22 +00:00
Johnny Chen 31f29e98bf Add keyboard shortcuts:
'run'          => Control-C r (gud-run)            "Run the program."
'process kill' => Control-C s (gud-stop-subjoball) "Stop the program."

llvm-svn: 118460
2010-11-09 00:24:51 +00:00
Johnny Chen 99adaf4cc1 Minor comment fix.
llvm-svn: 118450
2010-11-08 22:08:21 +00:00
Johnny Chen 27f391be61 Better wording of the help text for the '-f testclass.testmethod' option usage.
llvm-svn: 118438
2010-11-08 20:17:04 +00:00
Johnny Chen c06f422d73 Let's also emit the informational message for where to find the session logs for
failed/errored tests at the start of the test run, in case the test run crashes
for any reason.  That way, it is easy to locate the session logs for accumulated
failures/errors.

llvm-svn: 118427
2010-11-08 19:03:37 +00:00
Johnny Chen 2ddfebd9af Skipped due to rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults.
llvm-svn: 118415
2010-11-08 16:53:27 +00:00
Greg Clayton a78ff2ef32 Cleaned up the pseudo terminal code in ProcessGDBRemote as it was spawning
a pseudo terminal even when the process being attached to. 

Fixed a possible crasher in the in:

    bool
    ClangASTContext::IsAggregateType (clang_type_t clang_type);
    
It seems that if you pass in a record decl, enum decl, or objc class decl
and ask it if it is an aggregate type, clang will crash. 

llvm-svn: 118404
2010-11-08 04:29:11 +00:00
Sean Callanan ece9649264 Added more logging so we see the register state
when a function starts and ends, and also the 
disassembly for anything that is a client of
ClangExpressionParser after it has been JIT
compiled.

llvm-svn: 118401
2010-11-08 03:49:50 +00:00
Greg Clayton 21184644af Fixed an issue where if you try and run something in a TTY that isn't
the same architecture as a default program, the attach architecture auto
detection would change the architecture to the architecture of the darwin-debug
(which was always x86_64) and hose up your debug session.

llvm-svn: 118399
2010-11-08 03:06:10 +00:00
Greg Clayton 40328bf5f3 Fixed some type parsing that was causing types to thing they were forward
declarations when they should have been.

llvm-svn: 118393
2010-11-08 02:05:08 +00:00
Johnny Chen fa491601b5 Change the test driver so that simply specifying '-f testclass.testmethod' means that
we want to run just the instance of testclass-testmethod combination and nothing else.

Specifying '-g' now will admit the whole .py test module if it does not contain a matching
testclass-testmethod combination at all.

This option arrangement adheres to the RISC principle of making the common cases fast. :-)

rdar://problem/8584914 Can the default for dotest.py's "-g" flag be switched?

llvm-svn: 118392
2010-11-08 01:21:03 +00:00
Sean Callanan a4e55178bc Made variable resolution more robust by handling
every external variable reference in the module,
and returning a clean error (instead of letting
LLVM issue a fatal error) if the variable could
not be resolved.

llvm-svn: 118388
2010-11-08 00:31:32 +00:00
Greg Clayton 7481c20f09 Fixed FileSpec's operator == to deal with equivalent paths such as "/tmp/a.c"
and "/private/tmp/a.c". This was done by adding a "mutable bool m_is_resolved;"
member to FileSpec and then modifying the equal operator to check if the
filenames are equal, and if they are, then check the directories. If they are
not equal, then both paths are checked to see if they have been resolved. If
they have been resolved, we resolve the paths in temporary FileSpec objects
and set each of the m_is_resolved bools to try (for lhs and rhs) if the paths
match what is contained in the path. This allows us to do more intelligent
compares without having to resolve all paths found in the debug info (which
can quickly get costly if the files are on remote NFS mounts).

llvm-svn: 118387
2010-11-08 00:28:40 +00:00
Greg Clayton 2ccf8cfc4b Modified the DWARF parser for both the single DWARF file and for the case
where the DWARF is in the .o files so they can track down the actual type for
a forward declaration. This was working before for just DWARF files, but not
for DWARF in .o files where the actual definition was in another .o file.

Modified the main thread name in the driver to be more consistent with the
other LLDB thread names.

llvm-svn: 118383
2010-11-07 21:02:03 +00:00
Greg Clayton 2d4edfbc6a Modified all logging calls to hand out shared pointers to make sure we
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.

llvm-svn: 118319
2010-11-06 01:53:30 +00:00
Greg Clayton c52df286ea Howard Hinnant gave us changes for lldb_private::SharingPtr that gives us the ability have a single allocation contain both the class and the ref count without having to do intrusive pointer type stuff. They will intermingle correctly with other shared pointers as well. In order to take advantage of this you need to create your pointer in your class with the make_shared function:
lldb_private::SharingPtr<A> p = llvm::make_shared<A>(i, j);

Currently up to five constructor arguments are supported and each must be an LValue.

llvm-svn: 118317
2010-11-06 00:12:48 +00:00
Sean Callanan c70f8ff417 Fixed a bug where variables in the source operands
of store statements were not being marked for
resolution.

llvm-svn: 118316
2010-11-06 00:09:34 +00:00
Johnny Chen f7f9d9d880 Make the type of session log part of the filename itself. It allows for easier
identification of the test failures/errors by human beings as well as automatic
processings.

The prefix which identifies the type can be: Error, Failure, or ExpectedFailure.

llvm-svn: 118315
2010-11-06 00:07:07 +00:00
Greg Clayton efabb123af Added copy constructors and assignment operators to all lldb::SB* classes
so we don't end up with weak exports with some compilers.

llvm-svn: 118312
2010-11-05 23:17:00 +00:00
Caroline Tice 5e254d37a6 If debugserver is running on the local machine, pass it a
pseudoterminal to pass to the inferior for the inferior's I/O
(to allow direct writing, rather than passing all the I/O around
via packets).

llvm-svn: 118308
2010-11-05 22:37:44 +00:00
Johnny Chen 76c381b6f5 Fix the infinite recursion crash reported by Antoine Missout:
rdar://problem/8557095 lldb disas crashed (from lldb developer)

llvm-svn: 118299
2010-11-05 21:43:19 +00:00
Jim Ingham 399f1cafa6 Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.
llvm-svn: 118290
2010-11-05 19:25:48 +00:00
Johnny Chen a29c14e40d Fix comments.
llvm-svn: 118285
2010-11-05 18:10:11 +00:00
Jim Ingham e4caae4f48 Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118284
2010-11-05 17:59:46 +00:00
Jim Ingham d403f26bbe Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118283
2010-11-05 17:59:33 +00:00
Jim Ingham 3cbb931504 Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118282
2010-11-05 17:59:19 +00:00
Johnny Chen 9a6706bca4 Add comment about iterating over possible architecture and compiler combinations.
llvm-svn: 118279
2010-11-05 17:30:53 +00:00
Johnny Chen 2f53b943e4 Make lldb dump fullpath instead of just basename when printing out frame or
thread descriptions.  This allows for correctly finding and obeying the last
filename-and-line marker from the debugger.

Add a delay for gud-up and gud-down.  This makes tracking filename-and-line
more reliable when moving up/down the stack.

llvm-svn: 118277
2010-11-05 16:51:44 +00:00
Sean Callanan 2a39652303 Fixed error handling when the utility functions
that check pointer validity fail to parse.  Now
lldb does not crash in that case.  Also added
support for checking Objective-C class validity
in the Version 1 runtime as well as Version 2
runtimes with varying levels of available debug
support.

llvm-svn: 118271
2010-11-05 00:57:06 +00:00
Jim Ingham 5822173bc8 Handle stepping through ObjC vtable trampoline code.
llvm-svn: 118270
2010-11-05 00:18:21 +00:00
Jim Ingham f7f4f50113 Added a setting to "log timer" so you can see the incremental timings as well:
log timer increment true/false

llvm-svn: 118268
2010-11-04 23:19:21 +00:00
Jim Ingham 302448352c Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118267
2010-11-04 23:08:45 +00:00
Jim Ingham 932725fa11 Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118266
2010-11-04 23:08:26 +00:00
Johnny Chen c1fa8c5644 Remove the @skip decorators for assertion aborts. Jim fixed them in r118255.
llvm-svn: 118265
2010-11-04 22:49:00 +00:00
Jason Molenda 744aa8a14d Use the new native unwinder by default.
llvm-svn: 118264
2010-11-04 22:29:24 +00:00
Jim Ingham 2a5e0f03fb Add a ObjC V1 runtime, and a generic AppleObjCRuntime plugin.
Also move the Checker creation into the Apple Runtime code.

llvm-svn: 118255
2010-11-04 18:30:59 +00:00
Johnny Chen 9b70bd4169 Add one @skip decorator for assertion abort:
@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.")

llvm-svn: 118252
2010-11-04 17:37:20 +00:00
Johnny Chen 0fcb0365e0 Add two @skip decorators for assertion abort:
@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.")

llvm-svn: 118251
2010-11-04 17:26:50 +00:00
Jason Molenda 504d3f51ff Revert last checkin to DisassemblerLLVM.cpp; that was some temporary
debug printfs that got left behind by accident.

llvm-svn: 118244
2010-11-04 09:53:38 +00:00
Jason Molenda c311c23402 Add #ifdef to easily switch between the current libunwind-remote based unwinder
or the native unwinder (UnwindLLDB).  I'll make the native unwinder the default
once I check in with everyone tomorrow.

llvm-svn: 118243
2010-11-04 09:51:29 +00:00
Jason Molenda 311eb2deec Revert last checking to ThreadGDBRemote.cpp; I accidentally checked
that in along with some cleanup work with the native unwinder code.

llvm-svn: 118242
2010-11-04 09:46:43 +00:00
Jason Molenda dae97b4a29 Revert last checking to CommandObjectDisassemble.cpp; that was
some diagnostic test code I was using while debugging the 
native unwinder and didn't mean to check in.

llvm-svn: 118241
2010-11-04 09:43:27 +00:00
Jason Molenda fa19c3e7d6 Built the native unwinder with all the warnings c++-4.2 could muster;
fixed them.  Added DISALLOW_COPY_AND_ASSIGN to classes that should
not be bitwise copied.  Added default initializers for member
variables that weren't being initialized in the ctor.  Fixed a few
shadowed local variable mistakes.

llvm-svn: 118240
2010-11-04 09:40:56 +00:00
Greg Clayton 923cf1c32e Removed the hardcoding of the system compiler to gcc 4.2
llvm-svn: 118231
2010-11-04 02:01:34 +00:00
Greg Clayton 61fba2935b Bumped version for lldb-29 and debugserver-116 in the Xcode projects.
llvm-svn: 118229
2010-11-04 01:56:14 +00:00
Greg Clayton 8f343b09e9 Added support for loading and unloading shared libraries. This was done by
adding support into lldb_private::Process:

    virtual uint32_t
    lldb_private::Process::LoadImage (const FileSpec &image_spec, 
                                      Error &error);

    virtual Error
    lldb_private::Process::UnloadImage (uint32_t image_token);

There is a default implementation that should work for both linux and MacOSX.
This ability has also been exported through the SBProcess API:

    uint32_t
    lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec, 
                                lldb::SBError &error);

    lldb::SBError
    lldb::SBProcess::UnloadImage (uint32_t image_token);

Modified the DynamicLoader plug-in interface to require it to be able to 
tell us if it is currently possible to load/unload a shared library:

    virtual lldb_private::Error
    DynamicLoader::CanLoadImage () = 0;

This way the dynamic loader plug-ins are allows to veto whether we can 
currently load a shared library since the dynamic loader might know if it is
currenlty loading/unloading shared libraries. It might also know about the
current host system and know where to check to make sure runtime or malloc
locks are currently being held.

Modified the expression parser to have ClangUserExpression::Evaluate() be
the one that causes the dynamic checkers to be loaded instead of other code
that shouldn't have to worry about it.

llvm-svn: 118227
2010-11-04 01:54:29 +00:00
Sean Callanan 10af7c430a Re-enabled LLDB's pointer checkers, and moved the
implementation of the Objective-C object checkers
into the Objective-C language runtime.

llvm-svn: 118226
2010-11-04 01:51:38 +00:00
Jason Molenda 5976200d43 Handle the case where no eh_frame section is present.
RegisterContextLLDB holds a reference to the SymbolContext
in the vector of Cursors that UnwindLLDB maintains.  Switch
UnwindLLDB to hold a vector of shared pointers of Cursors
so this reference doesn't become invalid.

Correctly falling back from the "fast" UnwindPlan to the
"full" UnwindPlan when additional registers need to be
retrieved.

llvm-svn: 118218
2010-11-04 00:53:20 +00:00
Sean Callanan f211510ff6 Factored the code that implements breakpoints on
exceptions for different languages out of 
ThreadPlanCallFunction and put it into the 
appropriate language runtimes.

llvm-svn: 118200
2010-11-03 22:19:38 +00:00
Johnny Chen fb53d5069d Fix an incorrect comment in main.c and TestConditionalBreak.py.
It should be c's parent frame being a instead of the other way around.

llvm-svn: 118198
2010-11-03 22:00:28 +00:00
Johnny Chen 87bb589c4d Add a test for Python API SBValue.GetValueType() inside TestArrayTypes.py for a
local variable and an argument variable.

Add ValueTypeString() utility function into lldbutil.py which converts the enum
into a human readable string.

Modify TestBase.DebugSBValue() to also dump the value type of an SBValue object.

llvm-svn: 118197
2010-11-03 21:37:58 +00:00
Johnny Chen a67d2981b9 Fix comment about eValueTypeConstResult.
llvm-svn: 118196
2010-11-03 21:10:38 +00:00