Commit Graph

3128 Commits

Author SHA1 Message Date
Enrico Granata d55546b27a when typing a summary string you can use the %S symbol to explicitly indicate that you want the summary to be used to print the target object
(e.g. ${var%S}). this might already be the default if your variable is of an aggregate type
new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset
 - the restricted list of children obeys the typical rules (e.g. summaries prevail over children)
 - one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible
 - to provide a synthetic children list use the "type synth add" command, as in:
   type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4]
   (you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported)
 - a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones

llvm-svn: 135731
2011-07-22 00:16:08 +00:00
Johnny Chen 6cbb8d684f Add test scenario of SBValue APIs for the 'days_of_week' global variable.
llvm-svn: 135716
2011-07-21 23:02:00 +00:00
Johnny Chen 6853cf66d1 Add test scenario for exercising SBValue API: TypeIsPointerType() and GetByteSize().
llvm-svn: 135699
2011-07-21 19:31:59 +00:00
Johnny Chen becabe0e81 Initialize the all important automatic variable 'lldb::ConnectionStatus status' before
invoking the Read(...) method to read in bytes.  Similar to r135461.

llvm-svn: 135695
2011-07-21 19:00:59 +00:00
Jim Ingham 9411ddb65f If we are telling only one thread to run in debugserver, and that thread has been suspended from outside
the debugger, resume it before running so we will actually make progress.

llvm-svn: 135655
2011-07-21 01:54:41 +00:00
Enrico Granata 6d54d89af1 essentials contains two small summaries that you might really want to use; lldb contains some basic summaries for use in debugging LLDB itself. to use them, you must type category enable lldb
llvm-svn: 135653
2011-07-21 01:40:17 +00:00
Greg Clayton 5b88216ddc More KDP fixes and logging cleanup.
llvm-svn: 135652
2011-07-21 01:12:01 +00:00
Johnny Chen c7ed223d2a Change docstring wording: from 'method' to 'function'.
llvm-svn: 135648
2011-07-21 00:50:54 +00:00
Johnny Chen 3a31573f31 Add docstring for SBInstructionList class.
llvm-svn: 135647
2011-07-21 00:48:02 +00:00
Johnny Chen 098ca0e7e6 Add docstring for SBCommandReturnObject class.
llvm-svn: 135642
2011-07-21 00:32:12 +00:00
Johnny Chen ad4fe1b46e Add docstring for SBCommandInterpreter class.
llvm-svn: 135631
2011-07-20 22:50:58 +00:00
Johnny Chen 2e16d5dc8f Add docstring for SBBroadcaster class.
llvm-svn: 135630
2011-07-20 22:29:58 +00:00
Johnny Chen 424e55933a Add a note.
llvm-svn: 135615
2011-07-20 20:28:36 +00:00
Johnny Chen 15a6ac4821 Minor modification.
llvm-svn: 135606
2011-07-20 19:29:08 +00:00
Johnny Chen a17c7e0517 Skip the remaining -Y? (skipping ? layers of summaries) tests if using a known version
of Apple gcc build which produces wrong namespace for std::string in debug info.

llvm-svn: 135597
2011-07-20 18:29:32 +00:00
Greg Clayton 07e66e3ebe Added KDP resume, suspend, set/remove breakpoint, and kernel version support.
Also we now display a live update of the kexts that we are loading.

llvm-svn: 135563
2011-07-20 03:41:06 +00:00
Greg Clayton 87b0c1e63c Remove extra launch arguments.
llvm-svn: 135560
2011-07-20 02:22:21 +00:00
Greg Clayton 0c54d8a97c Added register reading support for ARM, i386 and x86_64.
llvm-svn: 135557
2011-07-20 01:32:50 +00:00
Johnny Chen 5cb19e7725 Add some docstrings for SBFileSpec class.
llvm-svn: 135553
2011-07-20 01:06:37 +00:00
Johnny Chen 8957729268 Add some docstrings for SBError class.
llvm-svn: 135547
2011-07-20 00:23:11 +00:00
Johnny Chen 2494f555b6 A more succinct assertTrue.
llvm-svn: 135544
2011-07-20 00:14:20 +00:00
Johnny Chen cd1211ef81 Minor change; add an assertTrue stmt.
llvm-svn: 135542
2011-07-20 00:11:54 +00:00
Johnny Chen 755e083ef6 Add some docstrings for SBSourceManager class.
llvm-svn: 135539
2011-07-19 23:35:10 +00:00
Johnny Chen e012858bd6 Add some docstrings for SBStream class.
llvm-svn: 135536
2011-07-19 23:24:36 +00:00
Johnny Chen fdc4a86c05 Move the rest of the SB headers to interface files.
They are not docstring'ed yet.

llvm-svn: 135531
2011-07-19 22:41:47 +00:00
Enrico Granata 2dee16e883 type category list now supports a regular expression argument that filters categories to only include the ones matching the regex
type summary list now supports a -w flag with a regular expression argument that filters categories to only include the ones matching the regex
in category and summary listings, categories are printed in a meaningful order:
 - enabled ones first, in the order in which they are searched for summaries
 - disabled ones, in an unspecified order
type summary list by default only expands non-empty enabled categories. to obtain a full listing, you must use the -w flag giving a "match-all" regex

llvm-svn: 135529
2011-07-19 22:35:10 +00:00
Johnny Chen 0f5196844d Rearrange the %include SWIG directives into two groups. One is the pure .h headers and the other is the .i interface files.
The objective is to move the .h header into .i interface file eventually.

llvm-svn: 135526
2011-07-19 21:49:34 +00:00
Enrico Granata 9df29e32c9 Applied Matt Johnson patch to ValueObject and FormatManager
llvm-svn: 135523
2011-07-19 20:57:44 +00:00
Greg Clayton 72c66dde39 Avoid calling accessor function more than once when result is already in
a local.

llvm-svn: 135512
2011-07-19 20:06:26 +00:00
Greg Clayton 9189b20875 Added some more functionality to SocketAddress and modified
ConnectionFileDescriptor to use it.

llvm-svn: 135511
2011-07-19 20:03:42 +00:00
Johnny Chen 4480530a0f Patch by Matt Johnson to silence G++ warnings!
Used hand merge to apply the diffs.  I did not apply the diffs for FormatManager.h and
the diffs for memberwise initialization for ValueObject.cpp because they changed since.
I will ask my colleague to apply them later.

llvm-svn: 135508
2011-07-19 19:48:13 +00:00
Johnny Chen 8a4fc74728 Fix build error for StringSummaryFormat undefined symbols.
llvm-svn: 135503
2011-07-19 19:39:02 +00:00
Enrico Granata 20edcdbe8a The implementation of categories is now synchronization safe
Code cleanup:
 - The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
   actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
   FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
   are contained. The wrapper code always remains in Debugger.{h|cpp}
 - Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
 - for type category enable, saying "enable A B C" is the same as saying
    enable C
    enable B
    enable A
   (the ordering is relevant in enabling categories, and it is expected that a user typing
    enable A B C wants to look into category A, then into B, then into C and not the other
    way round)
 - for the other two commands, the order is not really relevant (however, the same inverted ordering
   is used for consistency)

llvm-svn: 135494
2011-07-19 18:03:25 +00:00
Greg Clayton ad440da346 Abstract "struct sockaddr", "struct sockaddr_in", "struct sockaddr_in6" and
"struct sockaddr_storage" into a new host class called SocketAddress. This
will allow us to control the host specific implementations (such as how to
get the length) into a single Host specific class.

llvm-svn: 135488
2011-07-19 16:44:54 +00:00
Greg Clayton a63d08c9ff Modified the LocateMacOSXFilesUsingDebugSymbols(...) function to locate
an executable file if it is right next to a dSYM file that is found using
DebugSymbols. The code also looks into a bundle if the dSYM file is right
next to a bundle.

Modified the MacOSX kernel dynamic loader plug-in to correctly set the load
address for kext sections. This is a tad tricky because of how LLDB chooses
to treat mach-o segments with no name. Also modified the loader to properly
handle the older version 1 kext summary info.

Fixed a crasher in the Mach-o object file parser when it is trying to set
the section size correctly for dSYM sections.

Added packet dumpers to the CommunicationKDP class. We now also properly 
detect address byte sizes based on the cpu type and subtype that is provided.
Added a read memory and read register support to CommunicationKDP. Added a
ThreadKDP class that now uses subclasses of the RegisterContextDarwin_XXX for
arm, i386 and x86_64. 

