History log of /external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4b93aee16f3a81aaf18114c88cc52482262035f3 30-Jul-2013 Michael Sartain <mikesart@valvesoftware.com> Add format specifiers to various format ids so we can print thread ids in decimal on Linux and FreeBSD.

CC: emaste

Differential Revision: http://llvm-reviews.chandlerc.com/D1234

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b9d995d0863e1860c12c4ace0d5eb0ba832f9c99 09-Jul-2013 Enrico Granata <egranata@apple.com> Second attempt at getting the PyCallable changes in trunk

Thanks to Daniel Malea for helping test this patch for Linux happiness!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
26bc105b1882a78de609d46d148ad2b5c4d50656 03-Jul-2013 Daniel Malea <daniel.malea@intel.com> Revert commits that cause broken builds on GCC buildbots
- build fails due to PyCallable template definition inside an extern "C" scope

This commit reverts 185240, 184893 and 184608.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
9c9a7bf57d081271c7e971decfe221561a920bcd 26-Jun-2013 Enrico Granata <egranata@apple.com> <rdar://problem/14266411>

The semi-unofficial way of returning a status from a Python command was to return a string (e.g. return "no such variable was found") that LLDB would pick as a clue of an error having happened

This checkin changes that:
- SBCommandReturnObject now exports a SetError() call, which can take an SBError or a plain C-string
- script commands now drop any return value and expect the SBCommandReturnObject ("return object") to be filled in appropriately - if you do nothing, a success will be assumed

