summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that the GenerateFunction call can support arbitrary levels of ↵Enrico Granata2013-01-071-2/+4
| | | | | | indentation for user code llvm-svn: 171810
* <rdar://problem/12446222>Enrico Granata2012-12-191-2/+26
| | | | | | | | | | | 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. llvm-svn: 170612
* Even when we aren’t going to init all the lldb.frame, etc, globals, init ↵Jim Ingham2012-12-081-0/+7
| | | | | | lldb.debugger, since each script interpreter is tied to just one debugger. llvm-svn: 169663
* More Linux warnings fixes (remove default labels as needed):Daniel Malea2012-12-071-2/+0
| | | | | | | | - as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations Patch by Matt Kopec! llvm-svn: 169633
* Separate initing the stdout/stderr for running the Python Script interpreter ↵Jim Ingham2012-12-071-30/+36
| | | | | | | | | | from initing the lldb.target/frame/etc globals, and only do the latter when it makes sense to. <rdar://problem/12554049> llvm-svn: 169614
* Fixed a crash in which we examined the extension ofSean Callanan2012-12-031-4/+7
| | | | | | | | | a file name, whether the file name had an extension or not. <rdar://problem/12793152> llvm-svn: 169156
* <rdar://problem/12676084> Dump the traceback when a Python error occurs in ↵Enrico Granata2012-11-301-15/+68
| | | | | | "command script import" and the exception is not an ImportError llvm-svn: 169031
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-5/+5
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Giving at least some error information when a Python exception happens ↵Enrico Granata2012-11-131-1/+11
| | | | | | during command script import llvm-svn: 167810
* Adding support for loading the scripting resource as part of a framework, ↵Enrico Granata2012-11-081-1/+1
| | | | | | | | 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 llvm-svn: 167570
* Get rid of hack by making the actual call public. This was causing the ↵Greg Clayton2012-11-011-1/+1
| | | | | | lldb-platform to not be able to link. llvm-svn: 167253
* <rdar://problem/12586188> Make ImportError a special case for "command ↵Enrico Granata2012-10-311-28/+62
| | | | | | | | | | | 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 llvm-svn: 167067
* <rdar://problem/11449953> Change Debugger::SetOutputFileHandle() so that it ↵Enrico Granata2012-10-291-0/+5
| | | | | | | | | 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 llvm-svn: 166967
* <rdar://problem/12523238> Commit 1 of 3Enrico Granata2012-10-231-5/+32
| | | | | | | | | | | | 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 llvm-svn: 166495
* <rdar://problem/12479701> Use the plain pydoc pager to work around Python ↵Enrico Granata2012-10-221-3/+2
| | | | | | help() pagination conflicts with our I/O management llvm-svn: 166432
* <rdar://problem/12437442>Enrico Granata2012-10-221-30/+7
| | | | | | | | | | | 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) llvm-svn: 166426
* <rdar://problem/12491420>Greg Clayton2012-10-181-13/+20
| | | | | | | | | | 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. llvm-svn: 166244
* Fixing a logic error where we would incorrectly show the newly crafted ↵Enrico Granata2012-09-201-2/+3
| | | | | | function not found error for a Python function in some cases where the function actually existed and had an empty docstring llvm-svn: 164334
* <rdar://problem/12188843> Fixing a problem where a Python command created in ↵Enrico Granata2012-09-181-4/+13
| | | | | | the same module where the target function is defined causes the help string not to come out llvm-svn: 164172
* Made it so changes to the prompt via "settings set prompt" get noticed by ↵Greg Clayton2012-09-011-5/+5
| | | | | | | | | | 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). llvm-svn: 163043
* The OS plug-in can now get data from a python script that implements the ↵Greg Clayton2012-08-241-2/+2
| | | | | | protocol. llvm-svn: 162540
* Fixing a bunch of issues with the OS plugin codeEnrico Granata2012-08-241-1/+7
| | | | llvm-svn: 162527
* Hooking up two more calls for the PythonOSPlugin stuff. The part of code to ↵Enrico Granata2012-08-241-0/+116
| | | | | | fetch the data and convert it to C++ objects is still missing, but will come llvm-svn: 162522
* Adding bindings to the Script Interpreter for some basic Python OS plugin ↵Enrico Granata2012-08-241-0/+88
| | | | | | functionality (still WIP) llvm-svn: 162513
* Merge python-GIL bracnh (by filcab) back into trunk!Johnny Chen2012-08-181-134/+75
| | | | llvm-svn: 162161
* Fix a race condition where multiple PythonInputReaderManager instances ↵Johnny Chen2012-08-171-30/+41
| | | | | | | | | | | | 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. llvm-svn: 162147
* rdar://problem/11457143 [ER] need "watchpoint command ..."Johnny Chen2012-08-091-0/+249
| | | | | | Add 'watchpoint command add/delete/list' to lldb, plus two .py test files. llvm-svn: 161638
* <rdar://problem/11975483> Removing user-visible references to 'dict' as a ↵Enrico Granata2012-08-081-6/+6
| | | | | | parameter name for Python summary-generating functions since it is a Python keyword. llvm-svn: 161467
* <rdar://problem/11862570> Fixing a potential crasher related to Python lockingEnrico Granata2012-07-311-2/+2
| | | | llvm-svn: 161054
* <rdar://problem/11538779> Fixing issues where Python scripts were not able ↵Enrico Granata2012-06-071-18/+291
| | | | | | 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 llvm-svn: 158124
* When the current thread state is NULL, PyThreadState_Get() issues a fatal error.Johnny Chen2012-05-041-1/+4
| | | | | | | | Use a gentler API PyThreadState_GetDict(), instead. rdar://problem/11292882 llvm-svn: 156200
* Returning data formatters to their previous working condition - Plus fixing ↵Enrico Granata2012-04-251-1/+1
| | | | | | an issue that was preventing Python oneliners from executing llvm-svn: 155563
* Now that we have an LLDB package, make the "lldb.macosx.crashlog" module ↵Greg Clayton2012-04-251-1/+1
| | | | | | work with all of the new module paths. llvm-svn: 155528
* Making the Cocoa formatters comply with the new on-disk layout of the Python ↵Enrico Granata2012-04-251-1/+1
| | | | | | resources - This is one of the steps towards making the data formatters work again llvm-svn: 155526
* Maked LLDB into a package so we can import things without poluting the ↵Greg Clayton2012-04-251-9/+4
| | | | | | | | global namespace. Enrico will follow this up with fixing the data formatter test cases that are failing. llvm-svn: 155514
* Fixing a potential crasher where Python would assume we have no thread state ↵Enrico Granata2012-04-041-8/+15
| | | | | | while clearing out an SBDebugger which was acquiring input from the interactive interpreter llvm-svn: 154027
* Part 1 of a series of fixes meant to improve reliability and increase ease ↵Enrico Granata2012-03-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of bug fixing for data formatter issues. We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility The Pythonic logging can be enabled by using the following scripting commands: (lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...} 0 = no logging 1 = do log 2 = flush after logging each line - slower but safer 3 or more = each time a Logger is constructed, log the function that has created it more log levels may be added, each one being more log-active than the previous by default, the log output will come out on your screen, to direct it to a file: (lldb) script Logger._lldb_formatters_debug_filename = 'filename' that will make the output go to the file - set to None to disable the file output and get screen logging back Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons this will fix crashers where a malformed list or map would not ever meet our termination conditions to set the cap to a different value: (lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255) you can optionally disable the loop detection algorithm for lists (lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False llvm-svn: 153676
* adding a summary for Objective-C type 'Class'Enrico Granata2012-03-271-1/+1
| | | | llvm-svn: 153541
* Synthetic values are now automatically enabled and active by default. ↵Enrico Granata2012-03-271-0/+23
| | | | | | | | | | | | SBValue is set up to always wrap a synthetic value when one is available. A new setting enable-synthetic-value is provided on the target to disable this behavior. There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic. The test suite has been changed accordingly. Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching llvm-svn: 153495
* Massive enumeration name changes: a number of enums in ValueObject were not ↵Enrico Granata2012-03-191-7/+9
| | | | | | | | | | | | | | | | | | following the naming pattern Changes to synthetic children: - the update(self): function can now (optionally) return a value - if it returns boolean value True, ValueObjectSyntheticFilter will not clear its caches across stop-points this should allow better performance for Python-based synthetic children when one can be sure that the child ValueObjects have not changed - making a difference between a synthetic VO and a VO with a synthetic value: now a ValueObjectSyntheticFilter will not return itself as its own synthetic value, but will (correctly) claim to itself be synthetic - cleared up the internal synthetic children architecture to make a more consistent use of pointers and references instead of shared pointers when possible - major cleanup of unnecessary #include, data and functions in ValueObjectSyntheticFilter itself - removed the SyntheticValueType enum and replaced it with a plain boolean (to which it was equivalent in the first place) Some clean ups to the summary generation code Centralized the code that clears out user-visible strings and data in ValueObject More efficient summaries for libc++ containers llvm-svn: 153061
* Added formatters for libc++ (http://libcxx.llvm.org):Enrico Granata2012-03-121-1/+1
| | | | | | | | | | | | | std::string has a summary provider std::vector std::list and std::map have both a summary and a synthetic children provider Given the usage of a custom namespace (std::__1::classname) for the implementation of libc++, we keep both libstdcpp and libc++ formatters enabled at the same time since that raises no conflicts and enabled for seamless transition between the two The formatters for libc++ reside in a libcxx category, and are loaded from libcxx.py (to be found in examples/synthetic) The formatters-stl test cases have been divided to be separate for libcxx and libstdcpp. This separation is necessary because (a) we need different compiler flags for libc++ than for libstdcpp (b) libc++ inlines a lot more than libstdcpp and some code changes were required to accommodate this difference llvm-svn: 152570
* Fixed a crasher when Xcode calls into ↵Johnny Chen2012-03-081-6/+15
| | | | | | | | | ScriptInterpreterPython::ResetOutputFileHandle(). The Locker should only perform acquire/free lock operation, but no enter/leave session at all. Also added sanity checks for items passed to the PyDict_SetItemString() calls. llvm-svn: 152337
* Using the new ScriptInterpreterObject in the implementation of synthetic ↵Enrico Granata2012-03-061-321/+156
| | | | | | | | | children to enhance type safety Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code llvm-svn: 152164
* added a new formatter for CF(Mutable)BitVectorEnrico Granata2012-03-031-1/+1
| | | | | | | | 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 llvm-svn: 151962
* (a) adding formatters for:Enrico Granata2012-03-021-1/+1
| | | | | | | | NSTimeZone and CFTimeZonRef SEL and related types CFGregorianDate llvm-svn: 151866
* (a) adding an introspection formatter for NS(Mutable)IndexSetEnrico Granata2012-03-011-1/+1
| | | | | | | | | (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 llvm-svn: 151826
* This commit:Enrico Granata2012-02-291-45/+141
| | | | | | | | | | | | | 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 llvm-svn: 151703
* Patch from Filipe Cabecinhas!Johnny Chen2012-02-291-3/+14
| | | | | | 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. llvm-svn: 151693
* This patch provides a set of formatters for most of the commonly used Cocoa ↵Enrico Granata2012-02-231-0/+5
| | | | | | | | | | 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. llvm-svn: 151299
* Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton2012-02-211-2/+3
| | | | | | | | | | | | | | | | | 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. llvm-svn: 151009
OpenPOWER on IntegriCloud