Fixed some register numbering issues in the RegisterContextDarwin_arm class
and added ARM GDB numbers to the ARM_GCC_Registers.h file.

Change the RegisterContextMach_XXX classes over to subclassing their
RegisterContextDarwin_XXX counterparts so we can share the mach register 
contexts between the user and kernel plug-ins.

llvm-svn: 135466
2011-07-19 03:57:15 +00:00
Enrico Granata 1490c6fd8f Fixed a bug where deleting a regex summary would not immediately reflect in the variables display
The "systemwide summaries" feature has been removed and replaced with a more general and
powerful mechanism.
Categories:
 - summaries can now be grouped into buckets, called "categories" (it is expected that categories
   correspond to libraries and/or runtime environments)
 - to add a summary to a category, you can use the -w option to type summary add and give
   a category name (e.g. type summary add -f "foo" foo_t -w foo_category)
 - categories are by default disabled, which means LLDB will not look into them for summaries,
   to enable a category use "type category enable". once a category is enabled, LLDB will
   look into that category for summaries. the rules are quite trivial: every enabled category
   is searched for an exact match. if an exact match is nowhere to be found, any match is
   searched for in every enabled category (whether it involves cascading, going to base classes,
   ...). categories are searched into the order in which they were enabled (the most recently
   enabled category first, then the second most and so on..)
 - by default, most commands that deal with summaries, use a category named "default" if no
   explicit -w parameter is given (the observable behavior of LLDB should not change when
   categories are not explicitly used)
 - the systemwide summaries are now part of a "system" category

llvm-svn: 135463
2011-07-19 02:34:21 +00:00
Johnny Chen 74549c82ad Initialize the all important automatic variable 'lldb::ConnectionStatus status' before
invoking the Read(...) method to read in bytes.  This seems to fix the infinite looping
I was seeing on SnowLeopard while running the test suite.

llvm-svn: 135461
2011-07-19 01:13:00 +00:00
Johnny Chen 349f076330 Add SWIG interface files for SBSymbol, SBSymbolContext, and SBSymbolContextList.
llvm-svn: 135459
2011-07-19 01:07:06 +00:00
Johnny Chen f74cb50cda Add SWIG Python interface files for SBLineEntry, SBListener, and SBModule.
llvm-svn: 135441
2011-07-18 23:11:07 +00:00
Johnny Chen d84a9a1249 Missed the interface file for SBFunction in the previous checkin.
llvm-svn: 135436
2011-07-18 22:15:37 +00:00
Johnny Chen 0eca544b45 Add SWIG Python interface files for SBDebugger, SBCompileUnit, and SBEvent.
llvm-svn: 135432
2011-07-18 22:11:53 +00:00
Johnny Chen 5de6a790f2 Add SWIG Python interface files for SBAddress, SBBlock, SBBreakpoint, and SBBreakpointLocation.
llvm-svn: 135430
2011-07-18 21:30:21 +00:00
Sean Callanan 22c52d9a98 Removed a redundant dyn_cast. Thanks to Felipe
Cabecinhas.

llvm-svn: 135429
2011-07-18 21:30:18 +00:00
Johnny Chen 357033b337 Add SWIG Python interface files for SBProcess, SBThread, and SBFrame.
llvm-svn: 135419
2011-07-18 20:13:38 +00:00
Johnny Chen 9a5b16b87c Fix header documentations.
llvm-svn: 135417
2011-07-18 19:15:22 +00:00
Johnny Chen 67ae7bdb54 Add two new interface files SBValue.i and SBValueList.i, instead of directly swigging the header files.
llvm-svn: 135416
2011-07-18 19:08:30 +00:00
Johnny Chen 482ad087ef Cleaned up the interface file for SBTarget.
llvm-svn: 135405
2011-07-18 17:53:20 +00:00
Enrico Granata 03f16a09bf Runtime errors in Python scripts were not being shown; this fix makes them print out to ease correcting errors
llvm-svn: 135395
2011-07-18 16:24:10 +00:00
Greg Clayton 3a29bdbe9b Added a boolean to the pure virtual lldb_private::Process::CanDebug(...)
method so process plug-ins that are requested by name can answer yes when
asked if they can debug a target that might not have any file in the target.

Modified the ConnectionFileDescriptor to have both a read and a write file
descriptor. This allows us to support UDP, and eventually will allow us to
support pipes. The ConnectionFileDescriptor class also has a file descriptor
type for each of the read and write file decriptors so we can use the correct
read/recv/recvfrom call when reading, or write/send/sendto for writing.

Finished up an initial implementation of UDP where you can use the "udp://"
URL to specify a host and port to connect to:

(lldb) process connect --plugin kdp-remote udp://host:41139

This will cause a ConnectionFileDescriptor to be created that can send UDP
packets to "host:41139", and it will also bind to a localhost port that can
be given out to receive the connectionless UDP reply. 

Added the ability to get to the IPv4/IPv6 socket port number from a 
ConnectionFileDescriptor instance if either file descriptor is a socket.

The ProcessKDP can now successfully connect to a remote kernel and detach
using the above "processs connect" command!!! So far we have the following
packets working:
    KDP_CONNECT
    KDP_DISCONNECT
    KDP_HOSTINFO
    KDP_VERSION
    KDP_REATTACH

Now that the packets are working, adding new packets will go very quickly.

llvm-svn: 135363
2011-07-17 20:36:25 +00:00
Johnny Chen 9ffc9f7a18 Have SWIG generate autodoc strings with parameter types for all SB API objects by default.
llvm-svn: 135357
2011-07-16 21:27:36 +00:00
Johnny Chen dc7d3c121b Create an interface file for SBTarget named SBTarget.i which relieves SBTarget.h
of the duty of having SWIG docstring features and multiline string literals
embedded within.

lldb.swig now %include .../SBTarget.i, instead of .../SBTarget.h.  Will create
other interface files and transition them over.

Also update modify-python-lldb.py to better handle the trailing blank line right
before the ending '"""' Python docstring delimiter.

llvm-svn: 135355
2011-07-16 21:15:39 +00:00
Peter Collingbourne bac7150db0 Add missing #include, fixes Linux build
llvm-svn: 135346
2011-07-16 15:58:57 +00:00
Greg Clayton 4df8ddfc97 Completed more work on the KDP darwin kernel debugging Process plug-in.
Implemented connect, disconnect, reattach, version, and hostinfo.

Modified the ConnectionFileDescriptor class to be able to handle UDP. 

Added a new Stream subclass called StreamBuffer that is backed by a
llvm::SmallVector for better efficiency.

Modified the DataExtractor class to have a static function that can
dump hex bytes into a stream. This is currently being used to dump incoming
binary packet data in the KDP plug-in.

llvm-svn: 135338
2011-07-16 03:19:08 +00:00
Enrico Granata 0c5ef693a2 Some descriptive text for the Python script feature:
- help type summary add now gives some hints on how to use it
frame variable and target variable now have a --no-summary-depth (-Y) option:
 - simply using -Y without an argument will skip one level of summaries, i.e.
   your aggregate types will expand their children and display no summary, even
   if they have one. children will behave normally
 - using -Y<int>, as in -Y4, -Y7, ..., will skip as many levels of summaries as
   given by the <int> parameter (obviously, -Y and -Y1 are the same thing). children
   beneath the given depth level will behave normally
 -Y0 is the same as omitting the --no-summary-depth parameter entirely
 This option replaces the defined-but-unimplemented --no-summary

llvm-svn: 135336
2011-07-16 01:22:04 +00:00
Sean Callanan c4ffe37cf1 Added support for dynamic detection of AVX, and
fixed a few bugs that revealed.  Now the "register
read" command should show AVX registers
(ymm0-ymm15) on Mac OS X platforms that support
them.

When testing this on Mac OS X, run debugserver
manually, like this:

debugserver --native-regs localhost:1111 /path/to/executable

Then

lldb /path/to/executable
...
(lldb) process connect connect://localhost:1111

llvm-svn: 135331
2011-07-16 00:49:19 +00:00
Enrico Granata 9dd75c8886 System-wide summaries:
- Summaries for char*, const char* and char[] are loaded at startup as
   system-wide summaries. This means you cannot delete them unless you use
   the -a option to type summary delete/clear
 - You can add your own system-wide summaries by using the -w option to type
   summary add