If your commands were relying on returning a value and having LLDB pick that up as an error, please change your commands to SetError() through the return object or expect changes in behavior



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
001cd53e9d8d9e481ada536924ea7563b84ee9cf 21-Jun-2013 Enrico Granata <egranata@apple.com> In thread and frame format strings, it is now allowed to use Python functions to generate part or all of the output text
Specifically, the ${target ${process ${thread and ${frame specifiers have been extended to allow a subkeyword .script:<fctName> (e.g. ${frame.script:FooFunction})
The functions are prototyped as

def FooFunction(Object,unused)

where object is of the respective SB-type (SBTarget for target.script, ... and so on)

This has not been implemented for ${var because it would be akin to a Python summary which is already well-defined in LLDB



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
aba2527533d410640b435ba365c3e991c6629620 19-Jun-2013 Enrico Granata <egranata@apple.com> Improvements to "command script import" to better support reloading in Xcode

Xcode spawns a new LLDB SBDebugger for each debug session, and this was causing the reloading of python modules to fail across debug sessions

(long story short: the module would not be loaded in the current instance of the ScriptInterpreter, but would still be present in sys.modules, hence the import call would just make a copy of it and not run it again
Greg's new decorator uncovered the issue since it relies on actually loading the module's code rather than using __lldb_init_module as the active entity)

This patch introduces the notion of a local vs. global import and crafts an appropriate command to allow reloading to work across debug sessions



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
81471a294b082420c0327aeed6be4f7cb107c3f3 18-Jun-2013 Enrico Granata <egranata@apple.com> <rdar://problem/13926101>

Allow “command script import” to work with folder names that have a ‘ (tick) in them

Kudos to StackOverflow (question 1494399) for the replace_all code!

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8b9e96924885f49e6a74a1432d4d71a73c080866 11-Jun-2013 Enrico Granata <egranata@apple.com> Making our Python decrefs NULL-safe



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
66068824402d94de2abe81c7e4472a4754572489 31-May-2013 Enrico Granata <egranata@apple.com> <rdar://problem/11109316>

command script import now does reloads - for real
If you invoke command script import foo and it detects that foo has already been imported, it will
- invoke reload(foo) to reload the module in Python
- re-invoke foo.__lldb_init_module
This second step is necessary to ensure that LLDB does not keep cached copies of any formatter, command, ... that the module is providing

Usual caveats with Python imports persist. Among these:
- if you have objects lurking around, reloading the module won't magically update them to reflect changes
- if module A imports module B, reloading A won't reload B
These are Python-specific issues independent of LLDB that would require more extensive design work

The --allow-reload (-r) option is maintained for compatibility with existing scripts, but is clearly documented as redundant - reloading is always enabled whether you use it or not



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7de74f933e207fcb5d7fba72f7f1e4c99f97b0a9 16-May-2013 Enrico Granata <egranata@apple.com> <rdar://problem/11158023>

Make type summary add and breakpoint command add show an helpful prototype + argument reference when manually typing Python code for these elements

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
edeed2de0703606ef7d7a98c34e4059e505d0923 08-May-2013 Enrico Granata <egranata@apple.com> Test case added for importing packages



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6b2d9e1a76b55e958a7c606d1f9b51d966d8fa30 08-May-2013 Enrico Granata <egranata@apple.com> Improvements to the package importing feature - test case will follow



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7d18ec6bd5dbac01b9279c55e47b4a22e2679b87 03-May-2013 Ashok Thirumurthi <ashok.thirumurthi@intel.com> Fixed 'command script import' by eliminating the shadowing of basename.

Reviewed by: Daniel Malea


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
00a8278f15e9cccd32834c1db0adb384412e1449 03-May-2013 Enrico Granata <egranata@apple.com> <rdar://problem/11558812>

Allow command script import to load packages.

e.g.:
egranata$ ./lldb
(lldb) command script import lldb.macosx.crashlog
"crashlog" and "save_crashlog" command installed, use the "--help" option for detailed help
"malloc_info", "ptr_refs", "cstr_refs", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.
The "unwind-diagnose" command has been installed, type "help unwind-diagnose" for detailed help.
(lldb)

./lldb
(lldb) command script import theFoo
I am happy
(lldb) fbc
àèìòù
(lldb)

egranata$ ls theFoo/
__init__.py theBar.py

egranata$ cat theFoo/__init__.py
import lldb
import theBar

def __lldb_init_module(debugger, internal_dict):
print "I am happy"
debugger.HandleCommand("command script add -f theFoo.theBar.theCommand fbc")
return None

egranata$ cat theFoo/theBar.py
#encoding=utf-8

def theCommand(debugger, command, result, internal_dict):
result.PutCString(u"àèìòù")
return None



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2a91bebd40287943def1858c4924db471126ea52 29-Apr-2013 Enrico Granata <egranata@apple.com> Avoiding a potentially memory allocating code path in the Python InputReader's CTRL+C handling code path - this can potentially cause a deadlock while interrupting a user-made Python command

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
102b2c2681c9a830afe25bfea35557421905e42c 19-Apr-2013 Greg Clayton <gclayton@apple.com> After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
81a96aa6242f7b559770f5dc62316253cb8cb0d4 18-Apr-2013 Greg Clayton <gclayton@apple.com> Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.

Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
952e9dc874944fcdbbb224f3ec4fc2c859376f64 28-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13521159>

LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down.

All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
1414aba4ae30f89c2513bdbbb56c281cec014902 27-Mar-2013 Enrico Granata <egranata@apple.com> Implementing the notion of externally-acquirable ScriptInterpreter lock
With this notion, if parties outside the ScriptInterpreter itself need to acquire a lock on script APIs, they can do so by a pattern like this:

{
auto lock = interpeter->AcquireInterpreterLock();
// do whatever you need to do...
} // lock will automatically be released here

This might be useful for classes that use the Python convenience objects (e.g. PythonDictionary) to ensure they keep the underlying interpreter in a safe and controlled condition while they call through the C API functions
Of course, the ScriptInterpreter still manages its internal locking correctly when necessary :-)

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
cba09f60618744e2155bc97c9049fa9c797698ad 19-Mar-2013 Enrico Granata <egranata@apple.com> This checkin removes the last Cocoa formatters that were implemented in Python and reimplements them in C++. The Python Cocoa formatters are not shipped as part of LLDB anymore, but still exist in the source repository for user reference. Python formatters still exist for STL classes and users can still define their own Python formatters

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
36da2aa6dc5ad9994b638ed09eb81c44cc05540b 25-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13069948>

Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
52ebc0aab1fdecb634801deceeddd71a14c2148c 19-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13010007>

Added the ability for OS plug-ins to lazily populate the thread this. The python OS plug-in classes can now implement the following method:

class OperatingSystemPlugin:
def create_thread(self, tid, context):
# Return a dictionary for a new thread to create it on demand

This will add a new thread to the thread list if it doesn't already exist. The example code in lldb/examples/python/operating_system.py has been updated to show how this call us used.

Cleaned up the code in PythonDataObjects.cpp/h:
- renamed all classes that started with PythonData* to be Python*.
- renamed PythonArray to PythonList. Cleaned up the code to use inheritance where
- Centralized the code that does ref counting in the PythonObject class to a single function.
- Made the "bool PythonObject::Reset(PyObject *)" function be virtual so each subclass can correctly check to ensure a PyObject is of the right type before adopting the object.
- Cleaned up all APIs and added new constructors for the Python* classes to they can all construct form:
- PyObject *
- const PythonObject &
- const lldb::ScriptInterpreterObjectSP &

Cleaned up code in ScriptInterpreterPython:
- Made calling python functions safer by templatizing the production of value formats. Python specifies the value formats based on built in C types (long, long long, etc), and code often uses typedefs for uint32_t, uint64_t, etc when passing arguments down to python. We will now always produce correct value formats as the templatized code will "do the right thing" all the time.
- Fixed issues with the ScriptInterpreterPython::Locker where entering the session and leaving the session had a bunch of issues that could cause the "lldb" module globals lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame to not be initialized.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
ec1e823a9eb7ce4205a254210f633aa894fd612a 16-Jan-2013 Greg Clayton <gclayton@apple.com> Remove std::string input arguments and replace with "const char *".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
0d5d570314a4a37f9c2f45b8b8d7099d6bd85538 08-Jan-2013 Enrico Granata <egranata@apple.com> Make sure that the GenerateFunction call can support arbitrary levels of indentation for user code



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
559bb5cacf6777cf1ad8ee32256585d049123332 20-Dec-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12446222>

Implement the ability for Python commands to be interrupted by pressing CTRL+C
Also add a new Mutex subclass that attempts to be helpful for debugging by logging actions performed on it

FYI of all interested - there is a separate deadlocking issue related to how LLDB dispatches CTRL+C that might cause LLDB to deadlock upon pressing CTRL+C while in a Python command.
This is not a regression, and was just previously masked by us not even trying to bail out of Python commands, so that it would not be clear from a user perspective whether we were
deadlocked or stuck in an inconsistent state within the Python interpreter.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
1dba077021d06844b4713932b994e1fb70f47f24 08-Dec-2012 Jim Ingham <jingham@apple.com> Even when we aren’t going to init all the lldb.frame, etc, globals, init lldb.debugger, since each script interpreter is tied to just one debugger.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
d35b7b3bfd21f4fd6b048693563eef1b772ae197 07-Dec-2012 Daniel Malea <daniel.malea@intel.com> More Linux warnings fixes (remove default labels as needed):
- as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Patch by Matt Kopec!




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
14e71ecd9b05d3dff6e7dc3bf3148b4ad5e3989a 07-Dec-2012 Jim Ingham <jingham@apple.com> Separate initing the stdout/stderr for running the Python Script interpreter from initing the lldb.target/frame/etc globals,
and only do the latter when it makes sense to.

<rdar://problem/12554049>

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3e1d95d519fa062fef93323f37fb4c516894dd83 03-Dec-2012 Sean Callanan <scallanan@apple.com> Fixed a crash in which we examined the extension of
a file name, whether the file name had an extension
or not.

<rdar://problem/12793152>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
9ac7ce312ef8b5327a74d38edf10af86c07586b9 30-Nov-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12676084> Dump the traceback when a Python error occurs in "command script import" and the exception is not an ImportError



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5f35a4be95aed0e5b2cb36f7d785bcbfc67284ae 29-Nov-2012 Daniel Malea <daniel.malea@intel.com> Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6cc99d2321447d895bedb0102d136bbd0fcf8963 13-Nov-2012 Enrico Granata <egranata@apple.com> Giving at least some error information when a Python exception happens during command script import

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6f58bbd1473279158f10504ebbd0b5696cf953f9 08-Nov-2012 Enrico Granata <egranata@apple.com> Adding support for loading the scripting resource as part of a framework, lacking the dSYM bundle, or if the bundle has no Pythonic resources whatsoever
Solving an issue where "command script import" would fail to pick the file indicated by the user as a result of something with the same name being in an earlier position in sys.path



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
eeabe815b3d36b69b4666fbbce78a4bf950de3cc 01-Nov-2012 Greg Clayton <gclayton@apple.com> Get rid of hack by making the actual call public. This was causing the lldb-platform to not be able to link.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
fd670c24e72a1425434020483689c3cb17f0d975 31-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12586188> Make ImportError a special case for "command script import", such that the error message for the exception becomes the error for the entire import operation
and silence the backtrace printout

In the process, refactor the Execute* commands in ScriptInterpreter to take an options object, and add a new setting to not mask out errors so that the callers can handle them directly
instead of having the default behavior



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
db05491da80820047dc218542c88ba0d9f08fc71 29-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11449953> Change Debugger::SetOutputFileHandle() so that it does not automatically initialize the script interpreter in order to transfer its output file handle to it
This should delay initialization of Python until strictly necessary and speed-up debugger startup
Also, convert formatters for SEL and BOOL ObjC data-types from Python to C++, in order to reap more performance benefits from the above changes



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
800332c3988c78ea002b64b698f38b58ed95d3ba 23-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12523238> Commit 1 of 3
This commit enables the new HasChildren() feature for synthetic children providers
Namely, it hooks up the required bits and pieces so that individual synthetic children providers can implement a new (optional) has_children call
Default implementations have been provided where necessary so that any existing providers continue to work and behave correctly

Next steps are:
2) writing smart implementations of has_children for our providers whenever possible
3) make a test case



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
14cf90e8f8b5be04200504f15cf7a3173f34950a 22-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12479701> Use the plain pydoc pager to work around Python help() pagination conflicts with our I/O management

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3d656c729a1ed0abad4e5a2d76f6e8a6904f66aa 22-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12437442>
Given our implementation of ValueObjects we could have a scenario where a ValueObject has a dynamic type of Foo* at one point, and then its dynamic type changes to Bar*
If Bar* has synthetic children enabled, by the time we figure that out, our public API is already vending SBValues wrapping a DynamicVO, instead of a SyntheticVO and there was
no trivial way for us to change the SP inside an SBValue on the fly
This checkin reimplements SBValue in terms of a wrapper, ValueImpl, that allows this substitutions on-the-fly by overriding GetSP() to do The Right Thing (TM)
As an additional bonus, GetNonSyntheticValue() now works, and we can get rid of the ForceDisableSyntheticChildren idiom in ScriptInterpreterPython
Lastly, this checkin makes sure the synthetic VOs get the correct m_value and m_data from their parents (prevented summaries from working in some cases)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2e7f313dc473b036788319690116b324cb44b765 19-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12491420>

Added a new setting that allows a python OS plug-in to detect threads and provide registers for memory threads. To enable this you set the setting:

settings set target.process.python-os-plugin-path lldb/examples/python/operating_system.py

Then run your program and see the extra threads.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b2c0a126c2b4ab456553036967c069d00b5241d7 21-Sep-2012 Enrico Granata <egranata@apple.com> Fixing a logic error where we would incorrectly show the newly crafted function not found error for a Python function in some cases where the function actually existed and had an empty docstring

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5b9f77786d1e9fd356e1fe2d18ce6fcd74977c98 18-Sep-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12188843> Fixing a problem where a Python command created in the same module where the target function is defined causes the help string not to come out

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3b1afc6cc5689b749a48a1506f17ca593b1cda42 01-Sep-2012 Greg Clayton <gclayton@apple.com> Made it so changes to the prompt via "settings set prompt" get noticed by the command line.

Added the ability for OptionValueString objects to take flags. The only flag is currently for parsing escape sequences. Not the prompt string can have escape characters translate which will allow colors in the prompt.

Added functions to Args that will parse the escape sequences in a string, and also re-encode the escape sequences for display. This was looted from other parts of LLDB (the Debugger::FormatString() function).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b8f126a807c00e5c2d0e7faaf764c38072cd6764 24-Aug-2012 Greg Clayton <gclayton@apple.com> The OS plug-in can now get data from a python script that implements the protocol.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
cec963a709ec4fa099ea44a8abe67639c5fb8abe 24-Aug-2012 Enrico Granata <egranata@apple.com> Fixing a bunch of issues with the OS plugin code

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3e85b6378d312866ab25eb5623d9b8253bc498f8 24-Aug-2012 Enrico Granata <egranata@apple.com> Hooking up two more calls for the PythonOSPlugin stuff. The part of code to fetch the data and convert it to C++ objects is still missing, but will come

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
155ee91cc315888c26de1bfebd876bf35b857329 24-Aug-2012 Enrico Granata <egranata@apple.com> Adding bindings to the Script Interpreter for some basic Python OS plugin functionality (still WIP)

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8165d43ee84ab51de9218ba38bea257d082cec1f 18-Aug-2012 Johnny Chen <johnny.chen@apple.com> Merge python-GIL bracnh (by filcab) back into trunk!


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8121d7a8df909c2b8e9e0da92c39350b43b4dff8 18-Aug-2012 Johnny Chen <johnny.chen@apple.com> Fix a race condition where multiple PythonInputReaderManager instances could, during destruction,
tread on the m_embedded_thread_input_reader_sp singleton maintained by the script interpreter.
Furthermore, use two additional slots under the script interpreter to store the PseudoTerminal and
the InputReaderSP pertaining to the embedded python interpreter -- resulted from the
ScriptInterpreterPython::ExecuteInterpreterLoop() call -- to facilitate separation from what is being
used by the PythonInputReaderManager instances.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
f3ec4617297810223deb545cb68214ca4dd8009c 10-Aug-2012 Johnny Chen <johnny.chen@apple.com> rdar://problem/11457143 [ER] need "watchpoint command ..."

Add 'watchpoint command add/delete/list' to lldb, plus two .py test files.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c1ca9dcd0e8a1c7c5a882281afdd2a5145026fd0 08-Aug-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11975483> Removing user-visible references to 'dict' as a parameter name for Python summary-generating functions since it is a Python keyword.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
ca2c707cae740f76292714e5b517b151dfbd1b2c 31-Jul-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11862570> Fixing a potential crasher related to Python locking

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a1ba314f3c8eb40424547836769e93f9b65e7969 07-Jun-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11538779> Fixing issues where Python scripts were not able to read user input and/or display output to the user in certain situations - This fix introduces a Python InputReader manager class that mimics the behavior of the interactive interpreter in terms of access to I/O and ensures access to the input and output flows

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158124 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2b53695d7b59dc5d581673b59b3f2f0895240f58 04-May-2012 Johnny Chen <johnny.chen@apple.com> When the current thread state is NULL, PyThreadState_Get() issues a fatal error.
Use a gentler API PyThreadState_GetDict(), instead.

rdar://problem/11292882


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a5c2ce05705f784fd4ada97823af6ff7006fea58 25-Apr-2012 Enrico Granata <egranata@apple.com> Returning data formatters to their previous working condition - Plus fixing an issue that was preventing Python oneliners from executing

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6f2f0ab38426bdb5ed347f057ba57248667a40c3 25-Apr-2012 Greg Clayton <gclayton@apple.com> Now that we have an LLDB package, make the "lldb.macosx.crashlog" module work with all of the new module paths.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
0d235d5864e996d95f485df1a0df406126e1ccde 25-Apr-2012 Enrico Granata <egranata@apple.com> Making the Cocoa formatters comply with the new on-disk layout of the Python resources - This is one of the steps towards making the data formatters work again

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
4e651b1222992d3d93d11ca2f84c69477165e117 25-Apr-2012 Greg Clayton <gclayton@apple.com> Maked LLDB into a package so we can import things without poluting the global namespace.

Enrico will follow this up with fixing the data formatter test cases that are failing.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7aa754c61ffc6fbe6eb32235c1e17ab696225733 04-Apr-2012 Enrico Granata <egranata@apple.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7e202269d09cebf2f5047bf92fff8c8ecf732448 29-Mar-2012 Enrico Granata <egranata@apple.com> 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
67812172eecc4426c17b25354af072f6a4a9aad9 27-Mar-2012 Enrico Granata <egranata@apple.com> adding a summary for Objective-C type 'Class'

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
dba1de8d585f27601162f674d30ab71d9c83ccde 27-Mar-2012 Enrico Granata <egranata@apple.com> 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
cf09f885c201becf51acc4a5cfac00b3df53f2a8 19-Mar-2012 Enrico Granata <egranata@apple.com> 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
66205ce5381ab6db1f9bff83c483a4dc5854afc7 12-Mar-2012 Enrico Granata <egranata@apple.com> 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c65046d4ce6f4f0663750273f340cc14e06f1b71 08-Mar-2012 Johnny Chen <johnny.chen@apple.com> 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.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
400105dd92731a0c8968d6296b0b7279b483ebf0 07-Mar-2012 Enrico Granata <egranata@apple.com> 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
de3b25b645e4b4d97a87ebf059056a6c696d4e9c 03-Mar-2012 Enrico Granata <egranata@apple.com> added a new formatter for CF(Mutable)BitVector
fixed a few potential NULL-pointer derefs in ValueObject
we have a way to provide docstrings for properties we add to the SWIG layer - a few of these properties have a docstring already, more will come in future commits
added a new bunch of properties to SBData to make it more natural and Python-like to access the data they contain

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
86fcb16c848b7503b2d082158886359ef76f1a84 02-Mar-2012 Enrico Granata <egranata@apple.com> (a) adding formatters for:
NSTimeZone and CFTimeZonRef
SEL and related types
CFGregorianDate


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
83410e5e9e040ea5c6691f933aa9a6c4dcea4d8b 01-Mar-2012 Enrico Granata <egranata@apple.com> (a) adding an introspection formatter for NS(Mutable)IndexSet
(b) fixes and improvements to the formatters for NSDate and NSString
(c) adding an introspection formatter for NSCountedSet
(d) making the Objective-C formatters test cases pass on both 64 and 32 bit
one of the test cases is marked as expected failure on i386 - support needs to be added to the LLDB core for it to pass


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
1328b1410eb0f5e03c3b3ee302e9adca3e1b0361 29-Feb-2012 Enrico Granata <egranata@apple.com> This commit:
a) adds a Python summary provider for NSDate
b) changes the initialization for ScriptInterpreter so that we are not passing a bulk of Python-specific function pointers around
c) provides a new ScriptInterpreterObject class that allows for ref-count safe wrapping of scripting objects on the C++ side
d) contains much needed performance improvements:
1) the pointer to the Python function generating a scripted summary is now cached instead of looked up every time
2) redundant memory reads in the Python ObjC runtime wrapper are eliminated
3) summaries now use the m_summary_str in ValueObject to store their data instead of passing around ( == copying) an std::string object
e) contains other minor fixes, such as adding descriptive error messages for some cases of summary generation failure


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
41641f9abd85d146ff5953a93d6c78309e845aad 29-Feb-2012 Johnny Chen <johnny.chen@apple.com> Patch from Filipe Cabecinhas!

