summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
Commit message (Collapse)AuthorAgeFilesLines
* This checkin removes the last Cocoa formatters that were implemented in ↵Enrico Granata2013-03-191-1/+1
| | | | | | 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 llvm-svn: 177366
* <rdar://problem/13069948>Greg Clayton2013-01-251-1/+1
| | | | | | | | | | | | 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. llvm-svn: 173463
* <rdar://problem/13010007>Greg Clayton2013-01-181-89/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 172873
* Remove std::string input arguments and replace with "const char *".Greg Clayton2013-01-161-64/+56
| | | | llvm-svn: 172647
* 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
OpenPOWER on IntegriCloud