Several code improvements for the Python summaries feature

llvm-svn: 135326
2011-07-15 23:30:15 +00:00
Peter Collingbourne 6b917bb9b5 Fix gcc build error
llvm-svn: 135325
2011-07-15 23:22:49 +00:00
Johnny Chen 5819ab49fd Add TestValueAPI.py to exercise the newly added/modified SBValue APIs:
o GetChildAtIndex, and
o GetValueForExpressionPath

llvm-svn: 135315
2011-07-15 22:28:10 +00:00
Johnny Chen 135f63fb30 Add some more docstrings for SBCompileUnit and SBBreakpoint, plus incorporate the doxgen doc block of
SBValue::GetChildAtIndex(uint32_t idx, 
                         lldb::DynamicValueType use_dynamic,
                         bool can_create_synthetic);

into the SBValue docstrings.

llvm-svn: 135295
2011-07-15 20:46:19 +00:00
Greg Clayton f660248238 Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the 

SBValue
SBValue::GetChildAtIndex (uint32_t idx, 
                         DynamicValueType use_dynamic, 
                         bool can_create_synthetic);

The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:

int *foo_ptr = ...

And you have a SBValue that contains the value for "foo_ptr":

SBValue foo_value = ...

You can now get the "foo_ptr[12]" item by doing this:

v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);

Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.

Likewise if you have code like:

int array[2];

array_value = ....

v = array_value.GetChiltAtIndex (0);     // Success, v will be valid
v = array_value.GetChiltAtIndex (1);     // Success, v will be valid
v = array_value.GetChiltAtIndex (2);     // Fail, v won't be valid, "2" is not a valid zero based index in "array"

But if you use the ability to create synthetic children:

v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True);     // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True);     // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True);     // Success, v will be valid

llvm-svn: 135292
2011-07-15 19:31:49 +00:00
Greg Clayton 59ec512c46 Fixed the comment lines in the file comment headers.
llvm-svn: 135284
2011-07-15 18:02:58 +00:00
Greg Clayton 57508026c2 Added the ability to connect using "tcp://<host>:<port>" which is the
same as the old "connect://<host>:<port>". Also added the ability to
connect using "udp://<host>:<port>" which will open a connected 
datagram socket. I need to find a way to specify a non connected
datagram socket as well. 

We might need to start setting some settings in the URL itself, 
maybe something like:

udp://<host>:<port>?connected=yes
udp://<host>:<port>?connected=no

I am open to suggestions for URL settings.

Also did more work on the KDP darwin kernel plug-in.

 

llvm-svn: 135277
2011-07-15 16:31:38 +00:00
Greg Clayton f9765acddd Hollowed out process plug-in to do KDP darwin kernel debugging.
llvm-svn: 135240
2011-07-15 03:27:12 +00:00
Enrico Granata f2bbf717f7 Python summary strings:
- you can use a Python script to write a summary string for data-types, in one of
   three ways:
    -P option and typing the script a line at a time
    -s option and passing a one-line Python script
    -F option and passing the name of a Python function
   these options all work for the "type summary add" command
   your Python code (if provided through -P or -s) is wrapped in a function
   that accepts two parameters: valobj (a ValueObject) and dict (an LLDB
   internal dictionary object). if you use -F and give a function name,
   you're expected to define the function on your own and with the right
   prototype. your function, however defined, must return a Python string
 - test case for the Python summary feature
 - a few quirks:
  Python summaries cannot have names, and cannot use regex as type names
  both issues will be fixed ASAP
major redesign of type summary code:
 - type summary working with strings and type summary working with Python code
   are two classes, with a common base class SummaryFormat
 - SummaryFormat classes now are able to actively format objects rather than
   just aggregating data
 - cleaner code to print descriptions for summaries
the public API now exports a method to easily navigate a ValueObject hierarchy
New InputReaderEZ and PriorityPointerPair classes
Several minor fixes and improvements

llvm-svn: 135238
2011-07-15 02:26:42 +00:00
Johnny Chen 3d3a7cf563 Add usage docstring to SBValue.h, and minor update of docstrings for SBValueList.h.
llvm-svn: 135230
2011-07-15 00:27:47 +00:00
Johnny Chen e625325d9f Add usage docstrings to SBTarget, SBProcess, and SBThread.
llvm-svn: 135221
2011-07-14 23:56:51 +00:00
Johnny Chen b3f07c1959 Minor change of variable name, from m to b (for breakpoint).
llvm-svn: 135214
2011-07-14 23:33:34 +00:00
Johnny Chen 331eff3995 Fixed a crasher where entering 'help disasm' on the command line would crash lldb.
The reasom of the crash is because of a missing entry in the argument table corresponding to eArgTypeUnsignedInteger.
Add such entry and modify the call site of the crash to go through a fail-fast API to retrieve the argument table.

Add a regression test to TestHelp.py.

llvm-svn: 135206
2011-07-14 22:20:12 +00:00
Johnny Chen 4036b587df Add summary info for SBBreakpoint to the lldb module level docstring.
llvm-svn: 135194
2011-07-14 21:32:11 +00:00
Johnny Chen 993f2b6ccd Minor wording change.
llvm-svn: 135190
2011-07-14 21:23:24 +00:00
Johnny Chen e787813e16 Fix typo in ConnectRemote() docstring.
llvm-svn: 135188
2011-07-14 21:17:28 +00:00
Johnny Chen fa181f4fdb Add some more docstrings (includng example usages) to SBTarget.h.
Add logic to modify-python-lldb to correct swig's transformation of 'char **argv' and 'char **envp'
to 'char argv' and 'char envp' by morphing them into the 'list argv' and 'list envp' (as a list of
Python strings).

llvm-svn: 135114
2011-07-14 00:17:49 +00:00
Johnny Chen 3fe166dfd3 Add some more docstrings for SBTarget.
llvm-svn: 135108
2011-07-13 23:35:33 +00:00
Johnny Chen 97ef3fc5bf Use %feature("docstring") for methods of SBModule class so that the methods signature also gets generated in the Python docstring.
llvm-svn: 135105
2011-07-13 23:17:13 +00:00
Johnny Chen 13ea11afde Modify the test script to better handle the different inlining behaviors of
clang/gcc/llvm-gcc.  If the first breakpoint is due to stop at an inlined
frame, test that the call site corresponds to where it should be.  Also add
an expecr for a second break stop, if the first break stop corresponds to an
inlined call frame #0.

rdar://problem/9741470

llvm-svn: 135100
2011-07-13 22:34:29 +00:00
Johnny Chen 10d6ce494b Add @expectedFailure decorator for test_target_variable_command_with_dsym().
rdar://problem/9763907

llvm-svn: 135069
2011-07-13 20:03:51 +00:00
Johnny Chen 4c9c3ee08a Update docstrings for SBModeule/SBTarget::FindGlobalVariables().
llvm-svn: 135019
2011-07-13 00:46:49 +00:00
Johnny Chen 0d0dff4398 Add display of a static int variable to the test scenario.
llvm-svn: 135016
2011-07-13 00:31:31 +00:00
Enrico Granata 79dce0a66e fixing missing RefCounter class
llvm-svn: 135012
2011-07-13 00:00:57 +00:00
Johnny Chen af6e82f611 Add a test case to exercise 'target variable' command before and after running the inferior.
Currently it fails after the inferior is run.

rdar://problem/9763907

llvm-svn: 135009
2011-07-12 23:18:03 +00:00
Enrico Granata 10bc1e5452 test cases
llvm-svn: 135008
2011-07-12 22:57:47 +00:00
Enrico Granata f4efecd958 smarter summary strings:
- formats %s %char[] %c and %a now work to print 0-terminated c-strings if they are applied to a char* or char[] even without the [] operator (e.g. ${var%s})
 - array formats (char[], intN[], ..) now work when applied to an array of a scalar type even without the [] operator (e.g. ${var%int32_t[]})
LLDB will not crash because of endless loop when trying to obtain a summary for an object that has no value and references itself in its summary string
In many cases, a wrong summary string will now display an "<error>" message instead of giving out an empty string

llvm-svn: 135007
2011-07-12 22:56:10 +00:00
Johnny Chen ef1c6845ae Fix short description of 'target variable' command.
llvm-svn: 135005
2011-07-12 22:34:30 +00:00
Greg Clayton d16e1e596a Added the ability to _not_ skip the prologue when settings breakpoints
by name by adding an extra parameter to the lldb_private::Target breakpoint 
setting functions.