Attached is a small python fix to save the current stout and std err when starting a python session, then diverting them (as it was before), and restoring the previous values afterwards. Otherwise, a python script could suddenly find itself without output.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8f84cfb6f46256ae98a40fd217b206f48b7345c8 24-Feb-2012 Enrico Granata <egranata@apple.com> This patch provides a set of formatters for most of the commonly used Cocoa classes.
The formatter for NSString is an improved version of the one previously shipped as an example, the others are new in design and implementation.
A more robust and OO-compliant Objective-C runtime wrapper is provided for runtime versions 1 and 2 on 32 and 64 bit.
The formatters are contained in a category named "AppKit", which is not enabled at startup.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
f4124deeb9532044a38c0774ced872f2709347da 21-Feb-2012 Greg Clayton <gclayton@apple.com> Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptr
objects for the backlink to the lldb_private::Process. The issues we were
running into before was someone was holding onto a shared pointer to a
lldb_private::Thread for too long, and the lldb_private::Process parent object
would get destroyed and the lldb_private::Thread had a "Process &m_process"
member which would just treat whatever memory that used to be a Process as a
valid Process. This was mostly happening for lldb_private::StackFrame objects
that had a member like "Thread &m_thread". So this completes the internal
strong/weak changes.

Documented the ExecutionContext and ExecutionContextRef classes so that our
LLDB developers can understand when and where to use ExecutionContext and
ExecutionContextRef objects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b4d7fc0c466d446876e5f2d701f0e574dd0be8e7 17-Feb-2012 Greg Clayton <gclayton@apple.com> This checking is part one of trying to add some threading safety to our
internals. The first part of this is to use a new class:

lldb_private::ExecutionContextRef

This class holds onto weak pointers to the target, process, thread and frame
and it also contains the thread ID and frame Stack ID in case the thread and
frame objects go away and come back as new objects that represent the same
logical thread/frame.

ExecutionContextRef objcets have accessors to access shared pointers for
the target, process, thread and frame which might return NULL if the backing
object is no longer available. This allows for references to persistent program
state without needing to hold a shared pointer to each object and potentially
keeping that object around for longer than it needs to be.

You can also "Lock" and ExecutionContextRef (which contains weak pointers)
object into an ExecutionContext (which contains strong, or shared pointers)
with code like

ExecutionContext exe_ctx (my_obj->GetExectionContextRef().Lock());



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
16376ed044df3ee70fcf69e19f06af01e71a8e9a 15-Feb-2012 Enrico Granata <granata.enrico@gmail.com> <rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
SBTypeCategory
SBTypeFilter
SBTypeFormat
SBTypeSummary
SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3eeaf6e715784499520885535236ccff1ba56d1c 03-Feb-2012 Greg Clayton <gclayton@apple.com> Added support to SBType for getting template arguments from a SBType:

uint32_t
SBType::GetNumberOfTemplateArguments ();

lldb::SBType
SBType::GetTemplateArgumentType (uint32_t idx);

lldb::TemplateArgumentKind
SBType::GetTemplateArgumentKind (uint32_t idx);

Some lldb::TemplateArgumentKind values don't have a corresponding SBType
that will be returned from SBType::GetTemplateArgumentType(). This will
help our data formatters do their job by being able to find out the
type of template params and do smart things with those.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b302dffacdadeef509d28133a4c66299418122f8 01-Feb-2012 Greg Clayton <gclayton@apple.com> Added many more python convenience accessors:

You can now access a frame in a thread using:

lldb.SBThread.frame[int] -> lldb.SBFrame object for a frame in a thread

Where "int" is an integer index. You can also access a list object with all of
the frames using:

lldb.SBThread.frames => list() of lldb.SBFrame objects

All SB objects that give out SBAddress objects have properties named "addr"

lldb.SBInstructionList now has the following convenience accessors for len() and
instruction access using an index:

insts = lldb.frame.function.instructions
for idx in range(len(insts)):
print insts[idx]

Instruction lists can also lookup an isntruction using a lldb.SBAddress as the key:

pc_inst = lldb.frame.function.instructions[lldb.frame.addr]

lldb.SBProcess now exposes:

lldb.SBProcess.is_alive => BOOL Check if a process is exists and is alive
lldb.SBProcess.is_running => BOOL check if a process is running (or stepping):
lldb.SBProcess.is_running => BOOL check if a process is currently stopped or crashed:
lldb.SBProcess.thread[int] => lldb.SBThreads for a given "int" zero based index
lldb.SBProcess.threads => list() containing all lldb.SBThread objects in a process

SBInstruction now exposes:
lldb.SBInstruction.mnemonic => python string for instruction mnemonic
lldb.SBInstruction.operands => python string for instruction operands
lldb.SBInstruction.command => python string for instruction comment

SBModule now exposes:

lldb.SBModule.uuid => uuid.UUID(), an UUID object from the "uuid" python module
lldb.SBModule.symbol[int] => lldb.Symbol, lookup symbol by zero based index
lldb.SBModule.symbol[str] => list() of lldb.Symbol objects that match "str"
lldb.SBModule.symbol[re] => list() of lldb.Symbol objecxts that match the regex
lldb.SBModule.symbols => list() of all symbols in a module


SBAddress objects can now access the current load address with the "lldb.SBAddress.load_addr"
property. The current "lldb.target" will be used to try and resolve the load address.

Load addresses can also be set using this accessor:

addr = lldb.SBAddress()
addd.load_addr = 0x123023

Then you can check the section and offset to see if the address got resolved.

SBTarget now exposes:

lldb.SBTarget.module[int] => lldb.SBModule from zero based module index
lldb.SBTarget.module[str] => lldb.SBModule by basename or fullpath or uuid string
lldb.SBTarget.module[uuid.UUID()] => lldb.SBModule whose UUID matches
lldb.SBTarget.module[re] => list() of lldb.SBModule objects that match the regex
lldb.SBTarget.modules => list() of all lldb.SBModule objects in the target

SBSymbol now exposes:

lldb.SBSymbol.name => python string for demangled symbol name
lldb.SBSymbol.mangled => python string for mangled symbol name or None if there is none
lldb.SBSymbol.type => lldb.eSymbolType enum value
lldb.SBSymbol.addr => SBAddress object that represents the start address for this symbol (if there is one)
lldb.SBSymbol.end_addr => SBAddress for the end address of the symbol (if there is one)
lldb.SBSymbol.prologue_size => pythin int containing The size of the prologue in bytes
lldb.SBSymbol.instructions => SBInstructionList containing all instructions for this symbol

SBFunction now also has these new properties in addition to what is already has:
lldb.SBFunction.addr => SBAddress object that represents the start address for this function
lldb.SBFunction.end_addr => SBAddress for the end address of the function
lldb.SBFunction.instructions => SBInstructionList containing all instructions for this function

SBFrame now exposes the SBAddress for the frame:
lldb.SBFrame.addr => SBAddress which is the section offset address for the current frame PC

