Commit Graph

5152 Commits

Author SHA1 Message Date
Johnny Chen 8f198c96fd Add a '-R' option, which is similar to '-r', except that the relocated directory, if exists, will be removed entirely
before running the test suite.  A usage example looks like this:

test $ ./dotest.py -A x86_64 -R /tmp/x86_64 &
test $ ./dotest.py -A i386 -R /tmp/i386 &

where we would want to run the x86_64 and i386 archs concurrently but relocate the test suite to different directory
hierarchies in order not to stump on each other's intermediate files.

llvm-svn: 155491
2012-04-24 21:44:10 +00:00
Greg Clayton a8022fa70d <rdar://problem/11291668>
Fixed an issue that would happen when using debug map with DWARF in the .o files where we wouldn't ever track down the actual definition for a type when things were in namespaces. We now serialize the decl context information into an intermediate format which allows us to track down the correct definition for a type regardless of which DWARF symbol file it comes from. We do this by creating a "DWARFDeclContext" object that contains the DW_TAG + name for each item in a decl context which we can then use to veto potential accelerator table matches. For example, the accelerator tables store the basename of the type, so if you have "std::vector<int>", we would end up with an accelerator table entry for the type that contained "vector<int>", which we would then search for using a DWARFDeclContext object that contained:

  [0] DW_TAG_class_type "vector<int>"
  [1] DW_TAG_namespace "std"

This is currently used to track down forward declarations for things like "class a:🅱️:Foo;". 

llvm-svn: 155488
2012-04-24 21:22:41 +00:00
Sean Callanan 4538aa25bd Fixed a crasher that occurs when an expression
doesn't return a result.  If that expression can't
be run in the current context (for example, if it
uses a function and there is no running process)
then we used to try to destroy the nonexistent
result variable.  We now only destroy the result
variable if we actually made one.

llvm-svn: 155455
2012-04-24 17:56:40 +00:00
Greg Clayton 1eac0c729f Added support for the LC_ENCRYPTION_INFO load command.
llvm-svn: 155423
2012-04-24 03:06:13 +00:00
Jim Ingham a503881635 Report the command error when we are in "stop on error mode."
llvm-svn: 155422
2012-04-24 02:25:07 +00:00
Jason Molenda 0a287e0356 A small fix for ObjectFileMachO::ParseSymtab() where a pointer
into the middle of a vector was being used after the vector may
have been resized.  
<rdar://problem/11284937>

llvm-svn: 155421
2012-04-24 02:09:58 +00:00
Enrico Granata fe945e83e0 Fixing the test case so that it runs correctly on i386 as well as on x86_64
llvm-svn: 155420
2012-04-24 02:01:17 +00:00
Enrico Granata f1dfbad036 Removing the @expectedFailurei386 decorator from test cases that now work as a result of the latest changes to Value.cpp
llvm-svn: 155419
2012-04-24 01:45:19 +00:00
Enrico Granata b046e0320c This patch fixes a bug where LLDB was incorrectly setting the address-size on a DataExtractor to be sizeof(void*) when the ValueObject came out of the expression parser
This worked correctly for 64-bit targets, but broke down data formatters in i386 mode. The formatters would try to read pointers out of the frozen-dried objects,
but were unable to do so because they would try fetching 8 bytes from a DataExtractor with only 4 bytes in it. This patch fixes the issue by always making the pointer-size
for a DataExtractor match the target setting.

llvm-svn: 155418
2012-04-24 01:23:23 +00:00
Jim Ingham 927f09ca0e Pass *this in explicitly to save the FileSpec copy construction.
llvm-svn: 155407
2012-04-23 23:22:24 +00:00
Greg Clayton d61c0fc049 Added the ability to log a message with a backtrace when verbose logging is enabled to the Module class. Used this new function in the DWARF parser.
llvm-svn: 155404
2012-04-23 22:55:20 +00:00
Greg Clayton 2dafd8ed4b <rdar://problem/11282938>
Fixed an issue where we get NULL compile units back from the symbol vendor. We need symbol vendors to be able to quickly give an estimate of the compile units that they have without having to fully vette them first, so anyone getting compile units from a module should be able to deal with a NULL compile unit being returned for a given index.

llvm-svn: 155398
2012-04-23 22:00:21 +00:00
Greg Clayton b210aec64d Added the ability to specify the symbol file for a module when adding it to a target.
llvm-svn: 155384
2012-04-23 20:23:39 +00:00
Johnny Chen 7debd16c95 Test file renaming.
llvm-svn: 155369
2012-04-23 17:54:40 +00:00
Sean Callanan 1ef77434e3 Implemented zext as a no-op cast in the IR
interpreter.

llvm-svn: 155360
2012-04-23 17:25:38 +00:00
Jason Molenda 0c72f85690 Bump version to lldb-143.
llvm-svn: 155272
2012-04-21 02:10:22 +00:00
Johnny Chen 910667004f Remove the expectedFailure decorator as the bug has been fixed.
llvm-svn: 155264
2012-04-21 01:02:50 +00:00
Greg Clayton b403a15ded Added code to automatically load the libheap.dylib when ptr_refs, cstr_refs or malloc_info are called. If MallocStackLogging is enabled, then you can now use --stack to dump the backtrace of the code that allocated each malloc block.
llvm-svn: 155262
2012-04-21 00:11:26 +00:00
Johnny Chen 34d3a38a9c Method name change to avoid further conflicts when merging from ToT to branches/lldb-platform-work.
llvm-svn: 155260
2012-04-20 23:59:21 +00:00
Greg Clayton f99295c3a6 Fixed some issues with symbolicating things. Fixed symbolication.add_module() to not use the resolved_path before we have tried to locate it. Fixed crashlog.locate_module_and_debug_symbols() to return true and false correctly.
llvm-svn: 155255
2012-04-20 23:31:27 +00:00
Jim Ingham 6d66ce67d7 Make sure the "synchronous breakpoint callbacks" get called before the thread plan logic gets invoked, and if they
ask to continue that should short-circuit the thread plans for that thread.  Also add a bit more explanation for
how this machinery is supposed to work.  
Also pass eExecutionPolicyOnlyWhenNeeded, not eExecutionPolicyAlways when evaluating the expression for breakpoint
conditions.

llvm-svn: 155236
2012-04-20 21:16:56 +00:00
Greg Clayton 9bbddbf84a Added logging so we can see when we are trying to complete a forward type and pull in the world. This is due to a compiler bug we are tracking (<rdar://problem/11291658>) where forward decls to classes and types are not properly scoped in namespaces, which results in the current LLDB looking for a type it will find many times in the accelerator tables, but never match. For example, when debugging with clang we get a forward decl like:
class AnalysisResolver;

And we will look for it everywhere and find many many matches, but the decl context of those matching DIEs is "clang::AnalysisResolver", so we never match anything, yet we pull in waaayyy too much DWARF in the process.

To enable this logging enable the "lookups" category in the "dwarf" log channel:

(lldb) log enable dwarf lookups

llvm-svn: 155233
2012-04-20 20:35:47 +00:00
Greg Clayton 3e10cf3b51 Don't put the address of the module in the module basename as this hoses up our ability to find shared libraries by name. We now put it into the Module object name.
llvm-svn: 155223
2012-04-20 19:50:20 +00:00
Greg Clayton 3f24d36160 <rdar://problem/11259893>
Fixed an issue where iOS debugging would trust the first file it found in the SDK regardless of the UUID not matching. Now we actually get smart and can find modules in ANY of the installed SDKs and remember which SDK is our fallback SDK.

llvm-svn: 155184
2012-04-20 02:02:02 +00:00
Jim Ingham 28209d55fd Missed one place where the assert should have been in a #ifdef. Thanks Jason.
llvm-svn: 155175
2012-04-20 00:08:56 +00:00
Johnny Chen 6acfb690b5 Tests decorated with @benchmarks_test do not participate in the remote-macosx test suite run.
But, still, tearDown() should call super.tearDown(), not super.setUp(). :-)

llvm-svn: 155170
2012-04-19 23:50:00 +00:00
Johnny Chen c9cb71a0b3 LLDB test suite should also output the config info string along with the stack trace.
rdar://problem/11283401

Example:

Collected 1 test

1: test_with_dwarf (TestCallStdStringFunction.ExprCommandCallFunctionTestCase)
   Test calling std::String member function. ... FAIL

======================================================================
FAIL: test_with_dwarf (TestCallStdStringFunction.ExprCommandCallFunctionTestCase)
   Test calling std::String member function.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/data/lldb/svn/ToT/test/lldbtest.py", line 427, in wrapper
    return func(self, *args, **kwargs)
  File "/Volumes/data/lldb/svn/ToT/test/expression_command/call-function/TestCallStdStringFunction.py", line 34, in test_with_dwarf
    self.call_function()
  File "/Volumes/data/lldb/svn/ToT/test/expression_command/call-function/TestCallStdStringFunction.py", line 48, in call_function
    substrs = ['Hello world'])
  File "/Volumes/data/lldb/svn/ToT/test/lldbtest.py", line 1235, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : 'Hello world' returns expected result
Config=i386-clang
----------------------------------------------------------------------
Ran 1 test in 1.148s

FAILED (failures=1)

llvm-svn: 155157
2012-04-19 21:33:55 +00:00
Johnny Chen 39b8c3567a Simplify the progress bar display when neither "-v" nor "-t" is passed to the test driver.
llvm-svn: 155152
2012-04-19 20:09:44 +00:00
Sean Callanan 82b6f48331 Updated LLVM to take a variety of ARM
disassembler fixes.  The ARM disassembler is
now crash-free on all opcodes.

llvm-svn: 155149
2012-04-19 20:00:54 +00:00
Johnny Chen 92f162a798 The session file name should be tagged with (architecture, compiler) in addition
to the already existing (test result, test id) to avoid collision and to
facilitate postmortem analysis.

llvm-svn: 155148
2012-04-19 19:39:11 +00:00
Johnny Chen 4fdc339db5 Not a test failure for i386; instead, the test case should be modified to not over-expect type fields for the synthetic childs.
rdar://problem/11277013

llvm-svn: 155144
2012-04-19 18:36:11 +00:00
Jim Ingham c1c19a6f02 In debug mode, assert when we fail to get the sequence mutex. We need to remove as many places where this can happen as possible.
llvm-svn: 155138
2012-04-19 16:57:50 +00:00
Jason Molenda 7c3e6f3134 bump version to lldb-142.
llvm-svn: 155093
2012-04-19 02:02:12 +00:00
Jim Ingham 3b8285d90d Switch to setting the write side of the run lock when we call Resume. Then make a PrivateResume that doesn't switch the run-lock state, and use that where we are resuming without changing the public resume state.
llvm-svn: 155092
2012-04-19 01:40:33 +00:00
Johnny Chen 61f305cdb8 Add expected failure decorators for test cases which are failing for i386 architecture.
Plus fix some test cases to skip/succeed for i386.

llvm-svn: 155087
2012-04-19 01:07:54 +00:00
Jim Ingham fd29c36fbf Add a WriteTryLock function.
llvm-svn: 155080
2012-04-19 00:19:47 +00:00
Jim Ingham e1471230e2 The plan stack should never be used while empty. GetCurrentPlan is the entry point to contol logic
for the plan stack, so assert here if it gets called with an empty plan stack.
<rdar://problem/11265974>

llvm-svn: 155078
2012-04-19 00:17:05 +00:00
Jim Ingham 1f628f4e8f We take the API mutex first and the stop mutex second in general, so do it here as well.
llvm-svn: 155077
2012-04-19 00:14:53 +00:00
Greg Clayton af54653c32 Make sure EmulateInstructionARM doesn't have to have "armv4", "armv6", "armv7" as the exact architecture name, the arch name can just start with any of these strings. We need to be able to recognize different variants that might come along and not fail to backtrace completely (which happens when we aren't able to find an architecture that matches) when we don't have exact matches.
llvm-svn: 155045
2012-04-18 21:16:06 +00:00
Greg Clayton 26b47e24fe Added an iOS local debugging optimization when reading the __LINKEDIT section data for files in the dyld shared cache.
llvm-svn: 154984
2012-04-18 05:19:20 +00:00
Greg Clayton bade1fb874 Find and allows users to use the cached SDK's that might be in "~/Library/Developer/Xcode/iOS DeviceSupport".
Also enabled PlatformRemoteiOS to select an SDK using the build number in case you have mutliple 5.0 SDKs installed:

(lldb) platform select remote-ios --build 11C123

llvm-svn: 154978
2012-04-18 02:08:08 +00:00
Jason Molenda edfb0dcf0c Bump to lldb-141.
llvm-svn: 154975
2012-04-18 01:35:37 +00:00
Jason Molenda 9cf296d177 Add armv7s to recognized cpu type for arm instruction emulation.
llvm-svn: 154974
2012-04-18 01:28:49 +00:00
Sean Callanan ad880767fc We now record metadata for Objective-C interfaces,
Objective-C methods, and Objective-C properties.

llvm-svn: 154972
2012-04-18 01:06:17 +00:00
Greg Clayton d38e55e815 Update the way SDK directories are found so we are not reliant on the old "Latest" symlinks in the DeviceSupport directory.
llvm-svn: 154966
2012-04-18 00:06:56 +00:00
Greg Clayton ac7a3db067 Make sure an error is returned when Process::LoadImage() fails.
llvm-svn: 154965
2012-04-18 00:05:19 +00:00
Sean Callanan d9804fbd01 When an AST import fails, provide the metadata
for the original Decl, for debugging purposes.

llvm-svn: 154957
2012-04-17 22:30:04 +00:00
Jason Molenda 7bfc33077e Bump to lldb-140.
llvm-svn: 154887
2012-04-17 00:59:15 +00:00
Sean Callanan 0765c82694 Disabled spell checking in the expression parser,
which incurs large overheads in terms of type
parsing and importing.