Added a function in the DWARF symbol file plug-in that can dump errors
and prints out which DWARF file the error is happening in so we can track
down what used to be assertions easily.

Fixed the MacOSX kernel plug-in to properly read the kext images and set
the kext breakpoint to watch for kexts as they are loaded.

llvm-svn: 134990
2011-07-12 17:06:17 +00:00
Jim Ingham a5a97ebe3c Added "command history" command to dump the command history.
Also made:
(lldb) !<NUM>
(lldb) !-<NUM>
(lldb) !!

work with the history.  For added benefit:

(lldb) !<NUM><TAB>

will insert the command at position <NUM> in the history into the command line to be edited.

This is only partial, I still need to sync up editline's history list with the one kept by the interpreter.

llvm-svn: 134955
2011-07-12 03:12:18 +00:00
Enrico Granata d62e57fbe4 test case for the named summaries feature
llvm-svn: 134944
2011-07-12 00:19:00 +00:00
Enrico Granata f9fa6ee5e3 named summaries:
- a new --name option for "type summary add" lets you give a name to a summary
 - a new --summary option for "frame variable" lets you bind a named summary to one or more variables
${var%s} now works for printing the value of 0-terminated CStrings
type format test case now tests for cascading
 - this is disabled on GCC because GCC may end up stripping typedef chains, basically breaking cascading
new design for the FormatNavigator class
new template class CleanUp2 meant to support cleanup routines with 1 additional parameter beyond resource handle

llvm-svn: 134943
2011-07-12 00:18:11 +00:00
Johnny Chen 1d3e880c2c Passing in os.ctermid() as the arg for SBTarget.Launch(...) for stdin_path, stdout_path, and stderr_path
is just wrong and resulted in the inferior's output getting mixed into the GDB remote communication's
log file.  Change all test cases to not pass os.ctermid() and either use SBTarget.LaunchSimple() or
SBTarget.Launch() and pass None as stdin_path/stdout_path/srderr_path to use a pseudo terminal.

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

llvm-svn: 134940
2011-07-11 23:38:23 +00:00
Johnny Chen 928f4ee26f Add missing docstring for 'bool stop_at_endtry'.
llvm-svn: 134924
2011-07-11 21:41:05 +00:00
Johnny Chen 9a07aba962 The lldbtest.TestBase.DebugSBValue(self, val) method call now does not need the frame argument.
Only the val (of SBValue type) argument is needed.

llvm-svn: 134915
2011-07-11 20:06:28 +00:00
Jim Ingham 54fcc89abd Mark the test with expectedFailure for now.
llvm-svn: 134914
2011-07-11 19:47:16 +00:00
Enrico Granata e06e828d53 rolling back previous commit; double fix made it wrong again
llvm-svn: 134912
2011-07-11 19:34:11 +00:00
Enrico Granata 8b0d1777f5 Prevent the test suite from failing all the time until this bug is fixed
llvm-svn: 134911
2011-07-11 19:31:01 +00:00
Johnny Chen 38b5371184 Mark as expected failure.
rdar://problem/9745789 "expression" can't call functions in class methods

llvm-svn: 134910
2011-07-11 19:30:18 +00:00
Johnny Chen 56b92a7b04 Update the test scenario for find_global_variables() to now start the inferior process
before issuing API calls to find the global variable and to get its value.

rdar://problem/9700873 has been updated to reflect the latest status.  The dwarf case
now does not seg fault if the inferior is not started; instead, for dwarf case, the
value retrieved from the global variable is None.

llvm-svn: 134909
2011-07-11 19:15:11 +00:00
Greg Clayton c749eb89ad Added the ability to see block variables when looking up addresses
with the "target modules lookup --address <addr>" command. The variable
ID's, names, types, location for the address, and declaration is
displayed.

This can really help with crash logs since we get, on MacOSX at least,
the registers for the thread that crashed so it is often possible to
figure out some of the variable contents. 

llvm-svn: 134886
2011-07-11 05:12:02 +00:00
Greg Clayton 45ba854399 Allow the built in ValueObject summary providers for C strings
use lldb_private::Target::ReadMemory(...) to allow constant strings
to be displayed in global variables prior on in between process
execution.

Centralized the variable declaration dumping into:

	bool
	Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module);

Fixed an issue if you used "target variable --regex <regex>" where the
variable name would not be displayed, but the regular expression would.

Fixed an issue when viewing global variables through "target variable"
might not display correctly when doing DWARF in object files.

llvm-svn: 134878
2011-07-10 19:21:23 +00:00
Greg Clayton dda0d1274e Fixed an assertion crasher. We now handle things correclty and
emit an error to stderr when we see this issue.

llvm-svn: 134872
2011-07-10 17:32:33 +00:00
Greg Clayton daf515fc8a Fixed the global and static variables to always be in scope.
Made it so that you can create synthetic children of array
value objects. This is for creating array members when the
array index is out of range. This comes in handy when you have
a structure definition like:

struct Collection
{
    uint32_t count;
    Item array[0];
};
"array" has 1 item, but many times in practice there are more
items in "item_array".

This allows you to do:

(lldb) target variable g_collection.array[3]

To implement this, the get child at index has been modified
to have a "ignore_array_bounds" boolean that can be set to true.

llvm-svn: 134846
2011-07-09 20:12:33 +00:00
Greg Clayton 5707d224e1 Limit the character array summary to 512 bytes.
llvm-svn: 134827
2011-07-09 17:17:07 +00:00
Greg Clayton ebf121b188 Fixed some const issues with args to some lldb_private::Target functions.
llvm-svn: 134826
2011-07-09 17:16:43 +00:00
Greg Clayton 374972eebd More cleanup on the this plug-in and tried to set the notification
breakpoint. I haven't been able to see this breakpoint get hit yet
so I still have testing I need to do with the kernel dynamic loader.

llvm-svn: 134825
2011-07-09 17:15:55 +00:00
Greg Clayton ed49aed3af Fixed an issue where we weren't zeroing out the type fully
thanks to a nice clang warning!

llvm-svn: 134824
2011-07-09 17:14:57 +00:00
Greg Clayton ef37d68a8a Fixed an issue with getting the size of an array from an opaque clang_type_t
variable where we were using a static cast when we shouldn't have been.
Fixed another array related issue where we weren't looking through a typedef.

llvm-svn: 134823
2011-07-09 17:12:27 +00:00
Jim Ingham b8e8a5f3ee Allow reading memory from files before the target has been run.
llvm-svn: 134780
2011-07-09 00:55:34 +00:00
Greg Clayton 9e00b6a654 Added the ability to get an abstract file type (executable, object file,
shared library, etc) and strata (user/kernel) from an object file. This will
help with plug-in and platform selection when given a new binary with the
"target create <file>" command.

llvm-svn: 134779
2011-07-09 00:41:34 +00:00
Johnny Chen 02a07299b7 Missed the char_to_str_xform on the docstrings for the module level function definitions.
llvm-svn: 134775
2011-07-08 23:57:20 +00:00
Johnny Chen 628d84005a Add rdar://problem/9747668 info for "target variable g_marked_spot.y" command.
llvm-svn: 134772
2011-07-08 23:38:39 +00:00
Johnny Chen 98a5ddd006 Add test scenarios for 'target variable' command into TestGlobalVariables.py file.
llvm-svn: 134771
2011-07-08 23:33:36 +00:00
Johnny Chen 07398b5d48 Add some comment.
llvm-svn: 134769
2011-07-08 23:07:53 +00:00
Johnny Chen 3a709ac7bf o TestEvents.py:
Add a usage example of SBEvent APIs.

o SBEvent.h and SBListener.h:

Add method docstrings for SBEvent.h and SBListener.h, and example usage of SBEvent into
the class docstring of SBEvent.

o lldb.swig:

Add typemap for SBEvent::SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len)
so that we can use, in Python, obj2 = lldb.SBEvent(0, "abc") to create an SBEvent.

llvm-svn: 134766
2011-07-08 23:02:33 +00:00
Greg Clayton 884fb69460 Added the ability to see global variables with a variable expression path so
you can do things like:

(lldb) target variable g_global.a
(lldb) target variable *g_global.ptr
(lldb) target variable g_global.ptr[1]

