summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python
Commit message (Collapse)AuthorAgeFilesLines
* Don't allow direct access to StreamString's internal buffer.Zachary Turner2016-11-161-3/+3
| | | | | | | | | | | | | | | This is a large API change that removes the two functions from StreamString that return a std::string& and a const std::string&, and instead provide one function which returns a StringRef. Direct access to the underlying buffer violates the concept of a "stream" which is intended to provide forward only access, and makes porting to llvm::raw_ostream more difficult in the future. Differential Revision: https://reviews.llvm.org/D26698 llvm-svn: 287152
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-1/+1
| | | | | | | | | | Reviewers: zturner, labath Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: https://reviews.llvm.org/D26233 llvm-svn: 285855
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-051-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* Fix serialization of Python breakpoint commands.Jim Ingham2016-09-262-4/+32
| | | | | | | | | | | CommandData breakpoint commands didn't know whether they were Python or Command line commands, so they couldn't serialize & deserialize themselves properly. Fix that. I also changed the "breakpoint list" command to note in the output when the commands are Python commands. Fortunately only one test was relying on this explicit bit of text output. llvm-svn: 282432
* Some more pointer safety in Breakpoint.Zachary Turner2016-09-131-42/+37
| | | | | | | | | | | Plumb unique_ptrs<> all the way through the baton interface. NFC, this is a minor improvement to remove the possibility of an accidental pointer ownership issue. Reviewed By: jingham Differential Revision: https://reviews.llvm.org/D24495 llvm-svn: 281360
* This is the main part of a change to add breakpoint save and restore to lldb.Jim Ingham2016-09-121-7/+8
| | | | | | | | | | | | | | | Still to come: 1) SB API's 2) Testcases 3) Loose ends: a) serialize Thread options b) serialize Exception resolvers 4) "break list --file" should list breakpoints contained in a file and "break read -f 1 3 5" should then read in only those breakpoints. <rdar://problem/12611863> llvm-svn: 281273
* Fix about a dozen compile warningsIlia K2016-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: It fixes the following compile warnings: 1. '0' flag ignored with precision and ‘%d’ gnu_printf format 2. enumeral and non-enumeral type in conditional expression 3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ... 4. enumeration value ‘...’ not handled in switch 5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ casts away qualifiers 6. extra ‘;’ 7. comparison between signed and unsigned integer expressions 8. variable ‘register_operand’ set but not used 9. control reaches end of non-void function Reviewers: jingham, emaste, zturner, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D24331 llvm-svn: 281191
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-067-4974/+4434
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Moved #include for lldb-python.h to a distinct group with a reminder commentKate Stone2016-08-193-1/+7
| | | | | | | declaring that it must be first. Failure to do so results in build failures on macOS due to subtle header conflicts. llvm-svn: 279315
* Make sure files include what they use (part 2/2)Pavel Labath2016-08-112-3/+3
| | | | | | This makes lldb still compile on linux after a project-wide clang-format llvm-svn: 278335
* Fix a problem where if a uint64_t value is placed into a python dictionary ↵Greg Clayton2016-08-101-1/+12
| | | | | | | | and sent up to LLDB and converted to StructuredData, it would not be able to parse the full 64 bit value. A number like 0xf000000000000000L could be placed into a dictionary, and sent to LLDB and it would end up being 0xffffffffffffffff since it would overflow a int64_t. We leave the old code there, but if it overflows, we treat the number like a uint64_t and get it to decode correctly. Added a gtest to cover this so we don't regress. I verified the gtest failed prior to the fix, and it succeeds after it. <rdar://problem/27409265> llvm-svn: 278304
* Delete Host/windows/win32.hZachary Turner2016-08-092-3/+9
| | | | | | | | | | | | | | | | | | | It's always hard to remember when to include this file, and when you do include it it's hard to remember what preprocessor check it needs to be behind, and then you further have to remember whether it's windows.h or win32.h which you need to include. This patch changes the name to PosixApi.h, which is more appropriately named, and makes it independent of any preprocessor setting. There's still the issue of people not knowing when to include this, because there's not a well-defined set of things it exposes other than "whatever is missing on Windows", but at least this should make it less painful to fix when problems arise. This patch depends on LLVM revision r278170. llvm-svn: 278177
* Add a few more needed bits to the scripted thread plans.Jim Ingham2016-08-052-0/+19
| | | | llvm-svn: 277879
* Add a default-value bool flag pretty_print to the StructuredData Dump methods.Jason Molenda2016-07-202-2/+2
| | | | | | | | | They will dump pretty-print (indentation, extra whitepsace) by default. I'll make a change to ProcessGDBRemote soon so it stops sending JSON strings to debugserver pretty-printed; it's unnecessary extra bytes being sent between the two. llvm-svn: 276079
* Fix an issue where the @lldb.command marker would not work with the new ↵Enrico Granata2016-06-242-1/+26
| | | | | | | | | | | 5-argument version of the Python command function This: a) teaches PythonCallable to look inside a callable object b) teaches PythonCallable to discover whether a callable method is bound c) teaches lldb.command to dispatch to either the older 4 argument version or the newer 5 argument version llvm-svn: 273640
* Don't crash when OS plug-in returns None from any of the functions we might ↵Greg Clayton2016-05-161-16/+24
| | | | | | | | call. <rdar://problem/24489419> llvm-svn: 269686
* Add support for synthetic child providers to optionally return a customized ↵Enrico Granata2016-05-022-0/+68
| | | | | | typename for display llvm-svn: 268208
* Initialize the Python script interpreter lazily (i.e. not at debugger startup)Enrico Granata2016-04-121-4/+4
| | | | | | This time it should also pass the gtests llvm-svn: 266103
* Revert "Restore the lazy initialization of ScriptInterpreterPython, which ↵Pavel Labath2016-04-122-8/+8
| | | | | | | | | | was lost as part of the SystemLifetimeManager work" This change breaks python unit tests. This reverts commit 266033. llvm-svn: 266050
* Restore the lazy initialization of ScriptInterpreterPython, which was lost ↵Enrico Granata2016-04-122-8/+8
| | | | | | as part of the SystemLifetimeManager work llvm-svn: 266033
* Fix TestImport for Windows by ensuring backslashes in the directory paths ↵Adrian McCarthy2016-04-071-7/+8
| | | | | | | | | | are properly escaped in Python. The Python import works by ensuring the directory of the module or package is in sys.path, and then it does a Python `import foo`. The original code was not escaping the backslashes in the directory path, so this wasn't working. Differential Revision: http://reviews.llvm.org/D18873 llvm-svn: 265738
* Make File option flags consistent for Python APIStephane Sezer2016-03-241-2/+2
| | | | | | | | | | | | | | | | | | Summary: Fixes SBCommandReturnObject::SetImmediateOutputFile() and SBCommandReturnObject::SetImmediateOutputFile() for files opened with "a" or "a+" by resolving inconsistencies between File and our Python parsing of file objects. Reviewers: granata.enrico, Eugene.Zelenko, jingham, clayborg Subscribers: lldb-commits, sas Differential Revision: http://reviews.llvm.org/D18228 Change by Francis Ricci <fjricci@fb.com> llvm-svn: 264351
* Unicode support on Win32.Zachary Turner2016-03-221-3/+4
| | | | | | | | | | | | | Win32 API calls that are Unicode aware require wide character strings, but LLDB uses UTF8 everywhere. This patch does conversions wherever necessary when passing strings into and out of Win32 API calls. Patch by Cameron Differential Revision: http://reviews.llvm.org/D17107 Reviewed By: zturner, amccarth llvm-svn: 264074
* Fixed the python interpreter so that it correctly inherits the top ↵Greg Clayton2016-03-102-37/+38
| | | | | | | | | | IOHandler's files instead of always using stdin/out/err. Removed lldb_private::File::Duplicate() and the copy constructor and the assignment operator that used to duplicate the file handles and made them private so no one uses them. Previously the lldb_private::File::Duplicate() function duplicated files that used file descriptors, (int) but not file streams (FILE *), so the lldb_private::File::Duplicate() function only worked some of the time. No one else excep thee ScriptInterpreterPython was using these functions, so that aren't needed nor desired. Previously every time you would drop into the python interpreter we would duplicate files, and now we avoid this file churn. <rdar://problem/24877720> llvm-svn: 263161
* Fix an issue where pressing CTRL+C in the interactive script interpreter ↵Enrico Granata2016-02-091-1/+1
| | | | | | | | | | | | causes LLDB to crash This is because PyThreadState_Get() assumes a non-NULL thread state and crashes otherwise; but PyThreadState_GET is just a shortcut (in non-Python-debugging builds) for the global variable that holds the thread state The behavior of CTRL+C is slightly more erratic than one would like. CTRL+C in the middle of execution of Python code will cause that execution to be interrupted (e.g. time.sleep(1000)), but a CTRL+C at the prompt will just cause a KeyboardInterrupt and not exit the interpreter - worse, it will only trigger the exception once one presses ENTER. None of this is optimal, of course, but I don't have a lot of time to appease the Python deities with the proper spells right now, and fixing the crasher is already a good thing in and of itself llvm-svn: 260199
* Remove autoconf support from source directories.Eugene Zelenko2016-01-281-14/+0
| | | | | | Differential revision: http://reviews.llvm.org/D16662 llvm-svn: 259098
* Fix const cast error for MSVC2015 build.Aidan Dodds2016-01-281-1/+1
| | | | | | | | | The Visual Studio 2015 build was failing with the following error: error C2440: 'initializing': cannot convert from 'const char [12]' to 'char *' This should fix the problem by initializing a non const char array, instead of taking a pointer to const static data. llvm-svn: 259042
* Fix swig typemap for SBEvent.Zachary Turner2016-01-252-0/+119
| | | | | | | | | | | This needs to be able to handle bytes, strings, and bytearray objects. In Python 2 this was easy because bytes and strings are the same thing, but in Python 3 the 2 cases need to be handled separately. So as not to mix raw Python C API code with PythonDataObjects code, I've also introduced a PythonByteArray class to PythonDataObjects to make the paradigm used here consistent. llvm-svn: 258741
* Fix an issue where scripted commands would not actually print any of their ↵Enrico Granata2016-01-132-0/+22
| | | | | | | | output if an immediate output file was set in the result object via a Python file object Fixes rdar://24130303 llvm-svn: 257644
* Don't define Bytes and String to be the same number on Py2.Zachary Turner2016-01-111-4/+0
| | | | | | This is causing issues with case labels having the same value. llvm-svn: 257409
* Fix Python 3 issues related to OS plugins.Zachary Turner2016-01-111-3/+3
| | | | | | | | | | * lldb::tid_t was being converted incorrectly, so this is updated to use PythonInteger instead of manual Python Native API calls. * OSPlugin_RegisterContextData was assuming that the result of get_register_data was a string, when in fact it is a bytes. So this method is updated to use PythonBytes to do the work. llvm-svn: 257398
* Introduce a PythonBytes class into PythonDataObjects.Zachary Turner2016-01-112-0/+145
| | | | | | | This class behaves the same as PythonString on Python2, but differently on Python3. Unittests are added as well. llvm-svn: 257397
* Python 3 - Fix script import --allow-reload.Zachary Turner2015-12-041-3/+8
| | | | | | | Differential Revision: http://reviews.llvm.org/D15209 Reviewed By: Todd Fiala llvm-svn: 254791
* Python3 - Fix some issues related to `PythonFile` class.Zachary Turner2015-11-161-0/+6
| | | | | | | | Python 3 has lots of new debug asserts, and some of these were firing on PythonFile. Specifically related to handling of invalid files. llvm-svn: 253261
* Remove debugging code left in by accident.Zachary Turner2015-11-131-2/+0
| | | | llvm-svn: 253088
* Modernize FormatBacktrace() and make portable for Python 3.Zachary Turner2015-11-133-21/+26
| | | | llvm-svn: 253085
* Another fix for LLDB_DISABLE_PYTHON=1Zachary Turner2015-11-131-1/+5
| | | | llvm-svn: 253073
* Make PythonDataObjects.h work when LLDB_DISABLE_PYTHON=1Zachary Turner2015-11-132-0/+8
| | | | llvm-svn: 253054
* Fix a bug in PythonExceptionState and add unittest coverage.Zachary Turner2015-11-132-0/+13
| | | | | | | I forgot to reset the restore flag when calling member function `Acquire`. The newly added unittest should cover this case. llvm-svn: 253002
* Introduce a `PythonExceptionState` class.Zachary Turner2015-11-134-85/+263
| | | | | | | | | | | | This is a helper class which supports a number of features including exception to string formatting with backtrace handling and auto-restore of exception state upon scope exit. Additionally, unit tests are included to verify the feature set of the class. llvm-svn: 252994
* Fix non-Windows build after r252906.Zachary Turner2015-11-122-3/+3
| | | | llvm-svn: 252909
* Begin converting uses of PyCallable to PythonCallable.Zachary Turner2015-11-122-15/+49
| | | | | | | | | | | | | | | | PyCallable is a class that exists solely within the swig wrapper code. PythonCallable is a more generic implementation of the same idea that can be used by any Python-related interop code, and lives in PythonDataObjects.h The CL is mostly mechanical, and it doesn't cover every possible user of PyCallable, because I want to minimize the impact of this change (as well as making it easier to figure out what went wrong in case this causes a failure). I plan to finish up the rest of the changes in a subsequent patch, culminating in the removal of PyCallable entirely. llvm-svn: 252906
* Create `PythonTuple` and `PythonCallable` wrapper classes.Zachary Turner2015-11-112-6/+322
| | | | | | | | | | | | | | This adds PythonTuple and PythonCallable classes to PythonDataObjects. Additionally, unit tests are provided that exercise this functionality, including invoking manipulating and checking for validity of tuples, and invoking and checking for validity of callables using a variety of different syntaxes. The goal here is to eventually replace the code in python-wrapper.swig that directly uses the Python C API to deal with callables and name resolution with this code that can be more easily tested and debugged. llvm-svn: 252787
* Add a `PythonModule` class, and a root-level method for resolving names.Zachary Turner2015-11-112-12/+136
| | | | llvm-svn: 252765
* Fix Clang-tidy modernize-use-override warnings in some files in ↵Eugene Zelenko2015-10-242-58/+78
| | | | | | source/Plugins; other minor fixes. llvm-svn: 251167
* [SBValue] Add a method GetNumChildren(uint32_t max)Siva Chandra2015-10-212-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Along with this, support for an optional argument to the "num_children" method of a Python synthetic child provider has also been added. These have been added with the following use case in mind: Synthetic child providers currently have a method "has_children" and "num_children". While the former is good enough to know if there are children, it does not give any insight into how many children there are. Though the latter serves this purpose, calculating the number for children of a data structure could be an O(N) operation if the data structure has N children. The new method added in this change provide a middle ground. One can call GetNumChildren(K) to know if a child exists at an index K which can be as large as the callers tolerance can be. If the caller wants to know about children beyond K, it can make an other call with 2K. If the synthetic child provider maintains state about it counting till K previosly, then the next call is only an O(K) operation. Infact, all calls made progressively with steps of K will be O(K) operations. Reviewers: vharron, clayborg, granata.enrico Subscribers: labath, lldb-commits Differential Revision: http://reviews.llvm.org/D13778 llvm-svn: 250930
* Fix potential file i/o problem with python handles.Zachary Turner2015-10-204-37/+50
| | | | llvm-svn: 250838
* Fix linkage of `init_lldb` SWIG method in Python 3.Zachary Turner2015-10-161-1/+5
| | | | llvm-svn: 250531
* Convert SWIG typemap string operations to PythonObjects.Zachary Turner2015-10-162-5/+44
| | | | llvm-svn: 250530
* Update SWIG typemaps to use `PythonFile`.Zachary Turner2015-10-162-1/+26
| | | | | | | | Using the Python native C API is non-portable across Python versions, so this patch changes them to use the `PythonFile` class which hides the version specific differences behind a single interface. llvm-svn: 250525
OpenPOWER on IntegriCloud