llvm-svn: 154885
2012-04-17 00:49:48 +00:00
Greg Clayton 1e8ac36b60 Fixed the ability to load multiple __LINKEDIT segments at the same address for darwin shared cache entries. Now when registering the load address of a section, the DynamicLoader objects can specify if they should warn or not. This will fix the ability to load the nlist entries for shared libraries in the darwin shared caches when no on disk representation is available for a shared library.
llvm-svn: 154860
2012-04-16 21:01:30 +00:00
Johnny Chen 44d2497138 Add the capability of supplying the pre/post-flight functions to the test suite such that
the pre-flight code gets executed during setUp() after the debugger instance is available
and the post-flight code gets executed during tearDown() after the debugger instance has
done killing the inferior and deleting all the target programs.

Example:

[11:32:48] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-pre-post-flight  functionalities/watchpoint/hello_watchpoint
config: {'pre_flight': <function pre_flight at 0x1098541b8>, 'post_flight': <function post_flight at 0x109854230>}
LLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
LLDB-139
Path: /Volumes/data/lldb/svn/ToT
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 154753
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 154730
Last Changed Date: 2012-04-13 18:42:46 -0700 (Fri, 13 Apr 2012)


lldb.pre_flight: def pre_flight(test):
    __import__("lldb")
    __import__("lldbtest")
    print "\nRunning pre-flight function:"
    print "for test case:", test

lldb.post_flight: def post_flight(test):
    __import__("lldb")
    __import__("lldbtest")
    print "\nRunning post-flight function:"
    print "for test case:", test


Session logs for test failures/errors/unexpected successes will go into directory '2012-04-16-11_34_08'
Command invoked: python ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-pre-post-flight functionalities/watchpoint/hello_watchpoint
compilers=['clang']

Configuration: arch=x86_64 compiler=clang
----------------------------------------------------------------------
Collected 2 tests

1: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... 
Running pre-flight function:
for test case: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)

Running post-flight function:
for test case: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
ok
2: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... 
Running pre-flight function:
for test case: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)

Running post-flight function:
for test case: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
ok

----------------------------------------------------------------------
Ran 2 tests in 1.584s

OK

llvm-svn: 154847
2012-04-16 18:55:15 +00:00
Greg Clayton d1cf11a74d Added a new host function that allows us to run shell command and get the output from them along with the status and signal:
Error
Host::RunShellCommand (const char *command,
                       const char *working_dir,
                       int *status_ptr,
                       int *signo_ptr,
                       std::string *command_output_ptr,
                       uint32_t timeout_sec);

This will allow us to use this functionality in the host lldb_private::Platform, and also use it in our lldb-platform binary. It leverages the existing code in Host::LaunchProcess and ProcessLaunchInfo.

llvm-svn: 154730
2012-04-14 01:42:46 +00:00
Sean Callanan f5c87882a0 Added a --lldb option to override the location
of LLDB.framework.

llvm-svn: 154728
2012-04-14 01:06:06 +00:00
Sean Callanan 2a7d20405d Made sure that the collections of mutexes used in
checking for LLDB mutex validity are static so
that entries put in there actually persist between
calls to error_check_mutex.

llvm-svn: 154727
2012-04-14 01:05:29 +00:00
Johnny Chen 7b9f93a186 Patch from Viktor Kutuzov <vkutuzov@accesssoftek.com>:
Hello everyone,
 
please find the attached patch for TOT and lldb-platform-work branch, which provides the following changes:
 - fixed a crash in the ProcessPOSIX constructor when an executable module object is not yet created.
 - added support for the multi instanciated FreeBSD platform objects (the local host and remote as example).
 - enabled the remote gdb plugin on FreeBSD.

llvm-svn: 154724
2012-04-14 00:54:42 +00:00
Sean Callanan 0fcd749a51 Updated LLVM to take a variety of fixes to
disassembler problems:

- r153766, fixing a crash disassembling vmov
- r154628, fixing relative branches
- r154459, fixing a crash disassembling vld
- r154544, fixing a crash disassembling vst

llvm-svn: 154722
2012-04-14 00:08:14 +00:00
Jim Ingham d846f1f2b1 The API lock was getting dropped too soon in GetVariables. GetValueObjectForFrameVariable could run the target (to get dynamic values) and that requires the target lock.
llvm-svn: 154711
2012-04-13 23:29:44 +00:00
Jim Ingham 99ff2c42f6 In debug mode, assert if we haven't initialized a mutex we thought we'd initialized.
llvm-svn: 154710
2012-04-13 23:28:33 +00:00
Jim Ingham 87d0e61839 Don't do the work in DoTakedown if the thread plan isn't valid.
Also fixed up some logging.

llvm-svn: 154709
2012-04-13 23:11:52 +00:00
Jim Ingham e39f85c774 The run all threads timeout in RunThreadPlan should respect the user timeout, not be arbitrarily 10 seconds (which was too long anyway...)
Also added some logging to RunThreadPlan and made others more regular.

llvm-svn: 154708
2012-04-13 23:09:49 +00:00
Greg Clayton d451c1a843 Added the thread ID (tid) to each packet history item and the packet history now always dumps to a lldb_private::Stream.
Enable logging the packet history when registers fail to read due to not getting the sequence mutex if "--verbose" is enabled on the log channel for the "gdb-remote" log category.

This will help us track down some issues.

llvm-svn: 154704
2012-04-13 21:24:18 +00:00
Johnny Chen 9a27713a74 First step to make the test suite runnable for remote platforms.
For the types directory, we were running lldbtest.system() to execute the compiled program
on the test host to collect golden output in order to compare with the output of various
lldb debugger commands as performed later.  This won't work for the remote platform
scenario where the architecture of the target and host platforms are different.

Modify the AbstractBase class to use lldb to launch the inferior while specifying the
output file, from which the golden output is collected and grokked.  How to bootstrap and
to connect to the remote platform is still being worked at.

llvm-svn: 154699
2012-04-13 20:40:52 +00:00
Jim Ingham 0092c8eb2f Factor out a bunch of common code in the two ThreadPlanCallFunction constructors. Also add a sanity check - try reading the frame, and if we fail bag out.
llvm-svn: 154698
2012-04-13 20:38:13 +00:00
Greg Clayton de0e9d04ad <rdar://problem/11193466>
Fixed an error where lldb would hang when writing memory near the end of the addres space due to an unsigned overflow.

llvm-svn: 154697
2012-04-13 20:37:20 +00:00
Jim Ingham cbbdaa9378 Couple more places in SBValue where you need to take the run-lock.
llvm-svn: 154683
2012-04-13 18:30:20 +00:00
Jim Ingham 718583ff23 ThreadPlanCallFunction's destructor wasn't calling DoTakedown, so if the that plan got discarded we weren't doing the takedown.
llvm-svn: 154681
2012-04-13 18:27:58 +00:00
Greg Clayton d84bb48582 Added a --memory option to allow dumping the matching malloc block memory with a default format that makes sense, or that format can be overridden with the --format option.
llvm-svn: 154671
2012-04-13 16:24:09 +00:00
Greg Clayton f958f348c8 <rdar://problem/11241798>
The less locks there are, the better. I removed the thread ID mutex and now just shared the m_thread_list's mutex to make sure we don't deadlock due to lock inversion.

llvm-svn: 154652
2012-04-13 02:11:32 +00:00
Jason Molenda 5a9f9d3241 version bump to lldb-139.
llvm-svn: 154650
2012-04-13 02:00:58 +00:00
Sean Callanan 84790aedb1 Updated llvm.zip to include a fix for a leak in
the MC disassembler.

llvm-svn: 154649
2012-04-13 01:46:44 +00:00
Johnny Chen 18104239b4 Ditto 'requires modern objc runtime' for TestRealDefinition.py -- fix test suite errors for i386.
llvm-svn: 154638
2012-04-13 00:23:26 +00:00
Greg Clayton ce7d345a57 Added more complete error checking for mutexes only for "Debug" builds where we always check if a mutex is valid prior to doing stuff with it. We also track when mutexes are initialized and destroyed and keep these in sets that can very subsequent pthread_mutex_XXX API calls.
llvm-svn: 154637
2012-04-13 00:21:53 +00:00
Johnny Chen 97ccf9f3b2 Ditto 'requires modern objc runtime' for TestObjCProperty.py -- fix test suite errors for i386.
llvm-svn: 154636
2012-04-13 00:18:17 +00:00
Johnny Chen 45872c01ff Fix some test suite errors. TestForwardDecl.py errors were due to bad Makefile.rules, while TestHiddenIvars.py errors due to features only available in modern objc runtime.
llvm-svn: 154635
2012-04-13 00:13:35 +00:00
Sean Callanan 60217120b5 Added a mechanism for keeping track of where in
the debug information individual Decls came from.

We've had a metadata infrastructure for a while,
which was intended to solve a problem we've since
dealt with in a different way.  (It was meant to
keep track of which definition of an Objective-C
class was the "true" definition, but we now find
it by searching the symbols for the class symbol.)
The metadata is attached to the ExternalASTSource,
which means it has a one-to-one correspondence with
AST contexts.

I've repurposed the metadata infrastructure to
hold the object file and DIE offset for the DWARF
information corresponding to a Decl.  There are
methods in ClangASTContext that get and set this
metadata, and the ClangASTImporter is capable of
tracking down the metadata for Decls that have been
copied out of the debug information into the
parser's AST context without using any additional
memory.

To see the metadata, you just have to enable the
expression log:
-
(lldb) log enable lldb expr
-
and watch the import messages.  The high 32 bits
of the metadata indicate the index of the object
file in its containing DWARFDebugMap; I have also
added a log which you can use to track that mapping:
-
(lldb) log enable dwarf map
-

This adds 64 bits per Decl, which in my testing
hasn't turned out to be very much (debugging Clang
produces around 6500 Decls in my tests).  To track
how much data is being consumed, I've also added a
global variable g_TotalSizeOfMetadata which tracks
the total number of Decls that have metadata in all
active AST contexts.

Right now this metadata is enormously useful for
tracking down bugs in the debug info parser.  In the
future I also want to use this information to provide
more intelligent error messages instead of printing
empty source lines wherever Clang refers to the
location where something is defined.

llvm-svn: 154634
2012-04-13 00:10:03 +00:00
Greg Clayton c8e0c244e4 Expose GetAddressClass() from both the SBAddress and SBInstruction so clients can tell the difference between ARM/Thumb opcodes when disassembling ARM.
llvm-svn: 154633
2012-04-13 00:07:34 +00:00
Sean Callanan 02eee4d4f7 Fixed a problem where LLDB inserted regular C
FunctionDecls into classes if it looked up a
method in a different DWARF context than the
one where it found the parent class's definition.

The symptom of this was, for a method A::B(),

1) LLDB finds A in context 1, creating a
   CXXRecordDecl for A and marking it as needing
   completion

2) LLDB looks up B in context 2, finds that its
   parent A already has a CXXRecordDecl, but can't
   find a CXXMethodDecl for B

3) Not finding a CXXMethodDecl for B, LLDB doesn't
   set the flag indicating that B was resolved

4) Because the flag wasn't set, LLDB's fallthrough
   code creates a FunctionDecl for B and sticks it
   in the DeclContext -- in this case, A.

5) Clang crashes on finding a FunctionDecl inside a
   CXXRecordDecl.

llvm-svn: 154627
2012-04-12 23:10:00 +00:00
Greg Clayton 1bcb26c672 Fixed some expression issues after switching to void * args.
llvm-svn: 154615
2012-04-12 21:06:22 +00:00
Greg Clayton af2589ea09 Fixed an issue that happens in LLDB versions after SBFrame switched to using a lldb::ExecutionContextRefSP where we might segfault due to using a shared pointer with NULL in it. The SBFrame object should always have a valid lldb::ExecutionContextRefSP in it. The SBFrame::Clear() method was doing the wrong thing and is now fixed.
llvm-svn: 154614
2012-04-12 20:58:26 +00:00
Greg Clayton c3c0b0e59a Remove the GetSequenceMutex timeout that isn't being used in the GDB remote plug-in.
Also fixed the ProcessLinux, ProcessPOSIX and ProcessFreeBSD to have the correct UpdateThreadList() prototype.

llvm-svn: 154603
2012-04-12 19:04:34 +00:00
Greg Clayton 7767716d0f A few tweaks done to the heap.py in me free time where we now have:
(lldb) command script import heap.py

Find all malloc blocks that contains a pointer value of 0x1234000:
(lldb) ptr_refs 0x1234000

Find all malloc blocks that contain a C string:
(lldb) cstr_refs "hello"

Get info on a malloc block that starts at or contains 0x12340000
(lldb) malloc_info 0x12340000

llvm-svn: 154602
2012-04-12 18:57:36 +00:00
Jim Ingham b1e2e848f3 Make sure that DoResume doesn't stall if we shut down the async thread while DoResume is waiting
for packet confirmation.  
Also added a bit more logging.
Also, unlock the writer end of the run lock in Process.cpp on our way out of the private state
thread so that the Process can shut down cleanly.

<rdar://problem/11228538>

llvm-svn: 154601
2012-04-12 18:49:31 +00:00
Jim Ingham 5b7a845a0a Cleanup, keep private types separate from private member variables.
llvm-svn: 154600
2012-04-12 18:25:11 +00:00
Sean Callanan 6f3e5ad704 Make sure frozen_sp for a ClangExpressionVariable
is non-NULL before asking for its name.

llvm-svn: 154593
2012-04-12 16:58:26 +00:00
Johnny Chen b127f00b51 Make the default architectures to run as both 64 and 32-bit.
rdar://problem/11031264

llvm-svn: 154573
2012-04-12 00:55:57 +00:00
Sean Callanan 18a11e33ea Fixed a crash in Clang when a superclass of an
Objective-C class doesn't have a definition but
Clang tries to read through its protocols anyway.

llvm-svn: 154538
2012-04-11 21:48:13 +00:00
Greg Clayton d1411e1aa2 Cleaned up code that was getting SBData for an SBInstruction.
llvm-svn: 154535
2012-04-11 21:13:31 +00:00
Greg Clayton 7fb671bac0 Cleaned up the code and we now also dump the dynamic object for the malloc block. Using this on the lldb/test/lang/objc/foundation test we can see this in action:
First we can load the module:

(lldb) command script import /Volumes/work/gclayton/Documents/src/lldb/examples/darwin/heap_find/heap.py
Loading "/Volumes/work/gclayton/Documents/src/lldb/examples/darwin/heap_find/libheap.dylib"...ok
Image 0 loaded.
"heap_ptr_refs" and "heap_cstr_refs" commands have been installed, use the "--help" options on these commands for detailed help.


Lets take a look at the variable "my":

(lldb) fr var *my
(MyString) *my = {
  MyBase = {
    NSObject = {
      isa = MyString
    }
    propertyMovesThings = 0
  }
  str = 0x0000000100301a60
  date = 0x0000000100301e60
  _desc_pauses = NO
}


We can see that this contains an ivar "str" which has a pointer value of "0x0000000100301a60". Lets search the heap for this pointer and see what we find:

(lldb) heap_ptr_refs 0x0000000100301a60
found pointer 0x0000000100301a60: block = 0x103800270, size = 384, offset = 168, type = 'void *'
found pointer 0x0000000100301a60: block = 0x100301cf0, size = 48, offset = 16, type = 'MyString *', ivar = 'str' 
(MyString) *addr = {
  MyBase = {
    NSObject = {
      isa = MyString
    }
    propertyMovesThings = 0
  }
  str = 0x0000000100301a60
  date = 0x0000000100301e60
  _desc_pauses = NO
}
found pointer 0x0000000100301a60: block = 0x100820000, size = 4096, offset = 96, type = (autorelease object pool)
found pointer 0x0000000100301a60: block = 0x100820000, size = 4096, offset = 104, type = (autorelease object pool)


Note that it used dynamic type info to find that it was in "MyString" at offset 16 and it also found the ivar "str"!

We can also look for C string values on the heap. Lets look for "a.out":

(lldb) heap_cstr_refs "a.out"
found cstr a.out: block = 0x10010ce00, size = 96, offset = 85, type = '__NSCFString *'
found cstr a.out: block = 0x100112d90, size = 80, offset = 68, type = 'void *'
found cstr a.out: block = 0x100114490, size = 96, offset = 85, type = '__NSCFString *'
found cstr a.out: block = 0x100114530, size = 112, offset = 97, type = '__NSCFString *'
found cstr a.out: block = 0x100114e40, size = 32, offset = 17, type = '__NSCFString *'
found cstr a.out: block = 0x100114fa0, size = 32, offset = 17, type = '__NSCFString *'
found cstr a.out: block = 0x100300780, size = 160, offset = 128, type = '__NSCFData *'
found cstr a.out: block = 0x100301a60, size = 112, offset = 97, type = '__NSCFString *'
found cstr a.out: block = 0x100821000, size = 4096, offset = 100, type = 'void *'

We see we have some objective C classes that contain this, so lets "po" all of the results by adding the --po option:

(lldb)  heap_cstr_refs a.out --po
found cstr a.out: block = 0x10010ce00, size = 96, offset = 85, type = '__NSCFString *'
  (__NSCFString *) 0x10010ce00 /Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out

found cstr a.out: block = 0x100112d90, size = 80, offset = 68, type = 'void *'
found cstr a.out: block = 0x100114490, size = 96, offset = 85, type = '__NSCFString *'
  (__NSCFString *) 0x100114490 /Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out

found cstr a.out: block = 0x100114530, size = 112, offset = 97, type = '__NSCFString *'
  (__NSCFString *) 0x100114530 Hello from '/Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out'

found cstr a.out: block = 0x100114e40, size = 32, offset = 17, type = '__NSCFString *'
  (__NSCFString *) 0x100114e40 a.out.dSYM

found cstr a.out: block = 0x100114fa0, size = 32, offset = 17, type = '__NSCFString *'
  (__NSCFString *) 0x100114fa0 a.out

found cstr a.out: block = 0x100300780, size = 160, offset = 128, type = '__NSCFData *'
  (__NSCFData *) 0x100300780 <48656c6c 6f206672 6f6d2027 2f566f6c 756d6573 2f776f72 6b2f6763 6c617974 6f6e2f44 6f63756d 656e7473 2f737263 2f6c6c64 622f7465 73742f6c 616e672f 6f626a63 2f666f75 6e646174 696f6e2f 612e6f75 742700>

found cstr a.out: block = 0x100301a60, size = 112, offset = 97, type = '__NSCFString *'
  (__NSCFString *) 0x100301a60 Hello from '/Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out'

found cstr a.out: block = 0x100821000, size = 4096, offset = 100, type = 'void *'

llvm-svn: 154519
2012-04-11 18:30:53 +00:00
Greg Clayton 885294808a Get rid of absolute path in "process load" command.
llvm-svn: 154506
2012-04-11 17:04:00 +00:00
Greg Clayton 804de01c33 Added a new "heap.py" module that adds a new command line command that can find values on the heap and print out the dynamic type of the malloc block that contains the data. I will be modifying this a bit more to tweak the output and make the output more useful.
llvm-svn: 154504
2012-04-11 16:27:06 +00:00
Greg Clayton 6a0afeb9c8 Fixed an issue that would cause a crash when dumping fully qualified types.
llvm-svn: 154503
2012-04-11 16:21:20 +00:00
Greg Clayton 851eacb507 Added a property to get the dynamic type which uses the most permissive way to get a dynamic type.
llvm-svn: 154502
2012-04-11 16:20:15 +00:00
Greg Clayton 37a0a24a5f No functionality changes, mostly cleanup.
Cleaned up the Mutex::Locker and the ReadWriteLock classes a bit.

Also cleaned up the GDBRemoteCommunication class to not have so many packet functions. Used the "NoLock" versions of send/receive packet functions when possible for a bit of performance.

llvm-svn: 154458
2012-04-11 00:24:49 +00:00
Jason Molenda 9704e82978 Tweak arm variants list for valid arches settings.
llvm-svn: 154450
2012-04-10 23:08:02 +00:00
Sean Callanan 62ecb9b97b Improved detection of ARM branch instructions to
cover all possible condition codes.

llvm-svn: 154440
2012-04-10 21:51:12 +00:00
Greg Clayton 470dfcbc42 Added more documentation in the header file to explain how to use the results that are found by the function calls to find_pointer_in_heap().
llvm-svn: 154435
2012-04-10 20:59:36 +00:00
Greg Clayton b10973af64 Fixed head_find to compile again.
llvm-svn: 154419
2012-04-10 18:19:20 +00:00
Sean Callanan 6153c518b9 Set variables returned by utility functions to
not consume slots in the persistent variable
store.

llvm-svn: 154416
2012-04-10 18:16:59 +00:00
Greg Clayton 4463399b0d Added a new packet to our GDB remote protocol:
QListThreadsInStopReply
	
This GDB remote query command can enable added a "threads" key/value pair to all stop reply packets so that we always get a list of all threads in each stop reply packet. It increases performance if enabled (the reply to the "QListThreadsInStopReply" is "OK") by saving us from sending to command/reply pairs (the "qfThreadInfo" and "qsThreadInfo" packets), and also helps us keep the current process state up to date. 

llvm-svn: 154380
2012-04-10 03:22:03 +00:00
Greg Clayton 9e92090b3c A general stability fix where we _always_ get the thread list immediately after we get the stop packets. We had some racy conditions where thread 1 might be sending a packet and thread 2 tries to send a packet to get the thread list and it fails and ends up with an empty list. Packets use a sequence mutex to be able to ensure when you send a packet, you get the resonse. This sequence mutex is take when the process is running, and as we exit the running state and notify our process with the stop packet, we now always get the thread ID list before we do anything and before we can run into race conditions.
The next step is to have our stop reply packets send the thread list in the actual stop reply packet to avoid a 2 packet overhead of sending the qfThreadInfo + response and qfThreadInfo + response.

llvm-svn: 154376
2012-04-10 02:25:43 +00:00
Jim Ingham 076b3041c0 Two changes,
1) Start the PrivateStateThread stopped, and then in
StartPrivateStateThread, make the private state thread and then
resume it before we say the thread is created.  That way we know it is
listening for events by the time we get out of
StartPrivateStateThread.

2) Backstop running a thread plan when calling Process::RunThreadPlan
on the private state thread with a ThreadPlanBase so that running the
plan doesn't pass its stop events to whatever plans happen to be above
us on the thread plan stack.

llvm-svn: 154368
2012-04-10 01:21:57 +00:00
Jim Ingham d8ba464b6a Clear the "m_actual_stop_info_sp" in the thread during Destroy. It might be a StopInfoThreadPlan, and that would hold onto members that need to be destroyed while the Full thread is still around.
llvm-svn: 154366
2012-04-10 00:44:25 +00:00
Greg Clayton 9fc13556b4 Trying to solve our disappearing thread issues by making thread list updates safer.
The current ProcessGDBRemote function that updates the threads could end up with an empty list if any other thread had the sequence mutex. We now don't clear the thread list when we can't access it, and we also have changed how lldb_private::Process handles the return code from the:

virtual bool
Process::UpdateThreadList (lldb_private::ThreadList &old_thread_list, 
                       	   lldb_private::ThreadList &new_thread_list) = 0;

A bool is now returned to indicate if the list was actually updated or not and the lldb_private::Process class will only update the stop ID of the validity of the thread list if "true" is returned.

The ProcessGDBRemote also got an extra assertion that will hopefully assert when running debug builds so we can find the source of this issue.

llvm-svn: 154365
2012-04-10 00:18:59 +00:00
Enrico Granata cb50d341aa Fixing a problem where some uninitialized cases of vectors could cause diagnostic output from the synthetic children providers - this time the fix should work
llvm-svn: 154361
2012-04-10 00:11:03 +00:00
Greg Clayton c1422c1d31 Added a packet history object to the GDBRemoteCommunication class that is always remembering the last 512 packets that were sent/received. These packets get dumped if logging gets enabled, or when the new expr lldb::DumpProcessGDBRemotePacketHistory (void *process, const char *log_file_path) global function is called.
llvm-svn: 154354
2012-04-09 22:46:21 +00:00
Greg Clayton 5c61054742 Removed an include that wasn't needed.
llvm-svn: 154353
2012-04-09 22:44:52 +00:00
Greg Clayton 437a135dd2 Fixed an issue that could occur when looking up functions inside of a namespace where if the NamespaceDecl hadn't been parsed yet, we would say a function wasn't in a namespace.
Also improved the logging that happens with "log enable dwarf lookups" is enabled to show when we find matches.

llvm-svn: 154352
2012-04-09 22:43:43 +00:00
Jim Ingham cf274f910e Rework how master plans declare themselves. Also make "PlanIsBasePlan" not rely only on this being the bottom plan in the stack, but allow the plan to declare itself as such.
llvm-svn: 154351
2012-04-09 22:37:39 +00:00
Greg Clayton 0cd7086604 <rdar://problem/11202426>
Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause.

llvm-svn: 154339
2012-04-09 20:22:01 +00:00
Benjamin Kramer c2b5c67df3 Linux/ProcessMonitor: include sys/user.h for user_regs_struct and user_fpregs_struct.
llvm-svn: 154255
2012-04-07 09:13:49 +00:00
Jason Molenda 7a2f433367 Version bump to lldb-138.
llvm-svn: 154252
2012-04-07 06:18:20 +00:00
Jason Molenda b9e88d4186 Fix a integer trauction issue - calculating the current time in
nanoseconds in 32-bit expression would cause pthread_cond_timedwait
to time out immediately.  Add explicit casts to the TimeValue::TimeValue
ctor that takes a struct timeval and change the NanoSecsPerSec etc
constants defined in TimeValue to be uint64_t so any other calculations
involving these should be promoted to 64-bit even when lldb is built
for 32-bit.

<rdar://problem/11204073>, <rdar://problem/11179821>, <rdar://problem/11194705>.

llvm-svn: 154250
2012-04-07 04:55:02 +00:00
Greg Clayton 7b70be3970 Removed redundant isxdigit checks and added the ability to GetHexU8() so it can extract an 8 bit hex value if one is available. It will set EOF if "set_eof_on_fail" is true or if out of data. This allows a string decoder to grab a string without losing the last part of the packet with a packet like "414243,abc" (it can extract "ABC" and leave the file position set to the comma).
llvm-svn: 154239
2012-04-07 00:42:53 +00:00
Sean Callanan bf81ea5a9f Hardened the struct layout code to eliminate a
potential crash if the underlying type couldn't
be completed.

llvm-svn: 154234
2012-04-07 00:06:00 +00:00
Jim Ingham 372787fc19 We sometimes need to be able to call functions (via Process::RunThreadPlan) from code run on the private state thread. To do that we have to
spin up a temporary "private state thread" that will respond to events from the lower level process plugins.  This check-in should work to do
that, but it is still buggy.  However, if you don't call functions on the private state thread, these changes make no difference.