llvm-svn: 134745
2011-07-08 21:46:14 +00:00
Jim Ingham 576e96e0dc New test to check that we can call functions in static methods in ObjC.
llvm-svn: 134736
2011-07-08 20:48:47 +00:00
Jim Ingham 368c6301a2 remove errant parenthesis.
llvm-svn: 134717
2011-07-08 18:34:32 +00:00
Greg Clayton affb03b7fb Fixed a few issues where typedefs weren't passing through to the correct
recursive function.

Also fixed ClangASTContext::IsPointerType to correctly NULL out the pointee
handle if a valid one is provided.

llvm-svn: 134715
2011-07-08 18:27:39 +00:00
Jason Molenda d7298d3745 Rewrite get_kinfo_proc_for_pid() to get the kinfo_proc for
the one process we're interested in, instead of fetching all
of them and only keeping one.

(the old implementation made sense when we were doing the
initial find-this-process-by-pid-or-name by looking through
all the kinfo_procs.)

llvm-svn: 134686
2011-07-08 05:04:01 +00:00
Greg Clayton df0b7d5c31 LLDB now has a Kernel dynamic linker that can detect where kexts are
loaded. It locks onto *-apple-darwin binaries where the binary has
a "__KLD" segment. Soon I will modify the lldb_private::ObjectFile
class to return an executable type which will be an enum with values
something like:
eObjectFileTypeUserExectable,
eObjectFileTypeUserSharedLibrary,
eObjectFileTypeKernelExectable,
eObjectFileTypeKernelSharedLibrary,
eObjectFileTypeObjectFile,
eObjectFileTypeCoreFile

But for now we look at the section since a user and kernel mach-o
executable have the same mach-o file type.

llvm-svn: 134682
2011-07-08 04:11:42 +00:00
Greg Clayton 0d9fc764d2 Make the kernel able to do its initial load from target memory with the
process being preferred for all memory reads.

llvm-svn: 134681
2011-07-08 03:21:57 +00:00
Enrico Granata fc7a7f3b75 final fix for the global constructors issue
new GetValueForExpressionPath() method in ValueObject to navigate expression paths in a more bitfield vs slices aware way
changes to the varformats.html document (WIP)

llvm-svn: 134679
2011-07-08 02:51:01 +00:00
Johnny Chen f4e9a4c676 Rearranged the debug output to come before the assert for function name 'outer_inline'.
Right now clang-139 fails the test.

llvm-svn: 134673
2011-07-08 01:01:45 +00:00
Greg Clayton 7b242381b8 Added the start of the darwin dynamic loader plug-in. It isn't hooked up to
be detected yet, but most of the initial code is there and needs to be 
debugged more.

llvm-svn: 134672
2011-07-08 00:48:09 +00:00
Sean Callanan 77eaf442ce Audited the expression parser to find uninitialized
pointers.  Some of the spots are obviously initialized
later, but it's better just to NULL the pointers out
at initialization to make the code more robust when
exposed to later changes.

llvm-svn: 134670
2011-07-08 00:39:14 +00:00
Jason Molenda d9761cd466 Switch to using the S_ISDIR and S_ISREG sys/stat.h macros in
CommandCompletions.cpp and DataBufferMemoryMap.cpp.  The file type
part of the st_mode struct member is not a bitmask.

llvm-svn: 134669
2011-07-08 00:38:03 +00:00
Jason Molenda 4e0c94be76 Handle the possible case where the process launch failed
but we don't have an error message.

llvm-svn: 134662
2011-07-08 00:00:32 +00:00
Johnny Chen f4f54206d9 The Python API does not need SBEvent::BroadcasterMatchesPtr() when SBEvent::BroadcasterMatchesRef() suffices.
llvm-svn: 134659
2011-07-07 23:45:49 +00:00
Sean Callanan c6466fc9ab Added checks to the expresssion parser which make
searching for variables and symbols in the target
more robust.  These checks prevent variables from
being reported as existing if they cannot actually
be evaluated in the current context.

llvm-svn: 134656
2011-07-07 23:05:43 +00:00
Johnny Chen c182226dbc Add docstrings for SBSymbolContextList with example usage.
llvm-svn: 134652
2011-07-07 22:48:46 +00:00
Johnny Chen f8ae3c7396 Add assert to check the SBModule of SBSymbolContextList returned from SBTarget.FindFunctions().
llvm-svn: 134651
2011-07-07 22:45:54 +00:00
Johnny Chen 4bc80decfb Add test cases to exercise the SBTarget.FindFunctions() API.
llvm-svn: 134646
2011-07-07 22:22:51 +00:00
Johnny Chen b0b8be755b Add SBValue::GetID() member method call API.
llvm-svn: 134636
2011-07-07 20:46:23 +00:00
Johnny Chen 28597319fd Add docstrings for SBValueList with example usage.
llvm-svn: 134632
2011-07-07 20:23:22 +00:00
Johnny Chen c02a273ba6 Fix wording in docstring.
llvm-svn: 134623
2011-07-07 18:50:45 +00:00
Enrico Granata 7f941d95cc Fixed a warning where initializing CommandObject::g_arguments_data[] required global constructors
llvm-svn: 134613
2011-07-07 15:49:54 +00:00
Greg Clayton 1d4313b261 Stop the lldb_private::RegularExpression class from implicitly
constructing itself and causing unexpected things to happen
in LLDB.

llvm-svn: 134598
2011-07-07 04:49:07 +00:00
Greg Clayton 715c236577 Centralize the variable display prefs into a new option
group class: OptionGroupVariable. It gets initialized with
a boolean that indicates if the frame specific options are
included so that this can be used in both the "frame variable"
and "target variable" commands.

Removed the global functionality from the "frame variable" 
command. Users should switch to using the "target variable"
command.

llvm-svn: 134594
2011-07-07 04:38:25 +00:00
Jim Ingham c257270094 Typo in header doc.
llvm-svn: 134584
2011-07-07 02:22:51 +00:00
Greg Clayton 644247c1dc Added "target variable" command that allows introspection of global
variables prior to running your binary. Zero filled sections now get
section data correctly filled with zeroes when Target::ReadMemory
reads from the object file section data.

Added new option groups and option values for file lists. I still need
to hook up all of the options to "target variable" to allow more complete
introspection by file and shlib.

Added the ability for ValueObjectVariable objects to be created with
only the target as the execution context. This allows them to be read
from the object files through Target::ReadMemory(...). 

Added a "virtual Module * GetModule()" function to the ValueObject
class. By default it will look to the parent variable object and
return its module. The module is needed when we have global variables
that have file addresses (virtual addresses that are specific to
module object files) and in turn allows global variables to be displayed
prior to running.

Removed all of the unused proxy object support that bit rotted in 
lldb_private::Value.

Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
with the more efficient "FileSpec::Equal (lhs, rhs)".

Improved logging in GDB remote plug-in.

llvm-svn: 134579
2011-07-07 01:59:51 +00:00
Enrico Granata 8f11a4ac96 new webpage describing type command
llvm-svn: 134575
2011-07-07 00:39:55 +00:00
Enrico Granata 82a7d98342 new detailed descriptions for type summary add and type format add
some changes to the help system code for better display of long help text
-p and -r flags now also work for type format add

llvm-svn: 134574
2011-07-07 00:38:40 +00:00
Johnny Chen bd68b95889 Add class docstrings with example usage for SBBreakpoint and SBBreakpointLocation.
llvm-svn: 134571
2011-07-07 00:14:13 +00:00
Johnny Chen 1630367ea6 Add class docstrings with example usage for SBFunction and SBAddress.
llvm-svn: 134560
2011-07-06 23:23:53 +00:00
Johnny Chen 194cd7eb24 SWIG doesn't need two methods of the same name 'GetDescription' but differ in
the presence of 'const'.  Ifndef the non-const one out.

llvm-svn: 134553
2011-07-06 22:23:24 +00:00
Johnny Chen f82eb4043b Add fuzz calls for SBType::IsPointerType(void *opaque_type).
llvm-svn: 134551
2011-07-06 22:11:38 +00:00
Johnny Chen 102ac765f0 Add post-processing step to transform the docstring from 'char', i.e., 'char *', to 'str', i.e., Python string.
llvm-svn: 134543
2011-07-06 21:55:45 +00:00
Greg Clayton 58f1c12756 Revert some Xcode project changes that I didn't intend to checkin.
llvm-svn: 134541
2011-07-06 21:43:20 +00:00
Greg Clayton 9432989dd3 Bumped Xcode project version for lldb-68.
llvm-svn: 134534
2011-07-06 21:01:19 +00:00
Johnny Chen e58f332b8c Add docstrings for the primordial object -- SBDebugger.
The swig "autodoc" feature to remove '*' from 'char *' will be handled by doing
post-processing on the lldb.py module.