These are all in addition to what was already added. Documentation and website
updates coming soon.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b8dc733bd264edb688129dcc3103fb5ba4c9f060 31-Jan-2012 Enrico Granata <granata.enrico@gmail.com> This commit provides a new default summary for Objective-C boolean variables, which shows YES or NO instead of the character value. A new category named objc is added to contain this summary provider. Any future Objective-C related formatters would probably fit here

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
13d24fb1817faa7ccc4cfd799113ba1a2b8968eb 29-Jan-2012 Greg Clayton <gclayton@apple.com> Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared
pointer from just a pointer, which is also easily solved using the
std::tr1::enable_shared_from_this class.

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2fecc452345ce3162cea879ae816bf99e56239df 28-Jan-2012 Greg Clayton <gclayton@apple.com> Stop running so many individual commands when going into the script interpreter.
All of the commands now get globbed into a single line.

lldb.target, lldb.process, lldb.thread and lldb.frame now get initialized with
empty SBTarget, SBProcess, SBThread and SBFrame objects when they don't contain
anything.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
177bc682e2b45354e8b0753e705dc84255c42173 27-Jan-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10750012>

Remove a pseudo terminal master open and slave file descriptor that was being
used for pythong stdin. It was not hooked up correctly and was causing file
descriptor leaks.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a1cec247942a0e744e0b8f969b11332a1b3174ba 06-Jan-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10649734>

Fixed an issue where the python interpreter could deadlock LLDB.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6010acef0cee54e044d4e7e472ef3d99e13c5045 07-Nov-2011 Enrico Granata <granata.enrico@gmail.com> this patch addresses several issues with "command script" subcommands:
a) adds a new --synchronicity (-s) setting for "command script add" that allows the user to decide if scripted commands should run synchronously or asynchronously (which can make a difference in how events are handled)
b) clears up several error messages
c) adds a new --allow-reload (-r) setting for "command script import" that allows the user to reload a module even if it has already been imported before
d) allows filename completion for "command script import" (much like what happens for "target create")
e) prevents "command script add" from replacing built-in commands with scripted commands
f) changes AddUserCommand() to take an std::string instead of a const char* (for performance reasons)
plus, it fixes an issue in "type summary add" command handling which caused several test suite errors


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3e4238d47a6d1a3106f357d2e7b495870721c7ae 04-Nov-2011 Greg Clayton <gclayton@apple.com> Fixed the Xcode project building of LLVM to be a bit more user friendly:

- If you download and build the sources in the Xcode project, x86_64 builds
by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
Xcode project will download the right LLVM sources and build them from
scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
directory, we will use the sources you have placed in the LLDB directory.

Python can now be disabled for platforms that don't support it.

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
fa1f617779902cabfcce11abf07a857b85880f41 24-Oct-2011 Enrico Granata <granata.enrico@gmail.com> Decoupling of lock-related code from the core of ScriptInterpreterPython. All that concerns locking the Python interpreter is now delegated to the internal ScriptInterpreterPython::Locker class. Several changes in ScriptInterpreterPython to accommodate this new pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c28bbdb17a0826eb2f84cf2debb059f560c7d39b 23-Oct-2011 Benjamin Kramer <benny.kra@googlemail.com> Move Python.h includes out of the headers into the .cpp file where it's actually used.

Python.h includes a ton of macros that can cause weird behavior down the road.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
444e35b5fdf15a25a427285650f06f1390e62c75 19-Oct-2011 Greg Clayton <gclayton@apple.com> Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
59df36f99b76e33852e6848a162f5c2851074ea2 17-Oct-2011 Enrico Granata <granata.enrico@gmail.com> this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
567e7f3ba16eb48cb9fd6a2f26f2f7269eb6983c 22-Sep-2011 Greg Clayton <gclayton@apple.com> Converted the lldb_private::Process over to use the intrusive
shared pointers.

Changed the ExecutionContext over to use shared pointers for
the target, process, thread and frame since these objects can
easily go away at any time and any object that was holding onto
an ExecutionContext was running the risk of using a bad object.

Now that the shared pointers for target, process, thread and
frame are just a single pointer (they all use the instrusive
shared pointers) the execution context is much safer and still
the same size.

Made the shared pointers in the the ExecutionContext class protected
and made accessors for all of the various ways to get at the pointers,
references, and shared pointers.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
e09e254af4db4a27c5f20b3cb74ab65149fff1d4 21-Sep-2011 Jason Molenda <jmolenda@apple.com> One last printf-style call cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7e5fa7fc1f8efd24c078e063b2c4b5e13ba5be20 20-Sep-2011 Jason Molenda <jmolenda@apple.com> Update declarations for all functions/methods that accept printf-style
stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses. Fix all incorrect uses. Most of these are innocuous,
a few were resulting in crashes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
987c7ebe1daa425ba7abfa9643800e3237146fc0 17-Sep-2011 Greg Clayton <gclayton@apple.com> Adopt the intrusive pointers in:

lldb_private::Breakpoint
lldb_private::BreakpointLocations
lldb_private::BreakpointSite
lldb_private::Debugger
lldb_private::StackFrame
lldb_private::Thread
lldb_private::Target



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
271568fcd0bc11c7106ceb9173630540b7dfdd52 09-Sep-2011 Enrico Granata <granata.enrico@gmail.com> Fixing an issue with Python commands defined interactively

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
915448044bac6fdac22a33cc46697dcb771a8df2 06-Sep-2011 Enrico Granata <granata.enrico@gmail.com> Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2a19ef97467c45fead838c4ad6d54b2dc69e0334 27-Aug-2011 Jim Ingham <jingham@apple.com> Don't change the host's environment, just append our Python Directory
directly to the one in sys.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
4dfa5119a5262954d0a09abf567f7332ed6e1ecc 22-Aug-2011 Jim Ingham <jingham@apple.com> Don't let Python write its .pyc files, that's not really polite...

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
960691ff5f194be6c655c6a2aae2000d5a838647 22-Aug-2011 Enrico Granata <granata.enrico@gmail.com> - Support for Python namespaces:
If you have a Python module foo, in order to use its contained objects in LLDB you do not need to use
'from foo import *'. You can use 'import foo', and then refer to items in foo as 'foo.bar', and LLDB
will know how to resolve bar as a member of foo.
Accordingly, GNU libstdc++ formatters have been moved from the global namespace to gnu_libstdcpp and a few
test cases are also updated to reflect the new convention. Python docs suggest using a plain 'import' en lieu of
'from-import'.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3370f0ce9e2ae2fe1f2adf3628f443053602efa4 20-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Fixed some SWIG interoperability issues

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
13a54a141acd6255e4e11db466951ec1f26aa2f5 19-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Taking care of an issue with using lldb_private types in SBCommandInterpreter.cpp ; Making NSString test case work on Snow Leopard ; Removing an unused variable warning

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
f501c5913d5daaf45a906477bdf466bb74ed10fb 18-Aug-2011 Enrico Granata <granata.enrico@gmail.com> First round of code cleanups:
- all instances of "vobj" have been renamed to "valobj"
- class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp)
The interface to this class has not changed
- FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting
from ConstString to const char* and back all the time
Next step is making the same happen for categories themselves
- category gnu-libstdc++ is defined in the constructor for a FormatManager
The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time
All references to previous 'osxcpp' name have been removed from both code and file names
Functional changes:
- the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string
to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script
will become -o


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
074e3b6c2eac1438a85e464796cbc19b4354d5ad 17-Aug-2011 Enrico Granata <granata.enrico@gmail.com> New category "gnu-libstdc++" provides summary for std::string and synthetic children for types std::map, std::list and std::vector
The category is enabled by default. If you run into issues with it, disable it and the previous behavior of LLDB is restored
** This is a temporary solution. The general solution to having formatters pulled in at startup should involve going through the Platform.
Fixed an issue in type synthetic list where a category with synthetic providers in it was not shown if all the providers were regex-based


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
e5e34cb15f031237004b05abfa623c71f879f6c0 17-Aug-2011 Enrico Granata <granata.enrico@gmail.com> When defining a scripted command, it is possible to provide a docstring and that will be used as the help text for the command
If no docstring is provided, a default help text is created
LLDB will refuse to create scripted commands if the scripting language is anything but Python
Some additional comments in AppleObjCRuntimeV2.cpp to describe the memory layout expected by the dynamic type lookup code


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6b1596d81c34c6efb10ed51a3572d6b145b73f5b 17-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Changes to Python commands:
- They now have an SBCommandReturnObject instead of an SBStream as third argument
- The class CommandObjectPythonFunction has been merged into CommandObjectCommands.cpp
- The command to manage them is now:
command script with subcommands add, list, delete, clear
command alias is returned to its previous functionality
- Python commands are now part of an user dictionary, instead of being seen as aliases



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c2a2825d787be5459fc55264e55b6020ff62f68a 16-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Python commands:
It is now possible to use 'command alias --python' to define a command name that actually triggers execution of a Python function
(e.g. command alias --python foo foo_impl makes a command named 'foo' that runs Python function 'foo_impl')
The Python function foo_impl should have as signature: def foo_impl(debugger, args, stream, dict): where
debugger is an object wrapping an LLDB SBDebugger
args is the command line arguments, as an unparsed Python string
stream is an SBStream that represents the standard output
dict is an internal utility parameter and should be left untouched
The function should return None on no error, or an error string to describe any problems


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
60a7df56b7d67b2fabaf20192bf6c313c36f27e5 11-Aug-2011 Johnny Chen <johnny.chen@apple.com> To silence the static analyzer.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
979e20d127335143ffc89c2e37ec3a8b717ff22d 29-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Public API changes:
- Completely new implementation of SBType
- Various enhancements in several other classes
Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>:
- these return the actual elements into the container as the children of the container
- basic template name parsing that works (hopefully) on both Clang and GCC
- find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth
New summary string token ${svar :
- the syntax is just the same as in ${var but this new token lets you read the values
coming from the synthetic children provider instead of the actual children
- Python providers above provide a synthetic child len that returns the number of elements
into the container
Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB
Several other fixes, including:
- inverted the order of arguments in the ClangASTType constructor
- EvaluationPoint now only returns SharedPointer's to Target and Process
- the help text for several type subcommands now correctly indicates argument-less options as such


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
e89ab7b58d2542f4f42e923fa65ef8984840a90c 25-Jul-2011 Enrico Granata <granata.enrico@gmail.com> new flag -P to type synth add lets you type a Python class interactively
added a final newline to fooSynthProvider.py
new option to automatically save user input in InputReaderEZ
checking for NULL pointers in several new places


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
9ae7cef26612773c6b3422834cec83f0fbb2cf8c 24-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Python synthetic children:
- you can now define a Python class as a synthetic children producer for a type
the class must adhere to this "interface":
def __init__(self, valobj, dict):
def get_child_at_index(self, index):
def get_child_index(self, name):
then using type synth add -l className typeName
(e.g. type synth add -l fooSynthProvider foo)
(This is still WIP with lots to be added)
A small test case is available also as reference

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
f7a9b14c2c02d2fa9fad586c19f29d77533fcc09 15-Jul-2011 Enrico Granata <granata.enrico@gmail.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
892fadd1f1001d1082cd2edcf282fee0cba8ac87 16-Jun-2011 Caroline Tice <ctice@apple.com> Add 'batch_mode' to CommandInterpreter. Modify InputReaders to
not write output (prompts, instructions,etc.) if the CommandInterpreter
is in batch_mode.

Also, finish updating InputReaders to write to the asynchronous stream,
rather than using the Debugger's output file directly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
84cc16d1ce51a1659d89e13ce42a09c3e3ebad14 14-Jun-2011 Caroline Tice <ctice@apple.com> Add error message; clean up comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
d4d9283c4382ddb130a91ebf7096e0c81195dccc 13-Jun-2011 Caroline Tice <ctice@apple.com> Cleaning up the Python script interpreter: Use the
embedded_interpreter.py file rather than keeping it
all in a string and compiling the string (easier to maintain,
easier to read, remove redundancy).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132935 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a54461d8df11c4632d8fa22e68519e055fd3c579 03-Jun-2011 Caroline Tice <ctice@apple.com> Use Py_InitializeEx(0) instead of Py_Initialize,
to prevent Python from installing its own signal
handlers.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
6af65cb2cf60e433b5a4cba7834ed9f8cc175a81 03-May-2011 Caroline Tice <ctice@apple.com> Pre-load the Python script interpreter with the following
convenience variables (from the ExecutionContext) each time
it is entered: lldb.debugger, lldb.target, lldb.process,
lldb.thread, lldb.frame.

If a frame (or thread, process, etc) does not currently exist,
the variable contains the Python value 'None'.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
4a348081030cdd2af758fddc869518357d9befd3 02-May-2011 Caroline Tice <ctice@apple.com> This patch captures and serializes all output being written by the
command line driver, including the lldb prompt being output by
editline, the asynchronous process output & error messages, and
asynchronous messages written by target stop-hooks.

As part of this it introduces a new Stream class,
StreamAsynchronousIO. A StreamAsynchronousIO object is created with a
broadcaster, who will eventually broadcast the stream's data for a
listener to handle, and an event type indicating what type of event
the broadcaster will broadcast. When the Write method is called on a
StreamAsynchronousIO object, the data is appended to an internal
string. When the Flush method is called on a StreamAsynchronousIO
object, it broadcasts it's data string and clears the string.

Anything in lldb-core that needs to generate asynchronous output for
the end-user should use the StreamAsynchronousIO objects.

I have also added a new notification type for InputReaders, to let
them know that a asynchronous output has been written. This is to
allow the input readers to, for example, refresh their prompts and
lines, if desired. I added the case statements to all the input
readers to catch this notification, but I haven't added any code for
handling them yet (except to the IOChannel input reader).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
e86cbb9ef128db87cf904e330b2edfc15566bacd 22-Mar-2011 Greg Clayton <gclayton@apple.com> Abtracted the innards of lldb-core away from the SB interface. There was some
overlap in the SWIG integration which has now been fixed by introducing
callbacks for initializing SWIG for each language (python only right now).
There was also a breakpoint command callback that called into SWIG which has
been abtracted into a callback to avoid cross over as well.

Added a new binary: lldb-platform

This will be the start of the remote platform that will use as much of the
Host functionality to do its job so it should just work on all platforms.
It is pretty hollowed out for now, but soon it will implement a platform
using the GDB remote packets as the transport.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8054ba3af111d2644a9b6999e6f1cb4f216cd8b0 11-Mar-2011 Johnny Chen <johnny.chen@apple.com> Minor typo fix and TAB removals.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
ce207c18f9348340de73a950a46c3f6c6777909f 11-Mar-2011 Caroline Tice <ctice@apple.com> Add some explanatory comments.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
9d352cea11675050eb3b0fa23b2c91affeb6a5ee 08-Mar-2011 Caroline Tice <ctice@apple.com> Add thread state initialization to the thread where the interactive
interpreter is run (which is separate from the thread where
Py_Initialize is called, where this normally gets set up).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5892856b0cd6591194c669afab5bf9ac19c5b3a0 09-Feb-2011 Greg Clayton <gclayton@apple.com> Use Host::File in lldb_private::StreamFile and other places to cleanup host
layer a bit more.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
09c81efd010d1c9ac8821bad00cdfc9747fcae79 08-Feb-2011 Greg Clayton <gclayton@apple.com> Patch that allows for thread_t to be something more complex than an
integer. Modified patch from Kirk Beitz.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
0fdd4a0ed890af386d86ee404ffe58e0e2d6020b 08-Feb-2011 Greg Clayton <gclayton@apple.com> Abtract terminal stuff into a new lldb_private::Terminal class
where the implementation is hidden in the host layer. This avoids
a slew of "#if LLDB_CONFIG_TERMIOS_SUPPORTED" statements in the
code and keeps things cleaner.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
9a7a94733fc502384aeedacd7717c6573a99b019 07-Feb-2011 Greg Clayton <gclayton@apple.com> More termios fixes. We need to currently make sure to include:

#include "lldb/Host/Config.h"

Or the LLDB_CONFIG_TERMIOS_SUPPORTED defined won't be set. I will fix all
of this Termios stuff later today by moving lldb/Core/TTYState.* into the
host layer and then we conditionalize all of this inside TTYState.cpp and
then we get rid of LLDB_CONFIG_TERMIOS_SUPPORTED all together.

Typically, when we start to see too many "#if LLDB_CONFIG_XXXX" preprocessor
directives, this is a good indicator that something needs to be moved over to
the host layer. TTYState can be modified to do all of the things that many
areas of the code are currently doing, and it will avoid all of the
preprocessor noise.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
99208582d715cc667fe46aa7a997a0deb5a333c1 07-Feb-2011 Greg Clayton <gclayton@apple.com> More termios fixes from Kirk Beitz.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
17f5afe9ed10bda3efbce0f26cf0c030331f8b15 05-Feb-2011 Greg Clayton <gclayton@apple.com> Header patch, virtual dtor patch and missed UUID patch from Kirk Beitz.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a81c367f67db1b288c2d88c081d5bfc09e487695 03-Feb-2011 Caroline Tice <ctice@apple.com> Fix exit instructions for interactive interpreter, now that ctrl-D works.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
7c330d677966431920c92bcf8e2ac7093719cbec 27-Jan-2011 Greg Clayton <gclayton@apple.com> Added support for some new environment variables within LLDB to enable some
extra launch options:

LLDB_LAUNCH_FLAG_DISABLE_ASLR disables ASLR for all launched processes

LLDB_LAUNCH_FLAG_DISABLE_STDIO will disable STDIO (reroute to "/dev/null")
for all launched processes

LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY will force all launched processes to be
launched in new terminal windows.

Also, don't init python if we never create a script interpreter.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124341 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
bdcb6abaa287df2c5f312c51d993c1d0b0cb120c 26-Jan-2011 Greg Clayton <gclayton@apple.com> Enabled extra warnings and fixed a bunch of small issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
202f6b8715dbff8971ce69bb61cfb8bfc447c24c 17-Jan-2011 Caroline Tice <ctice@apple.com> Replace Mutex guarding python interpreter access with Predicate,
allowing timeouts & informing the user when the lock is unavailable.


Fixed problem where Debugger::Terminate was clearing the debugger list
even when the global ref count was greater than zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
4a461da2712fb83babc0a46ef1c73d11bc50e8f2 14-Jan-2011 Caroline Tice <ctice@apple.com> Recent modifications to the Python script interpreter caused some problems
when handling one-liner commands that contain escaped characters. In
order to deal with the new namespace/dictionary stuff, the command was
being embedded within a second string, which messed up the escaping.

This fixes the problem by handling one-liners in a different manner, so they
no longer need to be embedded within another string, and can still be
processed in the proper namespace/dictionary context.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
0aa2e55f0e9422405ad33675adc1e35044537adb 14-Jan-2011 Caroline Tice <ctice@apple.com> Split up the Python script interpreter code to allow multiple script interpreter objects to
exist within the same process (one script interpreter object per debugger object). The
python script interpreter objects are all using the same global Python script interpreter;
they use separate dictionaries to keep their data separate, and mutex's to prevent any object
attempting to use the global Python interpreter when another object is already using it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
67637d8dc2a43990762e64f24790860a10d2393a 15-Dec-2010 Caroline Tice <ctice@apple.com> Add termination instructions when entering the interactive script interpreter.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c4f55fee15b66ea53da092ca50400ac5d8b0692d 19-Nov-2010 Caroline Tice <ctice@apple.com> Add the ability to catch and do the right thing with Interrupts (often control-c)
and end-of-file (often control-d).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
2ade6115e2aaf88cd90ccc8bf499108099bdeb86 10-Nov-2010 Caroline Tice <ctice@apple.com> Move the embedded Python interpreter onto a separate thread, to prevent
main thread from having to wait on it (which was causing some I/O
hangs).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5790e062ca89a9daf1a9648e9b567cba17c9438b 28-Oct-2010 Caroline Tice <ctice@apple.com> Remove references to particular Python version (use the system default
version); change include statements to use Python.h in the Python framework
on Mac OS X systems; leave it using regular Python.h on other systems.

Note: I think this *ought* to work properly on Linux systems, but I don't have
a system to test it on...



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
f81b4c5c3f8500aa9be9734f676608464ecb5472 27-Oct-2010 Caroline Tice <ctice@apple.com> Flush the prompts immediately in the breakpoint command input readers, to make
sure they come out at the correct times.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5867f6b8768f5b8903e1b1bbcd9822b5bc55dff6 18-Oct-2010 Caroline Tice <ctice@apple.com> Prevent Python script interpreter initialization from changing
the termios settings on the debugger's input handle.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
24b48ff28b7c60dd4598212c3e77935a0fc1142d 18-Oct-2010 Greg Clayton <gclayton@apple.com> Added a new Host call to find LLDB related paths:

static bool
Host::GetLLDBPath (lldb::PathType path_type, FileSpec &file_spec);

This will fill in "file_spec" with an appropriate path that is appropriate
for the current Host OS. MacOSX will return paths within the LLDB.framework,
and other unixes will return the paths they want. The current PathType
enums are:

typedef enum PathType
{
ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
ePathTypeSupportExecutableDir, // Find LLDB support executable directory (debugserver, etc)
ePathTypeHeaderDir, // Find LLDB header file directory
ePathTypePythonDir // Find Python modules (PYTHONPATH) directory
} PathType;

All places that were finding executables are and python paths are now updated
to use this Host call.

Added another new host call to launch the inferior in a terminal. This ability
will be very host specific and doesn't need to be supported on all systems.
MacOSX currently will create a new .command file and tell Terminal.app to open
the .command file. It also uses the new "darwin-debug" app which is a small
app that uses posix to exec (no fork) and stop at the entry point of the
program. The GDB remote plug-in is almost able launch a process and attach to
it, it currently will spawn the process, but it won't attach to it just yet.
This will let LLDB not have to share the terminal with another process and a
new terminal window will pop up when you launch. This won't get hooked up
until we work out all of the kinks. The new Host function is:

static lldb::pid_t
Host::LaunchInNewTerminal (
const char **argv, // argv[0] is executable
const char **envp,
const ArchSpec *arch_spec,
bool stop_at_entry,
bool disable_aslr);

Cleaned up FileSpec::GetPath to not use strncpy() as it was always zero
filling the entire path buffer.

Fixed an issue with the dynamic checker function where I missed a '$' prefix
that should have been added.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5144f389f9417e106364d7fdbf5631de19ed4fe8 07-Oct-2010 Greg Clayton <gclayton@apple.com> More SWIG cleanup. Moved the breakpoint callback function back to the
ScriptInterpreterPython class and made a simple callback function that
ScriptInterpreterPython::BreakpointCallbackFunction() now calls so we don't
include any internal API stuff into the cpp file that is generated by SWIG.

Fixed a few build warnings in debugserver.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
5136f942d0a3a7f60b46ab90c4626bcc3b2a17f0 27-Sep-2010 Caroline Tice <ctice@apple.com> Fix one-liner Python breakpoint commands to be wrapped up in an automatically
generated Python function, and passed the stoppoint context frame and
bp_loc as parameters.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
59c5d5dbe1b565bca389c9547377a2dd17b9e956 27-Sep-2010 Caroline Tice <ctice@apple.com> Automatically wrap *all* Python code entered for a breakpoint command inside
an auto-generated Python function, and pass the stoppoint context frame and
breakpoint location as parameters to the function (named 'frame' and 'bp_loc'),
to be used inside the breakpoint command Python code, if desired.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
8bb61f099795a3fd98edf655c3e6899cd2668f6c 22-Sep-2010 Caroline Tice <ctice@apple.com> Update help text for breakpoint command one-liners.

Fix minor bug in 'commands alias'; alias commands can now handle command options
and arguments in the same alias. Also fixes problem that disallowed "process launch --" as
an alias.

Fix typo in comment in Python script interpreter.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
b447e84828dda036b599108e0ebdb29fd505571d 21-Sep-2010 Caroline Tice <ctice@apple.com> Re-write/clean up code that generated Python breakpoint commands.
Add a warning if no command was attached to the breakpoint.
Update the help slightly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
238c0a1e7b733cee539258faa656159c63f9e893 18-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed the way set/show variables were being accessed to being natively
accessed by the objects that own the settings. The previous approach wasn't
very usable and made for a lot of unnecessary code just to access variables
that were already owned by the objects.

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
c95c6d1a56c83322ac327fec6d4459ca47c3525e 15-Sep-2010 Caroline Tice <ctice@apple.com> Remove help text that is no longer correct.

Fix Python script interpreter to not fail when the Debugger does
not have input/output file handles.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3e0571b6e8fe4cc0946529525e6a29eb0f1a8f70 11-Sep-2010 Johnny Chen <johnny.chen@apple.com> Fixed some comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
d1c2dcac1c8509a77e6d9227c1285f96cbfadeb3 10-Sep-2010 Johnny Chen <johnny.chen@apple.com> Added the capability to specify a one-liner Python script as the callback
command for a breakpoint, for example:

(lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()"

The ScriptInterpreter interface has an extra method:

/// Set a one-liner as the callback for the breakpoint command.
virtual void
SetBreakpointCommandCallback (CommandInterpreter &interpreter,
BreakpointOptions *bp_options,
const char *oneliner);

to accomplish the above.

Also added a test case to demonstrate lldb's use of breakpoint callback command
to stop at function c() only when its immediate caller is function a(). The
following session shows the user entering the following commands:

1) command source .lldb (set up executable, breakpoint, and breakpoint command)
2) run (the callback mechanism will skip two breakpoints where c()'s immeidate caller is not a())
3) bt (to see that indeed c()'s immediate caller is a())
4) c (to continue and finish the program)

test/conditional_break $ ../../build/Debug/lldb
(lldb) command source .lldb
Executing commands in '.lldb'.
(lldb) file a.out
Current executable set to 'a.out' (x86_64).
(lldb) breakpoint set -n c
Breakpoint created: 1: name = 'c', locations = 1
(lldb) script import sys, os
(lldb) script sys.path.append(os.path.join(os.getcwd(), os.pardir))
(lldb) script import conditional_break
(lldb) breakpoint command add -p 1 "conditional_break.stop_if_called_from_a()"
(lldb) run
run
Launching '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64)
(lldb) Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
frame #0: a.out`c at main.c:39
frame #1: a.out`b at main.c:34
frame #2: a.out`a at main.c:25
frame #3: a.out`main at main.c:44
frame #4: a.out`start
c called from b
Continuing...
Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
frame #0: a.out`c at main.c:39
frame #1: a.out`b at main.c:34
frame #2: a.out`main at main.c:47
frame #3: a.out`start
c called from b
Continuing...
Checking call frames...
Stack trace for thread id=0x2e03 name=None queue=com.apple.main-thread:
frame #0: a.out`c at main.c:39
frame #1: a.out`a at main.c:27
frame #2: a.out`main at main.c:50
frame #3: a.out`start
c called from a
Stopped at c() with immediate caller as a().
a(1) returns 4
b(2) returns 5
Process 20420 Stopped
* thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
36
37 int c(int val)
38 {
39 -> return val + 3;
40 }
41
42 int main (int argc, char const *argv[])
(lldb) bt
bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
frame #0: 0x0000000100000de8 a.out`c + 7 at main.c:39
frame #1: 0x0000000100000dbc a.out`a + 44 at main.c:27
frame #2: 0x0000000100000e4b a.out`main + 91 at main.c:50
frame #3: 0x0000000100000d88 a.out`start + 52
(lldb) c
c
Resuming process 20420
Process 20420 Exited
a(3) returns 6
(lldb)

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
98bea86b61bfa2a15cea72d2c14f9e03992ab5a6 10-Sep-2010 Johnny Chen <johnny.chen@apple.com> Don't flatten lldb and import everything into the global namespace. Instead,
set the debugger_unique_id with the lldb prefix.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
1977419e899754aab0dea1ee049ad02bfbe4367c 10-Aug-2010 Johnny Chen <johnny.chen@apple.com> There is no need to restore (sys.stdin, sys.stdout) of the python script
interpreter right before calling Py_Finalize(). This also fixed the crash as
reported in rdar://problem/8252903.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
60dde64d699c71807dc95d75b40f5b777d167cc4 31-Jul-2010 Johnny Chen <johnny.chen@apple.com> We can do better when reporting the status of one-liner script execution.

Change the prototype of ScriptInterpreter::ExecuteOneLine() to return bool
instead of void and take one additional parameter as CommandReturnObject *.

Propagate the status of one-liner execution back appropriately.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
121f331dfc6fc823785b8a14136833e6a45ed84f 07-Jul-2010 Greg Clayton <gclayton@apple.com> Added some comments to clarify where "init_lldb" comes from.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
558be58c085ed1d3e33c01f5ea3bf0eff63ab827 30-Jun-2010 Caroline Tice <ctice@apple.com> Add a unique ID to each debugger instance.
Add functions to look up debugger by id
Add global variable to lldb python module, to hold debugger id
Modify embedded Python interpreter to update the global variable with the
id of its current debugger.
Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL)
as a valid value.