This patch also moves the code in the AppleObjCRuntime step-through-trampoline handler that might call functions (in the case where the debug
server doesn't support the memory allocate/deallocate packet) out to a safe place to do that call.

llvm-svn: 154230
2012-04-07 00:00:41 +00:00
Sean Callanan d13c23c393 Changed some tabs to spaces to make Python like
this file.

llvm-svn: 154222
2012-04-06 23:02:44 +00:00
Sean Callanan 1106434be3 The remaining time calculation didn't reflect the
--start argument.  Fixed that.

llvm-svn: 154221
2012-04-06 23:00:31 +00:00
Johnny Chen 7bba2c6d64 The final batch of adding @dsym_test/@dwarf_test decorators.
llvm-svn: 154211
2012-04-06 21:33:58 +00:00
Sean Callanan afc7b13e56 Removed a call to truncate() which slowed down
the stress test by a LOT.

llvm-svn: 154208
2012-04-06 21:04:20 +00:00
Sean Callanan ceabd2d712 Updated the disassembler stress tester with two
new features:

(1) it outputs the instruction currently being
    tested to a log file, if a path is provided

(2) if instructed, it prints the time remaining
    in the exhaustive test

llvm-svn: 154205
2012-04-06 20:53:23 +00:00
Johnny Chen 24086bc93b Second batch of adding @dsym_test/@dwarf_test decorators to existing test cases.
Plus some minor cleanup of test method names.
Third and final batch is coming.

llvm-svn: 154197
2012-04-06 19:54:10 +00:00
Greg Clayton 780af51505 Fixed ModuleList::FindTypes() so that when a symbol context is supplied that contains a valid module, it will search that module first, then if we are still looking for matches (we have found less that "max_matches"), search in all of the other modules as well.
llvm-svn: 154186
2012-04-06 18:09:43 +00:00
Sean Callanan 2b54db7664 Fixed a leak in the LLVM disassembler where we
did not destroy the underlying disassembler in 
our destructor.

llvm-svn: 154185
2012-04-06 17:59:49 +00:00
Greg Clayton 29399a24c6 In a prior commit, I changed the parameters around on a ModuleList::FindTypes where the old parameters that existing clients were using would have been compatible, so I renamed ModuleList::FindTypes to ModuleList::FindTypes2. Then I made fixes and verified I updated and fixed all client code, but I forgot to rename the function back to ModuleList::FindTypes(). I am doing that now and also cleaning up the C++ dynamic type code a bit.
llvm-svn: 154182
2012-04-06 17:41:13 +00:00
Greg Clayton 55995ebb58 Check if the two clang opaque type pointers are equal before doing anything more exhaustive comparison.
llvm-svn: 154181
2012-04-06 17:38:55 +00:00
Greg Clayton c9858e4d05 Added logging when API calls try to do something that shouldn't be done when the process is stopped by having logging calls that end with "error: process is running".
Also test for the process to be stopped when many SBValue API calls are made to make sure it is safe to evaluate values, children of values and much more.

llvm-svn: 154160
2012-04-06 02:17:47 +00:00
Johnny Chen f1548d4f74 Add a new option to the test driver, -N dsym or -N dwarf, in order to exclude tests decorated with
either @dsym_test or @dwarf_test to be executed during the testsuite run.  There are still lots of
Test*.py files which have not been decorated with the new decorator.

An example:

# From TestMyFirstWatchpoint.py ->
class HelloWatchpointTestCase(TestBase):

    mydir = os.path.join("functionalities", "watchpoint", "hello_watchpoint")

    @dsym_test
    def test_hello_watchpoint_with_dsym_using_watchpoint_set(self):
        """Test a simple sequence of watchpoint creation and watchpoint hit."""
        self.buildDsym(dictionary=self.d)
        self.setTearDownCleanup(dictionary=self.d)
        self.hello_watchpoint()

    @dwarf_test
    def test_hello_watchpoint_with_dwarf_using_watchpoint_set(self):
        """Test a simple sequence of watchpoint creation and watchpoint hit."""
        self.buildDwarf(dictionary=self.d)
        self.setTearDownCleanup(dictionary=self.d)
        self.hello_watchpoint()


# Invocation ->
[17:50:14] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -N dsym -v -p TestMyFirstWatchpoint.py
LLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
LLDB-137
Path: /Volumes/data/lldb/svn/ToT
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 154133
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 154109
Last Changed Date: 2012-04-05 10:43:02 -0700 (Thu, 05 Apr 2012)



Session logs for test failures/errors/unexpected successes will go into directory '2012-04-05-17_50_49'
Command invoked: python ./dotest.py -N dsym -v -p TestMyFirstWatchpoint.py
compilers=['clang']

Configuration: arch=x86_64 compiler=clang
----------------------------------------------------------------------
Collected 2 tests

1: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... skipped 'dsym tests'
2: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... ok

----------------------------------------------------------------------
Ran 2 tests in 1.138s

OK (skipped=1)
Session logs for test failures/errors/unexpected successes can be found in directory '2012-04-05-17_50_49'
[17:50:50] johnny:/Volumes/data/lldb/svn/ToT/test $ 

llvm-svn: 154154
2012-04-06 00:56:05 +00:00
Bill Wendling c80efb418b Add flag to warn about ivar initialization reordering.
llvm-svn: 154153
2012-04-06 00:48:15 +00:00
Bill Wendling 04e7e0ba7a explicitly cast the value.
llvm-svn: 154148
2012-04-06 00:10:46 +00:00
Bill Wendling 7a4b007c65 Order ivar initializers to how they're declared in the class.
llvm-svn: 154147
2012-04-06 00:10:21 +00:00
Bill Wendling e6eeef0164 Order ivar initializers to how they're declared in the class.
llvm-svn: 154146
2012-04-06 00:09:59 +00:00
Bill Wendling 4fe443aa21 Silence unused warning.
llvm-svn: 154145
2012-04-06 00:09:21 +00:00
Sean Callanan d181730aa5 Added a stress-tester for LLDB's disassembler.
Right now it only works on Mac OS X, but other
platforms would just need to add their own
implementation of AddLLDBToSysPathOn*().

The stress-tester has two modes:

Used with --bytes N --random, the stress-tester
generates random instructions of length N and
runs them through the disassembler.  This is
suitable for architectures like Intel where it
is combinatorially infeasible to run through the
entire space of possible instructions.

Used with --bytes N and no arguments (or --start
S --stride T), the stress-tester tests the
disassembler with a monotonically increasing
sequence of instructions.

The --start and --stride arguments are intended
for use in multiprocessing environments.  Give
each core an ID from 0 .. T-1, pass the ID in as
the --start, and use T as the stride, and you
can launch one copy of the stress-tester on each
core you have available.

llvm-svn: 154143
2012-04-06 00:04:36 +00:00
Greg Clayton d84cec07c9 Enable building the POSIX-DYLD dynamic loader plug-in in the Makefile build since it can be used for remote debugging.
llvm-svn: 154109
2012-04-05 17:43:02 +00:00
Bill Wendling e50ab408e5 Revert r154086. It may be needed for Darwin. But the symbols are still missing in the dylib.
llvm-svn: 154108
2012-04-05 17:38:07 +00:00
Greg Clayton 7fdf9ef15d Added a new Host class: ReadWriteLock
This abstracts read/write locks on the current host system. It is currently backed by pthread_rwlock_t objects so it should work on all unix systems.

We also need a way to control multi-threaded access to the process through the public API when it is running. For example it isn't a good idea to try and get stack frames while the process is running. To implement this, the lldb_private::Process class now contains a ReadWriteLock member variable named m_run_lock which is used to control the public process state. The public process state represents the state of the process as the client knows it. The private is used to control the actual current process state. So the public state of the process can be stopped, yet the private state can be running when evaluating an expression for example. 

Adding the read/write lock where readers are clients that want the process to stay stopped, and writers are clients that run the process, allows us to accurately control multi-threaded access to the process.

Switched the SBThread and SBFrame over to us shared pointers to the ExecutionContextRef class instead of making their own class to track this. This fixed an issue with assigning on SBFrame to another and will also centralize the code that tracks weak references to execution context objects into one location.

llvm-svn: 154099
2012-04-05 16:12:35 +00:00
Bill Wendling e914660c0d The DynamicLoaderPOSIXDYLD calls aren't available on Apple systems.
llvm-svn: 154086
2012-04-05 06:21:02 +00:00
Bill Wendling de59fb02b9 Add Security framework to the list of frameworks needed for linking.
llvm-svn: 154085
2012-04-05 06:20:13 +00:00
Sean Callanan a03156fc66 Tolerate decimal points in the LLDB version number.
They are truncated when generating the version
numbers seen in the headers, so for example
lldb-100.1 would have #define LLDB_VERSION=100

llvm-svn: 154074
2012-04-05 01:30:56 +00:00
Sean Callanan a658226ac0 Fixed a problem where we did not read properties
correctly if the setter/getter were not present
in the debug information.  The fixes are as follows:

- We not only look for the method by its full name,
  but also look for automatically-generated methods
  when searching for a selector in an Objective-C
  interface.  This is necessary to find accessors.

- Extract the getter and setter name from the
  DW_TAG_APPLE_Property declaration in the DWARF
  if they are present; generate them if not.

llvm-svn: 154067
2012-04-05 00:12:52 +00:00
Bill Wendling c359aafc55 Order the initializations so that they reflect how they're declared in the class.
llvm-svn: 154055
2012-04-04 21:19:57 +00:00
Greg Clayton 0b88d815e3 <rdar://problem/11184458>
Found an issue where we might still have shared pointer references to lldb_private::Thread objects where the object itself is not valid and has been removed from the Process. When a thread is removed from a process, it will call Thread::DestroyThread() which well set a boolean member variable which is exposed now via:

bool
Thread::IsValid() const;

We then check the thread validity before handing out a shared pointer.

llvm-svn: 154048
2012-04-04 20:43:47 +00:00
Greg Clayton 7e8a601c56 Change SBAddress back to using a std::auto_ptr to a lldb_private::Address as the lldb_private::Address has a weak pointer to the section which has a weak pointer back to the module, so it is safe to have just a lldb_private::Address object now.
llvm-svn: 154045
2012-04-04 20:36:48 +00:00
Greg Clayton b8a54482b3 Use LLDB as the default debugger for launcherXPCService.
llvm-svn: 154043
2012-04-04 20:07:33 +00:00
Greg Clayton 3c18cd3de1 Fixed the C++11 #defines that wrap std::weak_ptr to actually use std::weak_ptr.
llvm-svn: 154041
2012-04-04 20:03:33 +00:00
Enrico Granata f18c03e49e Attempt at fixing a crasher where summary strings where looping endlessly.
llvm-svn: 154028
2012-04-04 17:34:10 +00:00
Enrico Granata 0249fba8c3 Fixing a potential crasher where Python would assume we have no thread state while clearing out an SBDebugger which was acquiring input from the interactive interpreter
llvm-svn: 154027
2012-04-04 17:31:29 +00:00
Enrico Granata 8d4a8010cf Adding a new --python-function (-F) option to breakpoint command add. The option allows the user to specify a Python function name instead of a Python oneliner or interactive script input as a breakpoint command
llvm-svn: 154026
2012-04-04 17:30:31 +00:00
Greg Clayton 3c2c4bb2ce Added a platform agnostic symbolication python module that can be used by any targets. Then modified the darwin "crashlog.py" to use this agnostic info and the new functionality and classes.
llvm-svn: 153969
2012-04-03 21:35:43 +00:00
Bill Wendling d53b5dedb2 Initialize ivars in the correct order.
llvm-svn: 153947
2012-04-03 08:46:13 +00:00
Bill Wendling 9e5bf87516 Possibly too soon for this commit.
llvm-svn: 153946
2012-04-03 08:45:33 +00:00
Bill Wendling 90de801caa Revert accidental checkin.
llvm-svn: 153945
2012-04-03 08:44:00 +00:00
Bill Wendling c08a5e7e8b Possibly too soon for this change.
llvm-svn: 153944
2012-04-03 08:41:55 +00:00
Bill Wendling f0146cb3d3 Use the path to the header file. Use an integer instead of NULL. And get rid of a superfluous 'default' label.
llvm-svn: 153943
2012-04-03 07:51:16 +00:00
Bill Wendling 84ddbc57ee The option is 'NoInlineDefine.'
llvm-svn: 153942
2012-04-03 07:50:37 +00:00
Bill Wendling ed24dcc05f Use integers instead of NULL.
llvm-svn: 153941
2012-04-03 07:50:11 +00:00
Bill Wendling 542f2429f3 Spell 'DW_TAG_APPLE_property' with the correct capitalization.
llvm-svn: 153940
2012-04-03 07:49:34 +00:00
Bill Wendling cac9d9b3f6 Use the correct class/struct keyword so that they match the declarations.
llvm-svn: 153932
2012-04-03 04:15:34 +00:00
Bill Wendling c9851e2630 Initialize ivars in the order they are defined in the class.
llvm-svn: 153931
2012-04-03 04:14:58 +00:00
Bill Wendling 60fd91ff48 Return 0 for the size_t return type.
llvm-svn: 153930
2012-04-03 04:14:31 +00:00
Bill Wendling a0cd2bca6d Use 0 instead of NULL for the integral value.
llvm-svn: 153929
2012-04-03 04:13:41 +00:00
Sean Callanan 38d4df5bcb Fixed ClangASTContext to correctly recognize
wchar_t as distinct from int.

llvm-svn: 153920
2012-04-03 01:10:10 +00:00
Johnny Chen b58337cd45 Add a Test case to make sure that __apple_types section does get produced by dsymutil.
This is supposed to succeed even with rdar://problem/11166975.

llvm-svn: 153919
2012-04-03 01:07:24 +00:00
Johnny Chen 1b8af41116 Add some more debug prints and retrieve the debug subsections from the DWARF section.
llvm-svn: 153915
2012-04-03 00:41:25 +00:00
Enrico Granata 51e318737a One last syntax error fix
llvm-svn: 153911
2012-04-02 23:49:34 +00:00
Enrico Granata a20e863875 Fixing syntax typos in Python formatters
llvm-svn: 153910
2012-04-02 23:43:22 +00:00
Greg Clayton 53eb1c2f03 <rdar://problem/11160171>
Fixed an issue where there were more than one way to get a CompileUnitSP created when using SymbolFileDWARF with SymbolFileDWARFDebugMap. This led to an assertion that would fire under certain conditions. Now there is only one way to create the compile unit and it will "do the right thing".

llvm-svn: 153908
2012-04-02 22:59:12 +00:00
Greg Clayton 675a856e07 Remove unused file as this file is deprecated (use ./crashlog.py instead).
llvm-svn: 153907
2012-04-02 22:57:32 +00:00
Enrico Granata 98bcde4264 Removing some instances of str(SBValue)
llvm-svn: 153899
2012-04-02 21:37:02 +00:00
Greg Clayton 74ae3f5a45 Export the ability to see if a symbol is externally visible and also if the symbol was synthetically added to the symbol table (the symbol was not part of the symbol table itself but came from another section).
llvm-svn: 153893
2012-04-02 20:08:08 +00:00
Johnny Chen d6fbc8ff66 Add testcase that verifies that __apple_types is a valid section in a .o file generated by clang.
rdar://problem/11167268

llvm-svn: 153891
2012-04-02 19:46:14 +00:00
Enrico Granata 247bd419ce Logging for data formatters.
llvm-svn: 153878
2012-04-02 16:39:29 +00:00
Jason Molenda 152694393f Building llvm for multiple arches could cause problems
with some archs, tweak the way we update PATH to fix that.

llvm-svn: 153868
2012-04-02 08:56:42 +00:00
Sean Callanan 139656580f Updating Xcode project version numbers for lldb-137 and debugserver-186
llvm-svn: 153823
2012-04-01 06:36:59 +00:00
Sean Callanan fe630c51ba Updated LLVM to take a comprehensive fix to the
JIT that enables paired relocations in the i386
Mach-O JIT.  This eliminates crashes in the
testsuite when running under i386.

llvm-svn: 153822
2012-04-01 06:35:00 +00:00
Enrico Granata 79c1baf6dd Making sure the count on synthetic providers is always setup - This should prevent errors about count being undefined from showing up
llvm-svn: 153791
2012-03-31 00:15:24 +00:00
Greg Clayton 1517dd33d9 Patch from Viktor Kutuzov: delete the temporary process we created when "process connect" fails.
llvm-svn: 153790
2012-03-31 00:10:30 +00:00
Greg Clayton baf95daa99 Added the ability to log when things get completed in DWARF. This can be enabled using:
(lldb) log enable --verbose lldb completion

This will print out backtraces for all type completion calls which will help us verify that we don't ever complete a type when we don't need to.

llvm-svn: 153787
2012-03-30 23:50:54 +00:00
Greg Clayton 2053398f63 Remove unused code.
llvm-svn: 153786
2012-03-30 23:48:28 +00:00
Greg Clayton aec366f75b Don't log to a temp file and delete it, just use the API that gives us a malloc'ed string array.
llvm-svn: 153785
2012-03-30 23:47:35 +00:00
Greg Clayton c15f55e267 <rdar://problem/11148044>
Fixed a potential crasher that could happen after Debugger::Terminate() was called.

llvm-svn: 153774
2012-03-30 20:53:46 +00:00
Greg Clayton ab950c34d0 Patch from Viktor Kutuzov: fixes a segmentation fault crash in lldb in the ProcessPOSIX class when the object gets destroyed. I can reproduce this problem on the FreeBSD platform and it should be reproducable for the other platforms also.
llvm-svn: 153769
2012-03-30 19:56:32 +00:00
Enrico Granata 7f3296a6e1 Disabling blocks support because of rdar://problem/11024417 - This is hopefully just a temporary countermeasure
llvm-svn: 153758
2012-03-30 16:58:37 +00:00
Enrico Granata 22fe3171ee Added some logging to STL synthetic children providers - this should help us catch problems; more logging might/will be added as needed
llvm-svn: 153750
2012-03-30 16:07:08 +00:00
Sean Callanan 356e17ce69 Be more careful when overriding the type for a
ValueObject, and make sure that ValueObjects that
have null type names (because they have null types)
also have null qualified type names.  This avoids
some potential crashes if 
ValueObject::GetQualifiedTypeName tries to get the
name of their type by calling GetClangTypeImpl().

llvm-svn: 153718
2012-03-30 02:04:38 +00:00
Greg Clayton 219cf31f7d <rdar://problem/11082392>
Fixed an issue that could cause circular type parsing that will assert and kill LLDB.

Prior to this fix the DWARF parser would always create class types and not start their definitions (for both C++ and ObjC classes) until we were asked to complete the class later. When we had cases like:

class A
{
    class B
    {
    };
};

We would alway try to complete A before specifying "A" as the decl context for B. Turns out we can just start the definition and still not complete the class since we can check the TagDecl::isCompleteDefinition() function. This only works for C++ types. This means we will not be pulling in the full definition of parent classes all the time and should help with our memory consumption and also reduce the amount of debug info we have to parse.

I also reduced redundant code that was checking in a lldb::clang_type_t was a possible C++ dynamic type since it was still completing the type, just to see if it was dynamic. This was fixed in another function that was checking for a type being dynamic as an ObjC or a C++ type, but there was dedicated fucntion for C++ that we missed.

llvm-svn: 153713
2012-03-30 00:51:13 +00:00
Enrico Granata a7daeebbff Fixing a whole class of crashers and potential crashers related to data formatters eating up all the stack when an unknown class has to be summarized ; this should make the whole Objective-C summaries more stable
llvm-svn: 153712
2012-03-30 00:51:12 +00:00
Greg Clayton 843d62d14d Added a "add-dsym" alias to "target symbols add" to keep gdb converts happy.
llvm-svn: 153695
2012-03-29 21:47:51 +00:00
Greg Clayton 12b834d626 <rdar://problem/10103468>
Symbol files (dSYM files on darwin) can now be specified during program execution:

(lldb) target symbols add /path/to/symfile/a.out.dSYM/Contents/Resources/DWARF/a.out

This command can be used when you have a debug session in progress and want to add symbols to get better debug info fidelity.

llvm-svn: 153693
2012-03-29 21:43:25 +00:00
Greg Clayton 322654a7f7 <rdar://problem/11149427>
Line tables when using DWARF in .o files can be wrong when two entries get moved around by the compiler. This was due to incorrect logic in the line entry comparison operator.

llvm-svn: 153685
2012-03-29 20:50:37 +00:00
Johnny Chen 55d85f3bab Add log entries for HijackBroadcaster() as well as RestoreBroadcaster().
llvm-svn: 153683
2012-03-29 20:02:33 +00:00
Enrico Granata d50f18b1a0 Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow


synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions

to set the cap to a different value:

(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)

you can optionally disable the loop detection algorithm for lists

(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False

llvm-svn: 153676
2012-03-29 19:29:45 +00:00
Sean Callanan 751aac610a Added support for the DW_AT_APPLE_Property tag
for unbacked properties.  We support two variants:
one in which the getter/setter are provided by
selector ("mySetter:") and one in which the
getter/setter are provided by signature 
("-[MyClass mySetter:]").

llvm-svn: 153675
2012-03-29 19:07:06 +00:00
Greg Clayton 45cffd4943 Missed a file in the last FreeBSD patch.
llvm-svn: 153662
2012-03-29 17:46:49 +00:00
Greg Clayton 59b4fa1813 FreeBSD patch that enabled the lldb-platform to be built from Viktor Kutuzov.
llvm-svn: 153661
2012-03-29 17:46:11 +00:00
Sean Callanan e41438ca8b Updating Xcode project version numbers for lldb-136 and debugserver-185
llvm-svn: 153630
2012-03-29 02:40:34 +00:00
Greg Clayton 2687cd116a <rdar://problem/11052174>
<rdar://problem/11051056>

Found a race condition when sending async packets in the ProcessGDBRemote.

A little background: GDB remote clients can only send one packet at a time. You must send a packet and wait for a response. So when we continue, we obviously can't hold up the calling thread waiting for the process to stop again, so we have an async thread in the ProcessGDBRemote whose only job is to run packets that control the inferior process. When you send a continue packet, the only packet you can send is an interrupt packet (which consists of sending a CTRL+C (or a '\x03' byte)). This then stops the inferior and we can send the async packet, and then resume the target. There was a race condition that often happened during stepping where we are doing a source level single step which consists of many instruction steps and a few runs here and there when we step into a function. So the flow looks like:

inst single step
inst single step
inst single step
inst single step
inst single step
step BP and run
inst single step
inst single step
inst single step

Now if we got an async packet while the program is running we get something like:

send --> continue
send --> interrupt
recv <-- interrupt stop reply packet
send --> async packet
recv <-- async response
send --> continue again and wait for actual stop

Problems arise when this was happening when single stepping a thread where we would get:

send --> step thread 123
send --> interrupt
send --> stop reply for thread 123 (from the step)

Now we _might_ have an extra stop reply packet from the "interrupt" which we weren't checking for and we could end up with:

send --> async packet (like memory read!)
recv <-- async response (which is the interrupt stop reply packet)

Now we have the read memroy reply sitting in our buffer and waiting to be used as the reply for the next packet... 

To further complicate things, the single step should have exited the async thread since the run control is finished, but now it will continue if it was interrupted.

The fixes I checked in to two major things:
- watch for the extra stop reply if we need to
- make sure we exit from the async thread run loop when the previous run control (like the instruction level single step) is finished.

Needless to say this makes very fast stepping in Xcode much more reliable.

llvm-svn: 153629
2012-03-29 01:55:41 +00:00
Greg Clayton 39d0ab3243 <rdar://problem/11035349>
Fixed an issue with stepping where the stack frame list could get changed out from underneath you when multiple threads start accessing frame info.

llvm-svn: 153627
2012-03-29 01:41:38 +00:00
Greg Clayton 6ca75a00dc When running this from the command line, don't pass the python script file itself to be disassembled.
llvm-svn: 153626
2012-03-29 01:40:28 +00:00
Greg Clayton d761d42707 Removed unused variable.
llvm-svn: 153625
2012-03-29 01:39:57 +00:00
Enrico Granata 86ea8d821a Fixing an issue where Unicode characters in an NSString were printed as escape sequences by the summary provider shipping with LLDB - Added relevant test case code. Bonus points for identifying the source of the quotes :-)
llvm-svn: 153624
2012-03-29 01:34:34 +00:00
Enrico Granata 770eb05aa5 Fixing an issue where saying 'po foo' made both the summary and the description for foo come out. If one is po'ing something they most probably only care about the description - We will not omit the summary
llvm-svn: 153608
2012-03-28 22:17:37 +00:00
Greg Clayton 726bc52a2e Converted commented out printf statements for dynamic type logging to use the log for "log enabe lldb types".
llvm-svn: 153583
2012-03-28 17:13:26 +00:00
Greg Clayton 31950a530d Fixed some space formatting.
llvm-svn: 153582
2012-03-28 17:12:37 +00:00
Sean Callanan 2f22999bab Updated LLVM and LLDB to fix compilation errors
with recent Clang.  Clang is now stricter about
presence of complete types and about use of the
"template" keyword in C++ for template-dependent
types.

llvm-svn: 153563
2012-03-28 02:25:40 +00:00
Enrico Granata f981060503 Adding missing file
llvm-svn: 153559
2012-03-28 02:16:50 +00:00
Enrico Granata bf70ee97b1 adding a summary for Objective-C type 'Class'
llvm-svn: 153541
2012-03-27 21:49:20 +00:00
Johnny Chen f216c7df2b Commented out printf's for the time being.
llvm-svn: 153540
2012-03-27 21:38:19 +00:00
Greg Clayton 741f3f9a55 lldb_private::Section objects have a boolean flag that can be set that
indicates that the section is thread specific. Any functions the load a module
given a slide, will currently ignore any sections that are thread specific.

lldb_private::Section now has:

bool
Section::IsThreadSpecific () const
{
    return m_thread_specific;
}

void
Section::SetIsThreadSpecific (bool b)
{
    m_thread_specific = b;
}

The ELF plug-in has been modified to set this for the ".tdata" and the ".tbss"
sections.

Eventually we need to have each lldb_private::Thread subclass be able to 
resolve a thread specific section, but for now they will just not resolve. The
code for that should be trivual to add, but the address resolving functions
will need to be changed to take a "ExecutionContext" object instead of just
a target so that thread specific sections can be resolved.

llvm-svn: 153537
2012-03-27 21:10:07 +00:00
Greg Clayton 47037bc4d7 Fixed a few things in the ELF object file:
1 - sections only get a valid VM size if they have SHF_ALLOC in the section flags
2 - symbol names are marked as mangled if they start with "_Z"

Also fixed the DWARF parser to correctly use the section file size when extracting the DWARF.

llvm-svn: 153496
2012-03-27 02:40:46 +00:00
Enrico Granata c5bc412cf6 Synthetic values are now automatically enabled and active by default. SBValue is set up to always wrap a synthetic value when one is available.
A new setting enable-synthetic-value is provided on the target to disable this behavior.
There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic.
The test suite has been changed accordingly.
Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang
Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching

llvm-svn: 153495
2012-03-27 02:35:13 +00:00
Greg Clayton 84db9105d2 <rdar://problem/11113279>
Fixed type lookups to "do the right thing". Prior to this fix, looking up a type using "foo::bar" would result in a type list that contains all types that had "bar" as a basename unless the symbol file was able to match fully qualified names (which our DWARF parser does not). 

This fix will allow type matches to be made based on the basename and then have the types that don't match filtered out. Types by name can be fully qualified, or partially qualified with the new "bool exact_match" parameter to the Module::FindTypes() method.

This fixes some issue that we discovered with dynamic type resolution as well as improves the overall type lookups in LLDB.

llvm-svn: 153482
2012-03-26 23:03:23 +00:00
Johnny Chen 41b77265e3 If creation of watchpoint failed on the device, make sure the list maintained by the target reflects that by cleaning it up.
llvm-svn: 153477
2012-03-26 22:00:10 +00:00
Sean Callanan 91e1080bcb <rdar://problem/11022964>
Patched LLVM to handle generic i386 relocations.
This avoids some sudden termination problems on
i386 where the JIT would exit() out reporting
"Invalid CPU type!"

llvm-svn: 153467
2012-03-26 20:52:07 +00:00
Eric Christopher 6cc6e60b6e Use GetClangDeclContextForDIE, it'll find the cached one
if it's there and we may not have a cached die yet. This
fixes a bunch of false positives on "die has no decl".

llvm-svn: 153417
2012-03-25 19:37:33 +00:00
Eric Christopher ffe318dbb3 Fix method name for output.
llvm-svn: 153416
2012-03-25 19:30:08 +00:00
Jason Molenda 03c970e2fe Bump version to debugserver-184, lldb-135.
llvm-svn: 153374
2012-03-24 04:05:56 +00:00
Jason Molenda 91fe8072ab Small tweak to list of arches to build debugserver for on arm.
llvm-svn: 153371
2012-03-24 03:51:07 +00:00
Johnny Chen 042537be33 Explicit casts to remove two compile-time warnings.
llvm-svn: 153365
2012-03-24 01:24:13 +00:00
Enrico Granata 86027e954c Adding a new API call IsTypeComplete() to SBType. This call is meant to check if the type has been previously completed or not (which is mostly interesting from a performance point of view)
Adding a test case that checks that we do not complete types before due time. This should help us track cases similar to the cascading data formatters.

llvm-svn: 153363
2012-03-24 01:11:14 +00:00
Sean Callanan 21f395f35e <rdar://problem/11101372>
We now reject binaries built with LTO and print
an error, rather than crashing later while trying
to parse them.

llvm-svn: 153361
2012-03-24 00:43:18 +00:00
Johnny Chen 760c54e640 Fix a typo.
llvm-svn: 153301
2012-03-23 01:28:19 +00:00
Johnny Chen 3f8140a6d8 Make arm debugserver handle setting a watchpoint on, for example, (uint64_t)variable.
We do this by delegating to two available Watchpoint Register Pairs (wvr, wcr).  With
each pair handling the 4 bytes of (uint64_t)variable.

llvm-svn: 153300
2012-03-23 01:24:52 +00:00
Greg Clayton aaaec7cf1f Bumped Xcode project versions for lldb-134 and debugserver-183.
llvm-svn: 153298
2012-03-23 01:04:39 +00:00
Greg Clayton 18eca8a0bd Fixed up the command so that it doesn't dump the first arguments when run from the command line which was causing this script to dump the script itself.
llvm-svn: 153294
2012-03-23 00:01:02 +00:00
Greg Clayton 0f729e9b38 Added python script that implements a "parse_log_file" command in LLDB which can
parse the output from "log enable --timestamp ...." and converts it to be relative
to the first timestamp and shows the time deltas between log lines. This can also
be used as a stand along script outside of lldb:

./delta.py log.txt

llvm-svn: 153288
2012-03-22 23:08:07 +00:00
Greg Clayton e26928c5be <rdar://problem/11095005>
Fixed a performance regression when dynamic types are enable where we would ask a C++ type if it can possibly be dynamic. Previously we would force the type to complete itself and then anwwer the question definitively. Now we ask the type if it is already complete and only definitively answer the question for completed types and just say "yes" for non-complete C++ types. We also always now answer yes for Objective C classes and do not complete those types either.

llvm-svn: 153284
2012-03-22 22:23:17 +00:00
Jason Molenda c4530bfe21 SBTypeCategory::GetName returns const char* so return
NULL instead of false if no valid name (fixes compiler
warning).

llvm-svn: 153282
2012-03-22 21:23:49 +00:00
Sean Callanan 745af46e2f Resolved two problems in the disassembler:
- Addresses with no description were given
   comments, leading to useless comments like 
   "; , "

 - Addresses weren't resolved with respect
   to the correct module.

llvm-svn: 153274
2012-03-22 20:04:23 +00:00
Johnny Chen d45a9c32c2 Previous check-ins allow to hit the arm hardware watchpoint, with a workaound to handle the issue
that the inferior cannot execute past the watchpoint-triggering instruction.

The solution is disable the watchpoint before resuming the inferior and make it hardware single step;
when the inferior stops again due to single step, re-enable the watchpoint and disable the single step
to make the inferior able to continue again without obstacle.

rdar://problem/9667960

llvm-svn: 153273
2012-03-22 20:04:07 +00:00
Enrico Granata 4a3274af96 Removing cascading through inheritance chains for data formatters
This is the feature that allowed the user to have things like:

class Base { ... };
class Derived : public Base { ... };

and have formatters defined for Base work automatically for Derived.

This feature turned out to be too expensive since it requires completing types.

This patch takes care of removing cascading (other than typedefs chain cascading), updating the test suite accordingly, and adding required Cocoa class names to keep the AppKit formatters working

llvm-svn: 153272
2012-03-22 19:55:55 +00:00
Johnny Chen fd4177d9fd Check in main.c modified for testing hardware watchpoints on arm architectures.
llvm-svn: 153268
2012-03-22 18:51:59 +00:00
Greg Clayton f830dbb77b Added the ability to log a value object just as a value would be display
when using the "frame variable" or "target variable" commands.

llvm-svn: 153266
2012-03-22 18:15:37 +00:00
Sean Callanan 1d1435d8a8 Integrated LLVM revision 153218, which fixes a
crash in disassembly of VST instructions.

llvm-svn: 153265
2012-03-22 17:57:10 +00:00
Johnny Chen 8c9739eeda Fixed a bug with the r153228 check-in earlier today in that the cached watchpoint
member variables were not reset appropriately.

llvm-svn: 153239
2012-03-22 05:10:43 +00:00
Sean Callanan 3f85b3205a Fixed a bug in the disassembler where we did
not properly print the load addresses for
PC-relative jumps.

llvm-svn: 153233
2012-03-22 01:10:50 +00:00
Greg Clayton f8712de58c Since we are having issues with the new LLVM MC disassembler, we can have
them both installed with the LLVM MC version being the default. I renamed the
name of the LLVM MC disassembler plug-in to "llvm-mc" and the LLVM enhanced
disassembly plug-in to "llvm-edis" and they can both be installed for now.

To use the "llvm-edis" disassembler, you can just specify it while disassembling:

(lldb) disassemble --plugin llvm-edis --name main
(lldb) disassemble --plugin llvm-mc --name main

This will allow us to compare the output of the two disassembler and eventually
deprecate the old one when the new one is ready. But it does use the new disassembler
by default so we continue to test it on a daily basis.

llvm-svn: 153231
2012-03-22 00:49:15 +00:00
Johnny Chen 7cb09b61b2 WIP snapshot of hardware watchpoints for arm. A simple watchpoint has triggered.
However, the debugserver cannot get past the instruction which triggered the watchpoint.
So a workaround is in place for the time being which disables the triggered watchpoint
before resuming.

Lots of commented out printf's remain in the source which needs to be cleaned up.

WIP rdar://problem/9667960

llvm-svn: 153228
2012-03-22 00:08:13 +00:00
Greg Clayton 02c322c575 Commit missing function prototype.
llvm-svn: 153223
2012-03-21 22:50:54 +00:00
Johnny Chen 72ee62e030 Add missing watchpoint stop info creation logic for arm on the debugger side.
WIP for rdar://problem/9667960

llvm-svn: 153206
2012-03-21 18:28:25 +00:00
Johnny Chen 907c233591 Add "frame info" command to the "Examining Thread State" section, as suggested by Andrew Trick.
llvm-svn: 153204
2012-03-21 18:14:37 +00:00
Sean Callanan e2d4748ae3 Added some hardening to make sure that we don't
use QualType contents unchecked.

llvm-svn: 153201
2012-03-21 17:13:20 +00:00
Sean Callanan 8ce585f8f1 Added a local patch to reflect an LLVM fix for
relocations (LLVM revision 153147).  Now when
we report section locations in the target process,
LLVM will apply both those relocations whose
targets are in that section and those relocations
which reside in that section and point to other
sections.

llvm-svn: 153199
2012-03-21 16:42:08 +00:00
Greg Clayton 2af282a16b Fixed the ability to load a module from a path by using just a UUID. After
the migration to ModuleSpec objects this broke and is now fixed.

Also fixed a case in the darwin kernel dynamic loader where we just need to
trust the load address of the kernel if we can't read it from memory.

llvm-svn: 153164
2012-03-21 04:25:00 +00:00
Sean Callanan 61b33f7464 Fixed some potential null-pointer bugs in the
expression parser code.

llvm-svn: 153128
2012-03-20 21:11:12 +00:00
Enrico Granata 50c88593d6 Headers cleanup
llvm-svn: 153113
2012-03-20 19:33:01 +00:00
Enrico Granata 84f4f84c68 More #includes removed
llvm-svn: 153108
2012-03-20 19:14:34 +00:00
Enrico Granata 22bd67751e Removing spurious <locale> include
llvm-svn: 153107
2012-03-20 18:56:47 +00:00
Enrico Granata 0b45669b6b Removing spurious <ostream> include
llvm-svn: 153106
2012-03-20 18:52:57 +00:00
Greg Clayton b3a40ba812 Platforms can now auto-select themselves if you specify a full target triple when doing a "target create" command.
Each platform now knows if it can handle an architecture and a platform can be found using an architecture. Each platform can look at the arch, vendor and OS and know if it should be used or not.

llvm-svn: 153104
2012-03-20 18:34:04 +00:00
Enrico Granata c2c4e34a46 Fixing a bug where child names in filters were not matched properly
llvm-svn: 153101
2012-03-20 18:02:56 +00:00
Greg Clayton 5400bad64d <rdar://problem/11078937>
LLDB can match incorrect line table entries when an address is between two valid line entries (in the gap between the valid debug info), now it doesn't!

llvm-svn: 153077
2012-03-20 02:15:45 +00:00
Greg Clayton 9ff1ba2546 Make sure that if a UUID was passed in, and we found a match, that should be enough for us.
llvm-svn: 153076
2012-03-20 01:31:19 +00:00
Greg Clayton 2b1bc868a0 Added a fix to the crash log script that allows you to locate and load a binary from any location and _then_ do the symbolication. Something like:
(lldb) file /path/to/file.so
(lldb) crashlog crash.log
....

Then if the file.so has already been loaded it will use the one that is already in LLDB without trying to match up the paths.

llvm-svn: 153075
2012-03-20 01:30:27 +00:00
Johnny Chen e344486e63 Add a '-E' option to the test driver for the purpose of specifying some extra CFLAGS
to pass to the toolchain in order to build the inferior programs to be run/debugged
duirng the test suite.  The architecture might dictate some special CFLAGS which are
more easily specified in a central place (like the command line) instead of inside
make rules.

For Example,

./dotest.py -v -r /shared/phone -A armv7 -E "-isysroot your_sdk_root" functionalities/watchpoint/hello_watchpoint

will relocate the particular test directory ('functionalities/watchpoint/hello_watchpoint' in this case) to a
new directory named '/shared/phone'.  The particular incarnation of the architecture-compiler combination of the
test support files are therefore to be found under:

/shared/phone.arch=armv7-compiler=clang/functionalities/watchpoint/hello_watchpoint

The building of the inferior programs under testing is now working.

The actual launching/debugging of the inferior programs are not yet working,
neither is the setting of a watchpoint on the phone.

llvm-svn: 153070
2012-03-20 00:33:51 +00:00
Enrico Granata a7a3a4c79e Editing documentation to reflect recent changes in the formatters support
llvm-svn: 153068
2012-03-19 23:57:06 +00:00
Enrico Granata 86cc982974 Massive enumeration name changes: a number of enums in ValueObject were not following the naming pattern
Changes to synthetic children:
 - the update(self): function can now (optionally) return a value - if it returns boolean value True, ValueObjectSyntheticFilter will not clear its caches across stop-points
   this should allow better performance for Python-based synthetic children when one can be sure that the child ValueObjects have not changed
 - making a difference between a synthetic VO and a VO with a synthetic value: now a ValueObjectSyntheticFilter will not return itself as its own synthetic value, but will (correctly)
   claim to itself be synthetic
 - cleared up the internal synthetic children architecture to make a more consistent use of pointers and references instead of shared pointers when possible
 - major cleanup of unnecessary #include, data and functions in ValueObjectSyntheticFilter itself
 - removed the SyntheticValueType enum and replaced it with a plain boolean (to which it was equivalent in the first place)
Some clean ups to the summary generation code
Centralized the code that clears out user-visible strings and data in ValueObject
More efficient summaries for libc++ containers

llvm-svn: 153061
2012-03-19 22:58:49 +00:00
Greg Clayton f9be693369 <rdar://problem/11072382>
Fixed a case where the source path remappings on the module were too expensive to
use when we try to verify (stat the file system) that the remapped path points to
a valid file. Now we will use the lldb_private::Module path remappings (if any) when
parsing the debug info without verifying that the paths exist so we don't slow down
line table parsing speeds.

llvm-svn: 153059
2012-03-19 22:22:41 +00:00
Benjamin Kramer 44057c3d01 Include limits.h for PATH_MAX.
llvm-svn: 153013
2012-03-18 13:06:54 +00:00
Jason Molenda be55f383f0 Bump to lldb-133.
Remove unused entitlements plist from debugserver.

llvm-svn: 152973
2012-03-17 03:27:04 +00:00
Enrico Granata 3713cadd09 Changed the URL to the CFString summary provider; slightly reworded the relevant piece of content
llvm-svn: 152972
2012-03-17 02:14:46 +00:00
Enrico Granata 0fddd5631d Pointing users to a new example of synthetic children provider en lieu of the old StdVector example which was removed earlier today
llvm-svn: 152971
2012-03-17 02:04:20 +00:00
Enrico Granata ab8674f99f Adding a new example of synthetic children provider
llvm-svn: 152970
2012-03-17 02:02:03 +00:00
Sean Callanan 7de79f3297 Updated LLVM/Clang to take a patch that fixes some
ARM assembly syntax in LLVM.  This allows LLDB to
build with the latest Clang.

llvm-svn: 152965
2012-03-17 00:02:03 +00:00
Johnny Chen 1b72f09150 Export the APIs submitted by Dawn to the Python bindings. Add a simple test case for the SBModule.compile_unit_iter() API.
llvm-svn: 152952
2012-03-16 21:55:42 +00:00
Johnny Chen e025e30a0e Fix FRAMEWORK_SEARCH_PATHS for iOS builds.
llvm-svn: 152948
2012-03-16 21:25:14 +00:00
Johnny Chen 873a7a4b64 Patch from dawn@burble.org:
GetSupportFileAtIndex(), GetNumSupportFiles(), FindSupportFileIndex():
   Add API support for getting the list of files in a compilation unit.
GetNumCompileUnits(), GetCompileUnitAtIndex():
   Add API support for retrieving the compilation units in a module.

llvm-svn: 152942
2012-03-16 20:46:10 +00:00
Johnny Chen 531c085815 Fix a bug in getRunOptions() where there was no space between the arch spec and the compiler spec.
llvm-svn: 152941
2012-03-16 20:44:00 +00:00
Sean Callanan 9f9ab86581 Updating Xcode project version numbers for lldb-132 and debugserver-182
llvm-svn: 152901
2012-03-16 06:05:58 +00:00
Sean Callanan d6a4b2cdb2 Integrated two high-value Clang fixes:
- Clang now completes all Objective-C objects (if
  they are not already complete, and they have
  external lexical sources) during structure
  layout, avoiding a LLDB crash.

- The Clang Decl printer handles reference types
  correctly.  This prevents LLDB from crashing
  when expression logging is enabled.

llvm-svn: 152897
2012-03-16 05:34:53 +00:00
Enrico Granata 676d3b0682 Warn about an example script being obsoleted by new native features and just an example
llvm-svn: 152890
2012-03-16 01:25:01 +00:00
Enrico Granata 797017a4c1 Deleting obsolete files
llvm-svn: 152888
2012-03-16 01:15:31 +00:00
Johnny Chen a113abce1d rdar://problem/11057400
Add documentation for watchpoint commands.

llvm-svn: 152882
2012-03-16 00:44:02 +00:00
Greg Clayton d804d28556 <rdar://problem/8196933>
Use the metadata in the dSYM bundle Info.plist to remap source paths when they keys are available.

llvm-svn: 152836
2012-03-15 21:01:31 +00:00
Johnny Chen 3bc8ae4014 Add a test case to go with <rdar://problem/11052829> and svn check-in r152809.
llvm-svn: 152825
2012-03-15 19:10:00 +00:00
Johnny Chen f087c8255e Add test case associated with:
rdar://problem/11034702

For the time being, skip the relevant disassemble action which resulted in a crash.

Minor modification (print out format) to the existing TestDisassembleRawBytes.py test file.

llvm-svn: 152822
2012-03-15 18:23:59 +00:00
Greg Clayton 0c94313d20 <rdar://problem/11052829>
Fixed a case where if you have a argument stirng that ends with a '\' character, it would infinite loop while consuming all of your memory.

Also fixed a case where non-quote terminated strings would inefficiently be handled.

llvm-svn: 152809
2012-03-15 17:10:48 +00:00
Han Ming Ong 2ee44a1e38 <rdar://11033946>
Made sure that the root XPC service validate the right before starting the service. The right is created and authenticated by clients (in this case, lldb) and transferred over for validiation.

llvm-svn: 152802
2012-03-15 15:37:50 +00:00
Sean Callanan cf12862a9a Strengthened LLDB's completion of object types.
Now when LLDB reports a variable, it has a
complete type.  Similarly, when it reports
members of a struct, it completes their types.
Also, when it creates the result variable for
an expression, it ensures that variable's type
is complete.

This ensures compliance with Clang's
expectations, preventing potential crashes.

llvm-svn: 152771
2012-03-15 01:53:17 +00:00
Greg Clayton 1b02c17391 <rdar://problem/11049371>
http://llvm.org/bugs/show_bug.cgi?id=12232

Fixed a case where a missing "break" in a switch statement could cause an assertion to fire and kill the debug session.

The fix was derived from the findings of Andrea Bigagli, thanks Andrea.

llvm-svn: 152741
2012-03-14 21:00:47 +00:00
Enrico Granata a88fdd3cdd Committing a patch from Filipe Cabecinhas
llvm-svn: 152733
2012-03-14 18:52:33 +00:00
Johnny Chen 24b5b8b7b8 Remove a debug statement.
llvm-svn: 152732
2012-03-14 18:35:38 +00:00
Sean Callanan cc5039dd9e Updating Xcode project version numbers for lldb-131 and debugserver-181
llvm-svn: 152726
2012-03-14 17:15:39 +00:00
Benjamin Kramer e6afc77a1b Makefile build: clang now depends on libclangEdit.
llvm-svn: 152710
2012-03-14 11:03:46 +00:00
Greg Clayton d64afba584 <rdar://problem/10434005>
Prepare LLDB to be built with C++11 by hiding all accesses to std::tr1 behind
macros that allows us to easily compile for either C++.

llvm-svn: 152698
2012-03-14 03:07:05 +00:00
Greg Clayton 29e08cbb9c <rdar://problem/11042408>
Fixed an issue with the FUNC_STARTS load command where we would get the
symbol size wrong and we would add all sorts of symbols due to bit zero being
set to indicate thumb.

llvm-svn: 152696
2012-03-14 01:53:24 +00:00
Jason Molenda 9def4c36be bump to lldb-130
llvm-svn: 152689
2012-03-14 00:03:49 +00:00
Jason Molenda 64cab1220a bump to debugserver-180
llvm-svn: 152687
2012-03-14 00:00:36 +00:00
Jason Molenda 9514fa3d39 On iOS builds, install debugserver in /Developer/usr/bin.
Also add a copy files phase for -target ios that installs
the debugserver launch plists.

llvm-svn: 152680
2012-03-13 23:29:39 +00:00
Greg Clayton a174349960 <rdar://problem/11034170>
Simplify the locking strategy for Module and its owned objects to always use the Module's mutex to avoid A/B deadlocks. We had a case where a symbol vendor was locking itself and then calling a function that would try to get it's Module's mutex and at the same time another thread had the Module mutex that was trying to get the SymbolVendor mutex. Now any classes that inherit from ModuleChild should use the module lock using code like:

void
ModuleChildSubclass::Function
{
	ModuleSP module_sp(GetModule());
	if (module_sp)
	{
    	lldb_private::Mutex::Locker locker(module_sp->GetMutex());
		... do work here...
	}
}

This will help avoid deadlocks by using as few locks as possible for a module and all its child objects and also enforce detecting if a module has gone away (the ModuleSP will be returned empty if the weak_ptr does refer to a valid object anymore).

llvm-svn: 152679
2012-03-13 23:14:29 +00:00
Enrico Granata 3f1052b7cf The Cocoa formatters now provide error messages for many of the common things-went-wrong situations. Previously they would say nothing or log failures to the Python console
llvm-svn: 152673
2012-03-13 21:52:00 +00:00
Jason Molenda 08441ba45e Send an "OK" response to the "D" (detach) packet.
v. http://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#Packets

the detach packet is supposed to send a reply.

llvm-svn: 152671
2012-03-13 21:10:35 +00:00
Johnny Chen a4ac217d6c rdar://problem/11031743
For EmulateInstructionARM::EmulatePUSH(), fix the logical branch for when pc is pushed to behave
like the other cases where:

    context.SetRegisterToRegisterPlusOffset (reg_info, sp_reg, addr - sp);

is called to inform of the operation to set a register value to a memory location calculated from
a base register plus an offset.

llvm-svn: 152670
2012-03-13 21:07:03 +00:00
Sean Callanan 632d2f729d Hardened the step-out plan in case it receives
bad stack IDs.

llvm-svn: 152630
2012-03-13 16:34:56 +00:00
Greg Clayton 9096603ae1 Bumped Xcode project versions for lldb-129 and debugserver-179.
llvm-svn: 152606
2012-03-13 02:26:21 +00:00
Jason Molenda 68fc21562f version bump to lldb-128
llvm-svn: 152603
2012-03-13 02:13:37 +00:00
Jason Molenda 0c482971e4 version bump to 178
llvm-svn: 152602
2012-03-13 02:12:55 +00:00
Jason Molenda d60205e68e Don't SKIP_INSTALL for sdk==iOS, install in to /usr/local/bin for now.
llvm-svn: 152601
2012-03-13 01:56:24 +00:00
Jason Molenda 16d7581fdb Pull in another plist from the old debugserver project.
Switch default compiler to clang.

llvm-svn: 152600
2012-03-13 01:23:54 +00:00
Jason Molenda f0d0b85da0 Mark newly added synthesizer calls as being #ifndef LLDB_DISABLE_PYTHON
llvm-svn: 152599
2012-03-13 01:19:42 +00:00
Enrico Granata 8c69c96dc9 Changed several of the Cocoa formatters to match the output style that Xcode uses internally to provide summaries
This has been done for those summaries where the difference is only cosmetic (e.g. naming things as items instead of values, ...)
The LLDB output style has been preserved when it provides more information (e.g. telling the type as well as the value of an NSNumber)

Test cases have been updated to reflect the updated output style where necessary

llvm-svn: 152592
2012-03-13 00:25:59 +00:00
Enrico Granata c7f873064b Added formatters for libc++ (http://libcxx.llvm.org):
std::string has a summary provider
 std::vector std::list and std::map have both a summary and a synthetic children provider
Given the usage of a custom namespace (std::__1::classname) for the implementation of libc++, we keep both libstdcpp and libc++ formatters enabled at the same time since that raises no conflicts and enabled for seamless transition between the two
The formatters for libc++ reside in a libcxx category, and are loaded from libcxx.py (to be found in examples/synthetic)

The formatters-stl test cases have been divided to be separate for libcxx and libstdcpp. This separation is necessary because
 (a) we need different compiler flags for libc++ than for libstdcpp
 (b) libc++ inlines a lot more than libstdcpp and some code changes were required to accommodate this difference

llvm-svn: 152570
2012-03-12 19:47:17 +00:00
Greg Clayton 701a6b473d <rdar://problem/11030692>
SBProcess::PutSTDIN() was not working for a few builds on darwin when using debugserver. This is now fixed.

llvm-svn: 152569
2012-03-12 19:02:41 +00:00
Sean Callanan ddcda28fee Disabled the i386 tests pending fixes in the JIT.
llvm-svn: 152568
2012-03-12 18:54:10 +00:00
Sean Callanan b7de960158 Hardened the process of reading the program counter
on behalf of a DWARF expression.

llvm-svn: 152477
2012-03-10 03:03:46 +00:00
Jim Ingham fd9de90123 Meta classes can't have dynamic types...
<rdar://problem/11021925>

llvm-svn: 152473
2012-03-10 02:03:37 +00:00
Sean Callanan 1fc91ad1c5 ...And finished the job.
llvm-svn: 152472
2012-03-10 02:00:32 +00:00
Sean Callanan d7dabe2237 Hardened isObjCObjectPointerType() against NULLs.
llvm-svn: 152471
2012-03-10 01:59:11 +00:00
Jason Molenda e23d854c05 Bump lldb version to lldb-127.
llvm-svn: 152465
2012-03-10 01:10:19 +00:00
Jason Molenda 5a37223ece Bump debugserver version to 177.
llvm-svn: 152464
2012-03-10 01:09:40 +00:00
Jason Molenda bdf4161ab7 Re-enable the use of the ARMDisassembler framework when building debugserver for ios.
Greg disabled this back in 2012-01-10 r147886 but we still need to use it.

<rdar://problem/11016745>

llvm-svn: 152463
2012-03-10 01:09:05 +00:00
Jim Ingham ab175242d9 Fix the process of getting the ObjC runtime - if we ask for it too early (in the process of handling the
load notification for the first load) then we will set it the runtime to NULL and won't re-search for it.
Added a way for the dynamic loader to force a re-search, since it knows the world has changed.

llvm-svn: 152453
2012-03-10 00:22:19 +00:00
Jim Ingham 329617a80a Make debugserver quieter about memory read errors.
<rdar://problem/10681220>

llvm-svn: 152438
2012-03-09 21:09:42 +00:00
Jim Ingham 34aae5b9bc Handle the case where we get called to determine the ObjC runtime version BEFORE the loader code has
winnowed all the unloaded libraries from the process module list.
<rdar://problem/11015223>

llvm-svn: 152427
2012-03-09 19:59:28 +00:00
Enrico Granata 332b0b9a2f Fixing a problem with the NSSet summary provider; plus, providing a further optimization to the whole Cocoa formatters infrastructure
llvm-svn: 152423
2012-03-09 19:04:53 +00:00
Greg Clayton 2bf10c3766 Bumping Xcode project versions for lldb-126 and debugserver-176.
llvm-svn: 152384
2012-03-09 04:31:41 +00:00
Greg Clayton b5225c863c Bumping Xcode project versions for lldb-126 and debugserver-176.
llvm-svn: 152383
2012-03-09 04:31:35 +00:00
Greg Clayton f3bb3e472f <rdar://problem/11016907>
Get function boundaries from the LC_FUNCTION_STARTS load command. This helps to determine symbol sizes and also allows us to be able to debug stripped binaries.

If you have a stack backtrace that goes through a function that has been stripped from the symbol table, the variables for any functions above that stack frame will most likely be incorrect. It can also affect our ability to step in/out/through of a function.

llvm-svn: 152381
2012-03-09 04:26:05 +00:00
Greg Clayton efbc7d2356 <rdar://problem/11016922>
Don't show variable values in Xcode when they are out of scope. This allows Xcode to step a lot faster when there are many variables in the variables view.

llvm-svn: 152380
2012-03-09 04:23:44 +00:00
Greg Clayton 8f15c829bf Remove a debug binary from the scheme.
llvm-svn: 152379
2012-03-09 04:22:55 +00:00
Jim Ingham 564d8bc255 First stage of implementing step by "run to next branch". Doesn't work yet, is turned off.
<rdar://problem/10975912>

llvm-svn: 152376
2012-03-09 04:10:47 +00:00
Enrico Granata 9d60f60760 Changed ValueObject to use a dedicated ChildrenManager class to store its children, instead of an std::vector
This solves an issue where a ValueObject was getting a wrong children count (usually, a huge value) and trying to resize the vector of children to fit that many ValueObject*

Added a loop detection algorithm to the synthetic children provider for std::list

Added a few more checks to the synthetic children provider for std::vector

Both std::list and std::vector's synthetic children providers now cache the count of children instead of recomputing it every time
std::map has a field that stores the count, so there is little need to cache it on our side

llvm-svn: 152371
2012-03-09 03:09:58 +00:00
Johnny Chen 934c05d284 Add the capability on OS X to utilize 'xcrun' to locate the compilers used for building the inferior programs
to be debugged while running the test suite.  By default, compilers is set to ['clang'] and can be overridden
using the "-C compilerA^compilerB" option.

llvm-svn: 152367
2012-03-09 02:11:37 +00:00
Enrico Granata eb55ad4ad7 the formatter for NSNotification was not being initialized correctly
llvm-svn: 152358
2012-03-09 00:45:19 +00:00
Johnny Chen 5a9a9883be Change the test driver so that, by default, it takes into consideration of both 'x86_64' and 'i386' architectures
when building the inferior programs.

Example:

/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -v functionalities/watchpoint
LLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
LLDB-123
Path: /Volumes/data/lldb/svn/ToT
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 152244
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 152244
Last Changed Date: 2012-03-07 13:03:09 -0800 (Wed, 07 Mar 2012)



Session logs for test failures/errors/unexpected successes will go into directory '2012-03-08-16_43_51'
Command invoked: python ./dotest.py -v functionalities/watchpoint

Configuration: arch=x86_64
----------------------------------------------------------------------
Collected 21 tests

 1: test_hello_watchlocation_with_dsym (TestWatchLocation.HelloWatchLocationTestCase)
    Test watching a location with '-x size' option. ... ok
 2: test_hello_watchlocation_with_dwarf (TestWatchLocation.HelloWatchLocationTestCase)
    Test watching a location with '-x size' option. ... ok
 3: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
    Test a simple sequence of watchpoint creation and watchpoint hit. ... ok
 4: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
    Test a simple sequence of watchpoint creation and watchpoint hit. ... ok
 5: test_watchpoint_multiple_threads_with_dsym (TestWatchpointMultipleThreads.WatchpointForMultipleThreadsTestCase)
    Test that lldb watchpoint works for multiple threads. ... ok
 6: test_watchpoint_multiple_threads_with_dwarf (TestWatchpointMultipleThreads.WatchpointForMultipleThreadsTestCase)
    Test that lldb watchpoint works for multiple threads. ... ok
 7: test_rw_disable_after_first_stop__with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint but disable it after the first stop. ... ok
 8: test_rw_disable_after_first_stop_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint but disable it after the first stop. ... ok
 9: test_rw_disable_then_enable_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint, disable initially, then enable it. ... ok
10: test_rw_disable_then_enable_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint, disable initially, then enable it. ... ok
11: test_rw_watchpoint_delete_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test delete watchpoint and expect not to stop for watchpoint. ... ok
12: test_rw_watchpoint_delete_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test delete watchpoint and expect not to stop for watchpoint. ... ok
13: test_rw_watchpoint_set_ignore_count_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test watchpoint ignore count and expect to not to stop at all. ... ok
14: test_rw_watchpoint_set_ignore_count_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test watchpoint ignore count and expect to not to stop at all. ... ok
15: test_rw_watchpoint_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint and expect to stop two times. ... ok
16: test_rw_watchpoint_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint and expect to stop two times. ... ok
17: test_watchpoint_cond_with_dsym (TestWatchpointConditionCmd.WatchpointConditionCmdTestCase)
    Test watchpoint condition. ... ok
18: test_watchpoint_cond_with_dwarf (TestWatchpointConditionCmd.WatchpointConditionCmdTestCase)
    Test watchpoint condition. ... ok
19: test_watchlocation_with_dsym_using_watchpoint_set (TestWatchLocationWithWatchSet.WatchLocationUsingWatchpointSetTestCase)
    Test watching a location with 'watchpoint set expression -w write -x size' option. ... ok
20: test_watchlocation_with_dwarf_using_watchpoint_set (TestWatchLocationWithWatchSet.WatchLocationUsingWatchpointSetTestCase)
    Test watching a location with 'watchpoint set expression -w write -x size' option. ... ok
21: test_error_cases_with_watchpoint_set (TestWatchpointSetErrorCases.WatchpointSetErrorTestCase)
    Test error cases with the 'watchpoint set' command. ... ok

----------------------------------------------------------------------
Ran 21 tests in 74.590s

OK

Configuration: arch=i386
----------------------------------------------------------------------
Collected 21 tests

 1: test_hello_watchlocation_with_dsym (TestWatchLocation.HelloWatchLocationTestCase)
    Test watching a location with '-x size' option. ... ok
 2: test_hello_watchlocation_with_dwarf (TestWatchLocation.HelloWatchLocationTestCase)
    Test watching a location with '-x size' option. ... ok
 3: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
    Test a simple sequence of watchpoint creation and watchpoint hit. ... ok
 4: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
    Test a simple sequence of watchpoint creation and watchpoint hit. ... ok
 5: test_watchpoint_multiple_threads_with_dsym (TestWatchpointMultipleThreads.WatchpointForMultipleThreadsTestCase)
    Test that lldb watchpoint works for multiple threads. ... ok
 6: test_watchpoint_multiple_threads_with_dwarf (TestWatchpointMultipleThreads.WatchpointForMultipleThreadsTestCase)
    Test that lldb watchpoint works for multiple threads. ... ok
 7: test_rw_disable_after_first_stop__with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint but disable it after the first stop. ... ok
 8: test_rw_disable_after_first_stop_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint but disable it after the first stop. ... ok
 9: test_rw_disable_then_enable_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint, disable initially, then enable it. ... ok
10: test_rw_disable_then_enable_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint, disable initially, then enable it. ... ok
11: test_rw_watchpoint_delete_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test delete watchpoint and expect not to stop for watchpoint. ... ok
12: test_rw_watchpoint_delete_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test delete watchpoint and expect not to stop for watchpoint. ... ok
13: test_rw_watchpoint_set_ignore_count_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test watchpoint ignore count and expect to not to stop at all. ... ok
14: test_rw_watchpoint_set_ignore_count_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test watchpoint ignore count and expect to not to stop at all. ... ok
15: test_rw_watchpoint_with_dsym (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint and expect to stop two times. ... ok
16: test_rw_watchpoint_with_dwarf (TestWatchpointCommands.WatchpointCommandsTestCase)
    Test read_write watchpoint and expect to stop two times. ... ok
17: test_watchpoint_cond_with_dsym (TestWatchpointConditionCmd.WatchpointConditionCmdTestCase)
    Test watchpoint condition. ... ok
18: test_watchpoint_cond_with_dwarf (TestWatchpointConditionCmd.WatchpointConditionCmdTestCase)
    Test watchpoint condition. ... ok
19: test_watchlocation_with_dsym_using_watchpoint_set (TestWatchLocationWithWatchSet.WatchLocationUsingWatchpointSetTestCase)
    Test watching a location with 'watchpoint set expression -w write -x size' option. ... ok
20: test_watchlocation_with_dwarf_using_watchpoint_set (TestWatchLocationWithWatchSet.WatchLocationUsingWatchpointSetTestCase)
    Test watching a location with 'watchpoint set expression -w write -x size' option. ... ok
21: test_error_cases_with_watchpoint_set (TestWatchpointSetErrorCases.WatchpointSetErrorTestCase)
    Test error cases with the 'watchpoint set' command. ... ok

----------------------------------------------------------------------
Ran 21 tests in 67.059s

OK

llvm-svn: 152357
2012-03-09 00:44:59 +00:00
Jason Molenda e83bc02b16 Bump to lldb-125.
llvm-svn: 152353
2012-03-08 23:25:56 +00:00
Johnny Chen 5d34629daf Fixed a crasher when Xcode calls into ScriptInterpreterPython::ResetOutputFileHandle().
The Locker should only perform acquire/free lock operation, but no enter/leave session
at all.  Also added sanity checks for items passed to the PyDict_SetItemString() calls.

llvm-svn: 152337
2012-03-08 20:53:04 +00:00
Greg Clayton ef5a7b1c36 Bumping Xcode project version for lldb-124 and debugserver-175.
llvm-svn: 152294
2012-03-08 04:15:20 +00:00
Jason Molenda 82df6635fe Use a new define, NO_XPC_SERVICES, to indicate that macosx/Host.mm
shouldn't compile any of the XPC support code.  

Update macosx/Host.mm to use that define.

Add a LLDB_DISABLE_PYTHON ifdef block around a new function in 
Core/FormatManager.cpp.

<rdar://problem/10942125>

llvm-svn: 152293
2012-03-08 04:03:25 +00:00
Greg Clayton 85f3fa5411 <rdar://problem/11007934>
On darwin, if child process of process being debugged dies due to mach exception, the debugged process will die.

debugserver now only handles the mach exceptions for the task being debugged.

llvm-svn: 152291
2012-03-08 03:27:27 +00:00
Sean Callanan 226b70c154 Updated the revision of LLVM/Clang used by LLDB.
This takes two important changes:

- Calling blocks is now supported.  You need to
  cast their return values, but that works fine.

- We now can correctly run JIT-compiled
  expressions that use floating-point numbers.

Also, we have taken a fix that allows us to
ignore access control in Objective-C as in C++.

llvm-svn: 152286
2012-03-08 02:39:03 +00:00
Greg Clayton ecc7c0d817 Moved inline functions into SBTarget.cpp and made destructors for SBLaunchInfo and SBAttachInfo to avoid link warnings.
llvm-svn: 152267
2012-03-07 23:52:51 +00:00
Greg Clayton 8f89a7b0b8 Make sure the byte size is correct when dumping as it may need to be calculated on the fly.
llvm-svn: 152265
2012-03-07 23:30:39 +00:00
Greg Clayton 94b1cd022c Revert the default debugger to LLDB.
llvm-svn: 152263
2012-03-07 23:05:14 +00:00
Greg Clayton fba33af11c <rdar://problem/10993996>
Added a new makefile target to help us with Apple builds where the installhdrs
will copy the headers for the shared library. Prior to this fix, the install
headers directory would contain the unix style paths to all public header
files ("#include lldb/API/SBDefines.h") instead of the fixed up framework
header paths ("#include <LLDB/SBDefines.h>").

llvm-svn: 152253
2012-03-07 22:47:26 +00:00
Sean Callanan a8b3dbf20f Look up ivar offset symbols correctly. We now
treat Objective-C ivar symbols as their own kind
of symbol rather than lumping them in with generic
"runtime" symbols.

llvm-svn: 152251
2012-03-07 22:29:49 +00:00
Jim Ingham 3d90292297 When comparing a Thread against a ThreadSpec, don't fetch the Thread's Name or QueueName if the ThreadSpec doesn't specify them.
llvm-svn: 152245
2012-03-07 22:03:04 +00:00
Greg Clayton e761213428 <rdar://problem/10997402>
This fix really needed to happen as a previous fix I had submitted for
calculating symbol sizes made many symbols appear to have zero size since
the function that was calculating the symbol size was calling another function
that would cause the calculation to happen again. This resulted in some symbols
having zero size when they shouldn't. This could then cause infinite stack
traces and many other side affects.

llvm-svn: 152244
2012-03-07 21:03:09 +00:00
Johnny Chen 2c76eb02a9 rdar://problem/10998562
lldb crashes under guard malloc

Fix CommandObjectSettingsAppend::ExecuteRawCommandString() so that it does not perform the cmd_args.Shift()
operation after it has got the var_name out of the raw string, since StringRef is manipulating the raw
string later on.

llvm-svn: 152194
2012-03-07 02:09:02 +00:00
Johnny Chen c79c93ad96 rdar://problem/10611315
expression command doesn't handle xmm or stmm registers...

o Update ClangASTContext::GetBuiltinTypeForEncodingAndBitSize() to now handle eEncodingVector.

o Modify RegisterValue::SetFromMemoryData() to fix the subtle error due to unitialized variables.

o Add a test file for "expr $xmm0".

llvm-svn: 152190
2012-03-07 01:12:24 +00:00
Enrico Granata eb06e25242 Fixing some of the new Python formatters to report '1 object' instead of '1 objects'
llvm-svn: 152186
2012-03-07 00:56:09 +00:00
Han Ming Ong e86f8f4df9 <rdar://10996650>
Passed in the right number of parameters for CFDictionaryCreate

llvm-svn: 152182
2012-03-07 00:32:38 +00:00
Enrico Granata a73b7df7de Using the new ScriptInterpreterObject in the implementation of synthetic children to enhance type safety
Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed
Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code

llvm-svn: 152164
2012-03-06 23:42:15 +00:00
Enrico Granata 297e69f15e Fixing an issue where a ValueObject had changed its value but the 'value changed' flag was not being set. This was breaking one of our test cases
llvm-svn: 152161
2012-03-06 23:21:16 +00:00
Greg Clayton 9c76611055 Added the ability to disassembly "count" instructions given a SBAddress.
This was done in SBTarget:

lldb::SBInstructionList
lldb::SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count);

Also cleaned up a few files in the LLDB.framework settings.

llvm-svn: 152152
2012-03-06 22:24:44 +00:00
Sean Callanan 75383bf34d Added support for calling blocks from expressions,
but gated by an #ifdef until we roll LLVM/Clang to
bring in the necessary parser support.

llvm-svn: 152149
2012-03-06 21:56:33 +00:00
Sean Callanan 20a33d5f65 Don't return bare symbols when asked to search
inside a namespace.  This bypasses local variables.

llvm-svn: 152144
2012-03-06 20:53:06 +00:00
Jim Ingham f0fd55e631 Fix a little nit with exception breakpoints for C++, the expression parser wants to be
more aggressive about trapping exceptions than a user would be.  Make it so...

llvm-svn: 152125
2012-03-06 18:10:38 +00:00
Greg Clayton 6a820b624b Bumping Xcode project versions for lldb-123 and debugserver-174.
llvm-svn: 152103
2012-03-06 04:02:03 +00:00
Greg Clayton 9845a8d54d <rdar://problem/10840355>
Fixed STDERR to not be opened as readable. Also cleaned up some of the code that implemented the file actions as some of the code was using the wrong variables, they now use the right ones (in for stdin, out for stdout, err for stderr).

llvm-svn: 152102
2012-03-06 04:01:04 +00:00