llvm-svn: 134524
2011-07-06 19:28:33 +00:00
Enrico Granata a7187d0000 bug fix in summary strings:
- ${*var[].something} was not working as expected
options -p and -r now also work for type format add

llvm-svn: 134523
2011-07-06 19:27:11 +00:00
Johnny Chen d4deaf2677 Remove unnecessary 'import' statement.
llvm-svn: 134519
2011-07-06 19:09:25 +00:00
Greg Clayton dd0649bc5f Fixed an issue that was causing us to crash when evaluating expressions for
objective C or C++ methods when "self" or "this" were in scope, but had 
invalid locations in a DWARF location list. The lack of a valid value caused
us to use an invalid type value and then we tried to import that invalid 
value and we would crash.

llvm-svn: 134518
2011-07-06 18:55:08 +00:00
Jim Ingham 89b6109be8 Set the EvaluationPoint's m_thread_id to the RIGHT invalid define...
llvm-svn: 134505
2011-07-06 17:42:14 +00:00
Greg Clayton 262f80df5e Made the string representation for a SBValue return what "frame variable"
would return instead of a less than helpful "name: '%s'" description.

Make sure that when we ask for the error from a ValueObject object we
first update the value if needed.

Cleaned up some SB functions to use internal functions and not re-call
through the public API when possible.

llvm-svn: 134497
2011-07-06 16:49:27 +00:00
Enrico Granata e443ba736b Fixed some format names
llvm-svn: 134492
2011-07-06 15:56:06 +00:00
Greg Clayton 34132754bd Fixed some issues with ARM backtraces by not processing any push/pop
instructions if they are conditional. Also fixed issues where the PC wasn't
getting bit zero stripped for ARM targets when a stack frame was thumb. We
now properly call through the GetOpcodeLoadAddress() functions to make sure
the addresses are properly stripped for any targets that may decorate up
their addresses.

We now don't pass the SIGSTOP signals along. We can revisit this soon, but
currently this was interfering with debugging some older ARM targets that
don't have vCont support in the GDB server.

llvm-svn: 134461
2011-07-06 04:07:21 +00:00
Enrico Granata 9fc1944ece new syntax for summary strings:
- ${*expr} now simply means to dereference expr before actually using it
 - bitfields, array ranges and pointer ranges now work in a (hopefully) more natural and language-compliant way
a new class TypeHierarchyNavigator replicates the behavior of the FormatManager in going through type hierarchies
when one-lining summary strings, children's summaries can be used as well as values

llvm-svn: 134458
2011-07-06 02:13:41 +00:00
Johnny Chen af51b1f709 Add a more verbose docstring for SBThread.h.
llvm-svn: 134452
2011-07-06 00:16:21 +00:00
Johnny Chen 491c3d72ac Add swig docstrings for SBBlock.h.
llvm-svn: 134451
2011-07-05 23:54:12 +00:00
Johnny Chen 34ed733c69 Add swig docstrings for SBModule.h, plus ifndef the SBModule::GetUUIDBytes() API out if swig.
Fix typos in the comment for Module.h.

llvm-svn: 134446
2011-07-05 22:03:36 +00:00
Johnny Chen bf868492b8 Add a more verbose docstring to the SBSymbolContext API class.
Add doxygen/docstring to SBProcess.RemoteAttachToProcessWithID() API method.

llvm-svn: 134437
2011-07-05 19:18:41 +00:00
Johnny Chen c201d8a999 Add a CLEANUP_DOCSTRING state to our FSM to do cleanup of the Python docstrings
generated from the swig docstring features instead of blindly applying the
cleanup action for all input lines.

llvm-svn: 134368
2011-07-03 19:55:50 +00:00
Johnny Chen b8f7603526 Add swig docstrings for SBFrame.h.
Add post-processing step to remove the trailing blank lines from the docstrings of lldb.py.

llvm-svn: 134360
2011-07-03 01:43:29 +00:00
Greg Clayton 0c51ac3295 When we use the "fd://%u" for file descriptors, we need to detect if this is
a file or socket. We now make a getsockopt call to check if the fd is a socket.

Also, the previous logic in the GDB communication needs to watch for success
with an error so we can deal with EAGAIN and other normal "retry" error codes.

llvm-svn: 134359
2011-07-02 23:21:06 +00:00
Greg Clayton 197bacfffa Cleanup errors that come out of commands and make sure they all have newlines
_only_ in the resulting stream, not in the error objects (lldb_private::Error).
lldb_private::Error objects should always just have an error string with no 
terminating newline characters or periods.

Fixed an issue with GDB remote packet detection that could end up deadlocking
if a full packet wasn't received in one chunk. Also modified the packet 
checking function to properly toss one or more bytes when it detects bad
data. 

llvm-svn: 134357
2011-07-02 21:07:54 +00:00
Peter Collingbourne f52f0502ca Fix Linux build errors
llvm-svn: 134347
2011-07-02 20:42:56 +00:00
Johnny Chen ed48137734 Refine the post-processing phase of lldb.py to remove some more doxygen/c++-comment residues.
llvm-svn: 134326
2011-07-02 20:01:09 +00:00
Johnny Chen 73a44f6b99 Furnish some docstrings to be swigified into the generated lldb.py module.
Especially SBProcess.ReadMemory() and SBProcess.WriteMemory() because the generated autodoc strings
make no sense for Python programmers due to typemap (see lldb.swig).

llvm-svn: 134301
2011-07-02 00:57:52 +00:00
Enrico Granata 6586310263 test cases for the new features just committed
llvm-svn: 134294
2011-07-02 00:27:11 +00:00
Enrico Granata 0a3958e046 several improvements to "type summary":
- type names can now be regular expressions (exact matching is done first, and is faster)
 - integral (and floating) types can be printed as bitfields, i.e. ${var[low-high]} will extract bits low thru high of the value and print them
 - array subscripts are supported, both for arrays and for pointers. the syntax is ${*var[low-high]}, or ${*var[]} to print the whole array (the latter only works for statically sized arrays)
 - summary is now printed by default when a summary string references a variable. if that variable's type has no summary, value is printed instead. to force value, you can use %V as a format specifier
 - basic support for ObjectiveC:
  - ObjectiveC inheritance chains are now walked through
  - %@ can be specified as a summary format, to print the ObjectiveC runtime description for an object
 - some bug fixes

llvm-svn: 134293
2011-07-02 00:25:22 +00:00
Johnny Chen 4bbbecfb8c SWIG doesn't need two methods of the same name 'GetDescription' but differ in
the presence of 'const'.  Ifndef the non-const one out.

llvm-svn: 134284
2011-07-01 22:45:43 +00:00
Johnny Chen b9a2c32219 Add some documentation blocks to SBTarget.h and use swig docstring feature to
take advantage of them.  Update modify-python-lldb.py to remove some 'residues'
resulting from swigification.

llvm-svn: 134269
2011-07-01 22:14:07 +00:00
Johnny Chen 61abb2aea7 Add docstrings for some API classes and auto-generates docstrings for the methods of them.
A few of the auto-generated method docstrings don't look right, and may need to be fixed
by either overwriting the auto-gened docstrings or some post-processing steps.

llvm-svn: 134246
2011-07-01 18:39:47 +00:00
Greg Clayton 1d55f1b936 Bump Xcode project version to lldb-66 and debugserver-141.
llvm-svn: 134232
2011-07-01 04:31:33 +00:00
Greg Clayton 460c77a278 Useless Xcode project change that Xcode keeps wanting to add to my project so
I am giving up the fight...

llvm-svn: 134230
2011-07-01 03:43:03 +00:00
Johnny Chen ee481783cb Add module docstring to the auto-generated lldb.py file.
llvm-svn: 134192
2011-06-30 21:29:50 +00:00
Johnny Chen cc76475fff Ifdef out the 'lldb::Encoding GetEncoding(uint32_t &count)' API from
Python SWIG, since it cannot hanlde the (uint32_t &count) parameter.

llvm-svn: 134176
2011-06-30 18:40:27 +00:00
Jason Molenda a049469c5b Restructure to be modular instead of a single big function;
should make it a little easier to use this as an example of
how to fetch all the different bits of information about
threads.