The point of all this is so that, when you drop into the embedded interpreter
from the command interpreter (or when doing Python-based breakpoint commands),
there is a way for the Python side to find/get the correct debugger
instance ( by checking debugger_unique_id, then calling
SBDebugger::FindDebuggerWithID on it).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
63094e0bb161580564954dee512955c1c79d3476 23-Jun-2010 Greg Clayton <gclayton@apple.com> Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.

To avoid this we now create instances of the lldb_private::Debugger that each
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack

So now clients should call:

SBDebugger::Initialize(); // (static function)

SBDebugger debugger (SBDebugger::Create());
// Use which ever file handles you wish
debugger.SetErrorFileHandle (stderr, false);
debugger.SetOutputFileHandle (stdout, false);
debugger.SetInputFileHandle (stdin, true);

// main loop

SBDebugger::Terminate(); // (static function)

SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.

Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
a8a5e562db734341149365d2bf7fd501365ed701 09-Jun-2010 Jason Molenda <jmolenda@apple.com> Committing patch from Joseph Ranieri to handle 'exit()' the same
as 'quit()' in the python script environment.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
3c90d99d1520c45942479257a632f38f0191a360 09-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Don't include Python.h in the shared header.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp
24943d2ee8bfaa7cf5893e4709143924157a5c1e 08-Jun-2010 Chris Lattner <sabre@nondot.org> Initial checkin of lldb code from internal Apple repo.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Interpreter/ScriptInterpreterPython.cpp