llvm-svn: 134135
2011-06-30 07:25:17 +00:00
Greg Clayton e305594277 Centralize all of the type name code so that we always strip the leading
"struct ", "class ", and "union " from the start of any type names that are
extracted from clang QualType objects. I had to fix test suite cases that
were expecting the struct/union/class prefix to be there.

llvm-svn: 134132
2011-06-30 02:28:26 +00:00
Johnny Chen 086b1b774e While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API within
the find_global_variables() test method.

Skipping test_find_global_variables_with_dwarf(self) due to segmentation fault.

llvm-svn: 134118
2011-06-30 00:24:31 +00:00
Johnny Chen 466c593912 Add test cases to TestTargetAPI.py to exercise the newly added SBTarget.FindGlobalVariables() API.
llvm-svn: 134109
2011-06-29 22:45:06 +00:00
Enrico Granata 4becb37e34 This commit adds a new top subcommand "summary" to command type named "type". Currently this command
implements three commands:

type summary add <format> <typename1> [<typename2> ...]
type summary delete <typename1> [<typename2> ...]
type summary list [<typename1> [<typename2>] ...]
type summary clear

This allows you to specify the default format that will be used to display
summaries for variables, shown when you use "frame variable" or "expression", or the SBValue classes.

Examples:
type summary add "x = ${var.x}" Point

type summary list

type summary add --one-liner SimpleType

llvm-svn: 134108
2011-06-29 22:27:15 +00:00
Johnny Chen d1ef780bb3 Add fuzz calls for SBModule/SBTarget.FindGlobalVariables(...).
llvm-svn: 134107
2011-06-29 22:26:59 +00:00
Greg Clayton dea8cb4fe3 Added support for finding and global variables in the SBTarget and SBModule
level in the public API. 

Also modified the ValueObject values to be able to display global variables
without having a valid running process. The globals will read themselves from
the object file section data if there is no process, and from the process if
there is one.

Also fixed an issue where modifications for dynamic types could cause child
values of ValueObjects to not show up if the value was unable to evaluate
itself (children of NULL pointer objects).

llvm-svn: 134102
2011-06-29 22:09:02 +00:00
Johnny Chen 8bae20f7f7 Add fuzz calls for SBTypeMember.
llvm-svn: 134098
2011-06-29 21:42:46 +00:00
Johnny Chen 6999f86617 Add fuzz calls to SBType, SBValue, and SBValueList.
Fixed crashes for SBValue fuzz calls.
And change 'bool SBType::IsPointerType(void)' to
'bool SBType::IsAPointerType(void)' to avoid name collision with the static 'bool SBType::IsPointerType(void *)'
function, which SWIG cannot handle.

llvm-svn: 134096
2011-06-29 21:19:39 +00:00
Jim Ingham 20c771998b Remove a few more places where we were iterating linearly over the Breakpoint Site's rather than
looking up what we needed by address, which is much faster.

llvm-svn: 134090
2011-06-29 19:42:28 +00:00
Greg Clayton 626f4a13e3 Fixed an issue that was checked in with the dynamic types and update point
changes that caused all SBValue objects to completely ignore the target
lock due to bad C++ scoping of the target Mutex::Locker variables.

llvm-svn: 134081
2011-06-29 18:28:50 +00:00
Enrico Granata 595ca06397 just a test for commit access - ignore this
llvm-svn: 134056
2011-06-29 04:18:11 +00:00
Johnny Chen 8ebed74e6e Add fuzz calls for SBTarget and SBThread.
llvm-svn: 134046
2011-06-29 00:05:40 +00:00
Johnny Chen c74ed6b0de Add fuzz calls for SBSymbol and SBSymbolContext.
llvm-svn: 134042
2011-06-28 23:38:38 +00:00
Johnny Chen dedd7d6ed6 Add fuzz calls for SBStringList and add obj.Clear() calls for some files.
llvm-svn: 134040
2011-06-28 23:29:14 +00:00
Johnny Chen a25bf6efb5 Add fuzz calls for SBModule and SBProcess.
llvm-svn: 134037
2011-06-28 22:32:15 +00:00
Johnny Chen 4e77f6f499 Add fuzz calls for SBListener.
llvm-svn: 134029
2011-06-28 20:57:22 +00:00
Johnny Chen 520eeff0ef Add fuzz calls for SBLineEntry.
llvm-svn: 134028
2011-06-28 20:46:03 +00:00
Johnny Chen 6638174378 Add @expectedFailure for TestCallStdStringFunction.py (radar was filed) and
remove @expectedFailure from TestObjCMethods.py's print_ivars_correctly()
function (it has been passing for a while).

llvm-svn: 134022
2011-06-28 19:39:19 +00:00
Johnny Chen 6f306a4859 Add fuzz calls for SBInstruction and SBInstructionList.
llvm-svn: 134020
2011-06-28 19:07:02 +00:00
Greg Clayton b10d72f019 Remove the disassembly option: "eOptionShowCurrentLine" and replaced it with
two:

eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
eOptionMarkPCAddress    = (1u << 3)  // Mark the disassembly line the contains the PC

This allows mixed mode to show the line that contains the current PC, and it
allows us to mark the PC address in the disassembly if desired. Having these
be separate gives more control on the disassembly output. SBFrame::Disassemble()
doesn't enable any of these options.

llvm-svn: 134019
2011-06-28 19:01:40 +00:00
Johnny Chen 24c5296957 Add fuzz calls for SBInputReader.
llvm-svn: 133972
2011-06-28 00:12:06 +00:00
Johnny Chen 40e978f7b3 Add fuzz calls for SBFrame and SBFunction.
llvm-svn: 133965
2011-06-27 23:53:55 +00:00
Johnny Chen d982f039a1 Add fuzz calls for SBFileSpec.
llvm-svn: 133956
2011-06-27 22:55:51 +00:00
Johnny Chen 71eabde2f8 Add fuzz calls for SBEvent.
llvm-svn: 133954
2011-06-27 22:38:57 +00:00
Johnny Chen 098863c45c Move to plevel dirs stop-hook, target, process_launch, and signal to reside under functionalities.
Rename target dir to target_command.

llvm-svn: 133951
2011-06-27 22:10:42 +00:00
Johnny Chen eb5a433514 Move top level recurse dir to reside under lang/c.
llvm-svn: 133950
2011-06-27 21:57:58 +00:00
Johnny Chen 1f762d315c Move top level inlines dir to reside under lang/c.
llvm-svn: 133949
2011-06-27 21:55:59 +00:00
Johnny Chen d1a075d21a Add comments and print output for selected thread under trace mode.
llvm-svn: 133947
2011-06-27 21:52:46 +00:00
Johnny Chen 89109ed13c Add TestPrintObj.py to go with lang/objc/print-objc, which:
Test "print object" where another thread blocks the print object from making progress.

Set a breakpoint on the line in my_pthread_routine.  Then switch threads
to the main thread, and do print the lock_me object.  Since that will
try to get the lock already gotten by my_pthread_routime thread, it will
have to switch to running all threads, and that should then succeed.

llvm-svn: 133933
2011-06-27 20:05:23 +00:00
Johnny Chen 1e256d2ac6 Simplified Makefile.
llvm-svn: 133921
2011-06-27 18:32:19 +00:00
Johnny Chen 43730185e0 Move sample objc program to reside under lang/objc.
llvm-svn: 133920
2011-06-27 18:30:03 +00:00
Johnny Chen fd70999bb4 Move top level test dirs platform and inferior-crashing to reside under functionalities and order to reside under macosx.
llvm-svn: 133919
2011-06-27 18:25:00 +00:00
Johnny Chen 85f21f2029 Move top level test dirs inlined_breakpoints, load_unload, and embedded_interpreter to reside under functionalities.
llvm-svn: 133918
2011-06-27 18:17:24 +00:00
Johnny Chen 2027e2af21 Move more top level test dirs to reside under functionalities dir.
llvm-svn: 133894
2011-06-26 21:36:28 +00:00
Johnny Chen 1429bcb330 A couple of directory renamings; get rid of 'tests' from the directory names.
llvm-svn: 133893
2011-06-26 21:27:27 +00:00
Johnny Chen 436975b26c Move some top level directories to reside under functionalities dir.
llvm-svn: 133892
2011-06-26 21:24:46 +00:00
Johnny Chen a9dd83be4b Move hello_world to now reside under python_api dir.
llvm-svn: 133890
2011-06-26 20:59:36 +00:00
Johnny Chen 4ad8edd10f Simplified the test cases, before moving the file to reside under python_api dir.
llvm-svn: 133889
2011-06-26 20:48:37 +00:00
Johnny Chen 8d798eb3c6 Move struct_types, stepping, and set_values dirs to now reside under lang/c.
Move stl dir to now reside under lang/cpp.

llvm-svn: 133884
2011-06-25 21:07:03 +00:00
Johnny Chen 23beac3368 Move global_variables dir to lang/c and foundation dir to lang/objc.
llvm-svn: 133883
2011-06-25 20:55:22 +00:00
Johnny Chen 04d9e8323e Move test dirs forward and function_types to now reside under lang/c.
llvm-svn: 133882
2011-06-25 20:49:06 +00:00
Johnny Chen fb8cd3712a Move some directories to now reside under lang/c or lang/cpp.
llvm-svn: 133881
2011-06-25 20:43:57 +00:00
Johnny Chen 6684b1e19a Move enum_types to now reside under lang/c.
llvm-svn: 133880
2011-06-25 20:29:41 +00:00
Johnny Chen 30a6a1e365 Move namespace directory to now reside under lang/cpp.
llvm-svn: 133879
2011-06-25 20:21:10 +00:00
Johnny Chen 91b6b77795 Move C++-related test directories to now reside under lang.
llvm-svn: 133878
2011-06-25 20:19:47 +00:00
Johnny Chen 33e89de95a Move objc-related test directories to now reside under lang/objc.
llvm-svn: 133877
2011-06-25 20:16:38 +00:00
Johnny Chen 53af50ac56 Start moving things around to have a more hierarchical directory structure.
llvm-svn: 133876
2011-06-25 20:07:20 +00:00
Greg Clayton 1ba7c4d01e Bumped Xcode project versions to lldb-65 and debugserver-140.
llvm-svn: 133865
2011-06-25 04:35:01 +00:00
Jason Molenda d8a2aaa472 Add support for a QEnvironmentHexEncoded packet which takes its
arguments in hex-encoded form instead of the old QEnvironment packet
which takes them as plain-text strings.  Environment variables
containing remote protocol special chars like '#' would fail to set
with QEnvironment.

llvm-svn: 133857
2011-06-25 01:55:21 +00:00
Greg Clayton a2721476e7 This commit adds broad architectural support for hierarchical
inspection of namespaces in the expression parser.

ClangExpressionDeclMap hitherto reported that namespaces had
been completely imported, even though the namespaces are
returned empty.  To deal with this situation, ClangASTSource
was recently extended with an API to complete incomplete type
definitions, and, for greater efficiency, to complete these
definitions partially, returning only those objects that have
a given name.

This commit supports these APIs on LLDB's side, and uses it
to provide information on types resident in namespaces.
Namespaces are now imported as they were -- that is to say,
empty -- but with minimal import mode on.  This means that
Clang will come back and request their contents by name as
needed.  We now respond with information on the contained
types; this will be followed soon by information on functions
and variables.

llvm-svn: 133852
2011-06-25 00:44:06 +00:00
Johnny Chen 06657625b8 Add fuzz calls for SBError.
llvm-svn: 133850
2011-06-25 00:21:00 +00:00
Johnny Chen 3c7a726a6d Add fuzz calls for SBDebugger.
llvm-svn: 133848
2011-06-25 00:09:29 +00:00
Johnny Chen a81d2af5bc Add fuzz calls for SBCompileUnit.
llvm-svn: 133843
2011-06-24 23:33:03 +00:00
Johnny Chen 6e3dfa6025 Add fuzz calls for SBCommunication.
llvm-svn: 133839
2011-06-24 23:16:27 +00:00
Johnny Chen 57e34b21db Add fuzz calls for SBBroadcaster.
llvm-svn: 133837
2011-06-24 22:53:12 +00:00
Johnny Chen cbdfe81171 Compute svn_info for git-svn bridge, too.
llvm-svn: 133836
2011-06-24 22:52:05 +00:00
Greg Clayton f58c269aa1 Removed an member variable "m_local_debugserver" that is no longer needed.
We now check with the platform to see if we are doing local or remote 
debugging and setup the stdio accordingly.

llvm-svn: 133835
2011-06-24 22:32:10 +00:00
Greg Clayton 5fd05903d4 Cleanup error output on expressions.
llvm-svn: 133834
2011-06-24 22:31:10 +00:00
Jim Ingham d555bacca3 Add support for looking up ivar offset from the ObjC runtime.
llvm-svn: 133831
2011-06-24 22:03:24 +00:00
Johnny Chen b5491a6e60 Add fuzz calls for SBBreakpointLocation.
llvm-svn: 133810
2011-06-24 19:00:22 +00:00
Johnny Chen 1bd3d731d9 Add fuzz calls for SBBreakpoint.
llvm-svn: 133809
2011-06-24 18:49:27 +00:00
Greg Clayton 17cc8b9d88 Remove an assertion and replace with safe code that emits a warning.
llvm-svn: 133786
2011-06-24 03:47:23 +00:00
Greg Clayton 0c74e78d63 Fixed SBTarget attach calls to properly deal with being connected to a remotely
connected process connection.

Also added support for more kinds of continue packet when multiple threads
need to continue where some want to continue with signals.

llvm-svn: 133785
2011-06-24 03:21:43 +00:00
Peter Collingbourne 44c9b3758f ++ cannot be used to increment an enum, so do it another way
llvm-svn: 133781
2011-06-24 01:12:22 +00:00
Johnny Chen 2f675dcb39 Add fuzz calls for SBBlock.
llvm-svn: 133780
2011-06-24 00:21:36 +00:00
Johnny Chen 4d1f660ace Start adding API calls to the invalid SB API object after default construction.
It should not crash lldb.

This checkin adds calls for SBAddress.

llvm-svn: 133778
2011-06-24 00:06:53 +00:00
Johnny Chen 9d2f340249 Add an initial test file for the newly added data formatter command.
main.cpp is contributed from Enrico.

Modify CommandObjectType.cpp to set status on the CommandReturnObject when succeeded as well.

llvm-svn: 133772
2011-06-23 23:14:10 +00:00
Johnny Chen b7373c92e6 o lldbtest.py:
Assign the test method name to self.testMethodName.  This can be useful for the
test directory (see test/types for a good example) which houses a bunch of executables
compiled from different source files.  The default build action is to create a.out as
the binary executable, which can confuse the module cacheing mechanism and result in
the debugger getting a stale image as the target to be debugged, and chaos ensues.

o AbstractBase.py, TestThreadAPI.py:

Use self.testMethodName to our advantage.

o TestLoadUnload.py:

Add expected failure marker to test case test_modules_search_paths().

llvm-svn: 133768
2011-06-23 22:11:20 +00:00
Greg Clayton bb7f31fa29 Centralized all of the format to c-string and to format character code inside
the FormatManager class. Modified the format arguments in any commands to be
able to use a single character format, or a full format name, or a partial 
format name if no full format names match.

Modified any code that was displaying formats to use the new FormatManager
calls so that our help text and errors never get out of date.

Modified the display of the "type format list" command to be a bit more
human readable by showing the format as a format string rather than the single
character format char.

llvm-svn: 133765
2011-06-23 21:22:24 +00:00
Johnny Chen 02028fa190 For now, use 'b.out' compiled from main2.cpp as the executable name for test_run_to_address_with_dsym/dwarf()
to distinguish between other test cases which use 'a.out' compiled from main.cpp.

llvm-svn: 133764
2011-06-23 21:22:01 +00:00
Peter Collingbourne 08405b69e8 Fix header paths
llvm-svn: 133755
2011-06-23 20:37:26 +00:00
Johnny Chen 4acd7b4936 Refactorings of the test/types directory to more elegantly express the uniqueness of
executable names given to each test method.

llvm-svn: 133749
2011-06-23 20:10:23 +00:00
Charles Davis 402491558b Fix typo spotted by Elias Pipping.
llvm-svn: 133744
2011-06-23 18:47:17 +00:00
Greg Clayton f60f375250 Another patch from Enrico Granata.
Added a fix for where you might have already displayed something with a given
type, then did a "type format add ...", then you display the type again. This
patch will figure out that the format changed and allow us to display the
type with the correct new format.

llvm-svn: 133743
2011-06-23 18:38:25 +00:00