summaryrefslogtreecommitdiffstats
path: root/lldb/scripts
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/Scripts] Remove SWIG botJonas Devlieghere2020-01-135-621/+0
| | | | | | This is no longer used or maintained. Differential revision: https://reviews.llvm.org/D72539
* [lldb/Scripts] Move android script from underneath Python dirJonas Devlieghere2020-01-102-26/+0
| | | | | The scripts root directory already contains python scripts. No need to keep this one nested under a dedicated Python directory.
* [lldb/Scripts] Remove remote-build.pyJonas Devlieghere2020-01-101-312/+0
| | | | With Xcode gone this is no longer relevant.
* [lldb/Scripts] Remove buildbot.pyJonas Devlieghere2020-01-101-196/+0
| | | | | This file is outdated and still references SVN. Buildbots are configured through the zorg repository.
* [lldb/Bindings] Move bindings into their own subdirectoryJonas Devlieghere2020-01-0977-13692/+0
| | | | | | | | | | | | All the code required to generate the language bindings for Python and Lua lives under scripts, even though the majority of this code aren't scripts at all, and surrounded by scripts that are totally unrelated. I've reorganized these files and moved everything related to the language bindings into a new top-level directory named bindings. This makes the corresponding files self contained and much more discoverable. Differential revision: https://reviews.llvm.org/D72437
* [lldb/SWIG] Add missing '\' in macros againJonas Devlieghere2020-01-091-2/+2
| | | | | | Making the string conversion operator a macro unintentionally dropped the backslash before '\n' and '\r' and was therefore incorrectly stripping 'n' and 'r' from the object description.
* [lldb/SWIG] Refactor extensions to be non Python-specific (3/3)Jonas Devlieghere2020-01-0818-253/+59
| | | | | | | | | | | The current SWIG extensions for the string conversion operator is Python specific because it uses the PythonObjects. This means that the code cannot be reused for other SWIG supported languages such as Lua. This reimplements the extensions in a more generic way that can be reused. It uses a SWIG macro to reduce code duplication. Differential revision: https://reviews.llvm.org/D72377
* [lldb/SWIG] Refactor extensions to be non Python-specific (2/2)Jonas Devlieghere2020-01-0825-287/+95
| | | | | | | | | | | The current SWIG extensions for the string conversion operator is Python specific because it uses the PythonObjects. This means that the code cannot be reused for other SWIG supported languages such as Lua. This reimplements the extensions in a more generic way that can be reused. It uses a SWIG macro to reduce code duplication. Differential revision: https://reviews.llvm.org/D72377
* [lldb/SWIG] Refactor extensions to be non Python-specificJonas Devlieghere2020-01-084-14/+18
| | | | | | | | | | | The current SWIG extensions for the string conversion operator is Python specific because it uses the PythonObjects. This means that the code cannot be reused for other SWIG supported languages such as Lua. This reimplements the extensions in a more generic way that can be reused. Differential revision: https://reviews.llvm.org/D72377
* [lldb/CMake] Only auto-enable Python when SWIG is foundJonas Devlieghere2020-01-071-7/+0
| | | | | | | | | As correctly pointed out by Martin on the mailing list, Python should only be auto-enabled if SWIG is found as well. This moves the logic of finding SWIG into FindPythonInterpAndLibs to make that possible. To make diagnosing easier I've included a status message to convey why Python support is disabled.
* Revert "Re-land "[lldb/Lua] Add string conversion operator for SBTarget.""Jonas Devlieghere2020-01-074-12/+12
| | | | | | This was returning a pointer to a stack-allocated memory location. This works for Python where we return a PythonString which must own the underlying string.
* Re-land "[lldb/Lua] Add string conversion operator for SBTarget."Jonas Devlieghere2020-01-074-12/+12
| | | | | | | Extend the SBTarget class with a string conversion operator and reuse the same code between Python and Lua. This should happen for all the SB classes, but I'm doing just this one as an example and for use in a test case.
* Revert "[lldb/Lua] Add string conversion operator for SBTarget."Jonas Devlieghere2020-01-074-12/+12
| | | | This reverts commit 640d0ba8760051afc002c672121c6989517fc94e.
* [lldb/Lua] Add string conversion operator for SBTarget.Jonas Devlieghere2020-01-074-12/+12
| | | | | | | Extend the SBTarget class with a string conversion operator and reuse the same code between Python and Lua. This should happen for all the SB classes, but I'm doing just this one as an example and for use in a test case.
* [Lldb/Lua] Generate Lua BindingsJonas Devlieghere2019-12-212-26/+71
| | | | | | | | | | | This patch uses SWIG to generate the Lua bindings for the SB API. It covers most of the API, but some methods require a type map similar to Python. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html Differential revision: https://reviews.llvm.org/D71235
* [lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.Jonas Devlieghere2019-12-133-162/+161
| | | | | This groups the headers and interfaces in separate files that can be included by other swig files for different languages.
* Remove TypeValidators (NFC in terms of the testsuite)Adrian Prantl2019-12-111-3/+0
| | | | | | | | This is a half-implemented feature that as far as we can tell was never used by anything since its original inclusion in 2014. This patch removes it to make remaining the code easier to understand. Differential Revision: https://reviews.llvm.org/D71310
* [lldb/SWIG] Guard Python type map in SWIG interface by SWIGPYTHONJonas Devlieghere2019-12-091-5/+2
| | | | | | Guard the Python type map in SBTarget by the SWIGPYTHON define to ensures the rest of the interface can be reused for other languages supported by SWIG.
* [lldb/SWIG] Guard embedded Python code in SWIG interfaces by SWIGPYTHONJonas Devlieghere2019-12-0836-0/+82
| | | | | | Guard the embedded Python code in LLDB's interface files by the SWIGPYTHON define to ensures they can be reused for other languages supported by SWIG.
* [LLDB][Python] remove ArgInfo::countLawrence D'Anna2019-11-041-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch updates the last user of ArgInfo::count and deletes it. I also delete `GetNumInitArguments()` and `GetInitArgInfo()`. Classess are callables and `GetArgInfo()` should work on them. On python 3 it already works, of course. `inspect` is good. On python 2 we have to add yet another special case. But hey if python 2 wasn't crufty we wouln't need python 3. I also delete `is_bound_method` becuase it is unused. This path is tested in `TestStepScripted.py` Reviewers: labath, mgorny, JDevlieghere Reviewed By: labath, JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69742
* [LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_argsLawrence D'Anna2019-10-291-20/+22
| | | | | | | | | | | | | | | | | | | | Summary: Move breakpoints from the old, bad ArgInfo::count to the new, better ArgInfo::max_positional_args. Soon ArgInfo::count will be no more. It looks like this functionality is already well tested by `TestBreakpointCommandsFromPython.py`, so there's no need to write additional tests for it. Reviewers: labath, jingham, JDevlieghere Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69468
* [lldb] move package generation from python to cmakeHaibo Huang2019-10-286-1104/+17
| | | | | | | | | | Summary: This is the last part. And we can remove the python script. Subscribers: lldb-commits, mgorny Tags: #lldb Differential Revision: https://reviews.llvm.org/D69019
* [LLDB][formatters] ArgInfo::count -> ArgInfo::max_positional_argsLawrence D'Anna2019-10-271-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Move breakpoints from the old, bad ArgInfo::count to the new, better ArgInfo::max_positional_args. Soon ArgInfo::count will be no more. This functionality is tested in `TestFormatters.py`, `TestDataFormatterSynthVal.py`, `TestDataFormatterSynthType.py`. You may notice that the old code was passing 0 arguments when count was 1, and passing 1 argument when count is 2. This is no longer necessary because max_positional_args counts the self pointer correctly. Reviewers: labath, jingham, JDevlieghere Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69469
* Add the ability to pass extra args to a Python breakpoint callback.Jim Ingham2019-10-254-3/+37
| | | | | | | | | | | | | | | | | For example, it is pretty easy to write a breakpoint command that implements "stop when my caller is Foo", and it is pretty easy to write a breakpoint command that implements "stop when my caller is Bar". But there's no way to write a generic "stop when my caller is..." function, and then specify the caller when you add the command to a breakpoint. With this patch, you can pass this data in a SBStructuredData dictionary. That will get stored in the PythonCommandBaton for the breakpoint, and passed to the implementation function (if it has the right signature) when the breakpoint is hit. Then in lldb, you can say: (lldb) break com add -F caller_is -k caller_name -v Foo More generally this will allow us to write reusable Python breakpoint commands. Differential Revision: https://reviews.llvm.org/D68671
* remove multi-argument form of PythonObject::Reset()Lawrence D'Anna2019-10-224-224/+50
| | | | | | | | | | | | | | | | | | | | Summary: With this patch, only the no-argument form of `Reset()` remains in PythonDataObjects. It also deletes PythonExceptionState in favor of PythonException, because the only call-site of PythonExceptionState was also using Reset, so I cleaned up both while I was there. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69214 llvm-svn: 375475
* convert LLDBSwigPythonCallTypeScript to ArgInfo::max_positional_argsLawrence D'Anna2019-10-191-5/+10
| | | | | | | | | | | | | | | | | | | | Summary: This patch converts another user of ArgInfo::count over to use ArgInfo::max_positional_args instead. I also add a test to make sure both documented signatures for python type formatters work. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69153 llvm-svn: 375334
* [LLDB] bugfix: command script add -f doesn't work for some callablesLawrence D'Anna2019-10-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When users define a debugger command from python, they provide a callable object. Because the signature of the function has been extended, LLDB needs to inspect the number of parameters the callable can take. The rule it was using to decide was weird, apparently not tested, and giving wrong results for some kinds of python callables. This patch replaces the weird rule with a simple one: if the callable can take 5 arguments, it gets the 5 argument version of the signature. Otherwise it gets the old 4 argument version. It also adds tests with a bunch of different kinds of python callables with both 4 and 5 arguments. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69014 llvm-svn: 375333
* delete SWIG typemaps for FILE*Lawrence D'Anna2019-10-171-68/+0
| | | | | | | | | | | | | | | | | | Summary: The SWIG typemaps for FILE* are no longer used, so this patch deletes them. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68963 llvm-svn: 375073
* [lldb] move more things from python to cmakeHaibo Huang2019-10-161-237/+0
| | | | | | | | | | | | | | Summary: Move the copy of six.py, lldb.py and macosx/heap Reviewers: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69016 llvm-svn: 375024
* [lldb] Creates _liblldb symlink from cmakeHaibo Huang2019-10-151-282/+0
| | | | | | | | | | | | | | | | | Summary: This is another attempt of D67993. This change removed hard coded relative paths. This way we can generate correct result when get_python_lib() returns a different path, or LLDB_PYTHON_RELATIVE_PATH is specified directly. By moving things out of python, we are also able to correctly process more cross compile situations. E.g. .pyd vs .so for Windows. Subscribers: lldb-commits, mgorny Tags: #lldb Differential Revision: https://reviews.llvm.org/D68858 llvm-svn: 374953
* remove FILE* usage from SBStream.iLawrence D'Anna2019-10-151-1/+12
| | | | | | | | | | | | | | | | | | | | Summary: This patch removes FILE* and replaces it with SBFile and FileSP the SWIG interface for `SBStream.i`. And this is the last one. With this change, nothing in the python API will can access a FILE* method on the C++ side. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68960 llvm-svn: 374924
* convert SBDebugger::***FileHandle() wrappers to native files.Lawrence D'Anna2019-10-151-18/+33
| | | | | | | | | | | | | | | | | | | | Summary: This patch converts the swig wrappers for SetInputFileHandle() and friends to emulate the old behavior using SetInputFile(). This will clear the way for deleting the FILE* typemaps altogether. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mehdi_amini, dexonsmith, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68856 llvm-svn: 374912
* SBFile::GetFile: convert SBFile back into python native files.Lawrence D'Anna2019-10-152-0/+33
| | | | | | | | | | | | | | | | | | | | | | Summary: This makes SBFile::GetFile public and adds a SWIG typemap to convert the result back into a python native file. If the underlying File itself came from a python file, it is returned identically. Otherwise a new python file object is created using the file descriptor. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68737 llvm-svn: 374911
* remove FILE* bindings from SBInstruction.Lawrence D'Anna2019-10-142-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch replaces the FILE* python bindings for SBInstruction and SBInstructionList and replaces them with the new, safe SBFile and FileSP bindings. I also re-enable `Test_Disassemble_VST1_64`, because now we can use the file bindings as an additional test of the disassembler, and we can use the disassembler test as a test of the file bindings. The bugs referred to in the comments appear to have been fixed. The radar is closed now and the bugzilla bug does not reproduce with the instructions given. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68890 llvm-svn: 374820
* remove FILE* usage from ReportEventState() and HandleProcessEvent()Lawrence D'Anna2019-10-142-3/+12
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP and SBFile versions of the API methods ReportEventState and HandleProcessEvent. It points the SWIG wrappers at these instead of the ones that use FILE* streams. Reviewers: JDevlieghere, jasonmolenda, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68546 llvm-svn: 374816
* update SBDebugger::SetInputFile() etc to work on native FilesLawrence D'Anna2019-10-101-0/+15
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP versions of SetInputFile(), SetOutputFile, and SetErrorFile(). SWIG will convert native python file objects into FileSP. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68734 llvm-svn: 374422
* SBFile support in SBCommandReturnObjectLawrence D'Anna2019-10-091-8/+19
| | | | | | | | | | | | | | | | | | Summary: This patch add SBFile interfaces to SBCommandReturnObject, and removes the internal callers of its FILE* interfaces. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68434 llvm-svn: 374238
* SBFile: add a bunch of tests that should eventually work.Lawrence D'Anna2019-10-091-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It's really annoying and confusing to have to keep referring back to earlier versions of this SBFile work to find the tests that need to be added for each patch, and not duplicate them with new tests. This patch just imports all my tests. A bunch of them don't work yet, so they are marked to be skipped. They'll be unmarked as I fix them. One of these tests will actually trip an assert in the SWIG code now instead of just failing, so I'm fixing that here too. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere, labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68433 llvm-svn: 374237
* Revert "[lldb] Calculate relative path for symbol links"Jim Ingham2019-10-091-4/+19
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit 958091c209d0a92e38b9cb27fb77a0ff7da11853. This commit incorrectly sets the _lldb.so symlink (at least it does when building in Stefans' two build directory mode, where you build llvm with cmake/ninja and lldb with cmake/Xcode, using a cmake generated project. The _lldb.so link is SUPPOSED to point to: bin/LLDB.framework/Versions/A/LLDB but instead it points to bin/LLDB which is where LLDB was staged to before constructing the framework. This causes all sorts of problems when we then build the lldb driver into bin - remember that MacOS is a case-preserving but case insensitive filesystem - so when we later go to dlopen _lldb.so, we dlopen the main executable instead. llvm-svn: 374226
* allow arbitrary python streams to be converted to SBFileLawrence D'Anna2019-10-092-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds SWIG typemaps that can convert arbitrary python file objects into lldb_private::File. A SBFile may be initialized from a python file using the constructor. There are also alternate, tagged constructors that allow python files to be borrowed, and for the caller to control whether or not the python I/O methods will be called even when a file descriptor is available.I Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: zturner, amccarth, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68188 llvm-svn: 374225
* [lldb] Unifying lldb python pathHaibo Huang2019-10-074-174/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on mgorny@'s D67890 There are 3 places where python site-package path is calculated independently: 1. finishSwigPythonLLDB.py where files are written to site-packages. 2. lldb/scripts/CMakeLists.txt where site-packages are installed. 3. ScriptInterpreterPython.cpp where site-packages are added to PYTHONPATH. This change creates the path once and use it everywhere. So that they will not go out of sync. Also it provides a chance for cross compiling users to specify the right path for site-packages. Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68442 llvm-svn: 373991
* [lldb] Fix crash on SBCommandReturnObject & assignmentJan Kratochvil2019-10-041-28/+2
| | | | | | | | | | | | | | | | | I was writing an SB API client and it was crashing on: bool DoExecute(SBDebugger dbg, char **command, SBCommandReturnObject &result) { result = subcommand(dbg, "help"); That is because SBCommandReturnObject &result gets initialized inside LLDB by: bool DoExecute(Args &command, CommandReturnObject &result) override { // std::unique_ptr gets initialized here from `&result`!!! SBCommandReturnObject sb_return(&result); DoExecute(...); sb_return.Release(); Differential revision: https://reviews.llvm.org/D67589 llvm-svn: 373775
* Componentize lldb/scripts to use with LLVM_DISTRIBUTION_COMPONENTSAntonio Afonso2019-10-041-1/+10
| | | | | | | | | | | | | | | | | | | | | | Summary: I'd like to install lldb using the install-distribution target with LLVM_DISTRIBUTION_COMPONENTS but this is currently not possible as the lldb/scripts do not provide any component we can use and install the python scripts. For this effect I created an lldb-python-scripts target and added the install-lldb-python-scripts llvm install target. I tested with: cmake ... -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_DISTRIBUTION_COMPONENTS="lldb;liblldb;lldb-python-scripts" ... DESTDIR=... ninja install-distribution Then checked with bin/lldb -x -o 'script import lldb' Reviewers: labath, xiaobai, clayborg, lanza Subscribers: mgorny, lldb-commits, smeenai, wallace Tags: #lldb Differential Revision: https://reviews.llvm.org/D68370 llvm-svn: 373768
* [lldb] Fix typo in r373675Sam McCall2019-10-041-1/+1
| | | | llvm-svn: 373719
* Pass an SBStructuredData to scripted ThreadPlans on use.Jim Ingham2019-10-033-1/+31
| | | | | | | | | | This will allow us to write reusable scripted ThreadPlans, since you can use key/value pairs with known keys in the plan to parametrize its behavior. Differential Revision: https://reviews.llvm.org/D68366 llvm-svn: 373675
* [lldb] Remove unused variables.Haibo Huang2019-10-031-5/+0
| | | | | | Fixes the comment in https://reviews.llvm.org/D67993 llvm-svn: 373669
* [lldb] Calculate relative path for symbol linksHaibo Huang2019-10-031-17/+4
| | | | | | | | | | | | | | Summary: This replaces the hard coded path. Reviewers: labath, mgorny Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67993 llvm-svn: 373668
* "Fix" TestFileHandle.py on non-darwin platformsPavel Labath2019-10-031-0/+8
| | | | | | | | | | | | | | | | | | This test exposed a very long standing issue that the python file objects returned by the FILE* typemap were unusable on non-darwin platforms. The reason they work on darwin is that they rely on a non-standard extension to fetch the "mode" of a FILE* object. On other platforms, this code was #ifdefed out, and so we were returning an empty mode. As there's no portable way to get this information, I just change the non-darwin path to return "r+", which should permit both reading and writing operations on the object. If the underlying file descriptor turns out to be incompatible with this mode, the operating system should return EBADF (or equivalent), instead of the "file not open for XXX" error from python. llvm-svn: 373573
* factor out an abstract base class for FileLawrence D'Anna2019-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch factors out File as an abstract base class and moves most of its actual functionality into a subclass called NativeFile. In the next patch, I'm going to be adding subclasses of File that don't necessarily have any connection to actual OS files, so they will not inherit from NativeFile. This patch was split out as a prerequisite for https://reviews.llvm.org/D68188 Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68317 llvm-svn: 373564
* SBDebugger::SetInputFile, SetOutputFile, etc.Lawrence D'Anna2019-10-031-0/+18
| | | | | | | | | | | | | | | | | | | | | Summary: Add new methods to SBDebugger to set IO files as SBFiles instead of as FILE* streams. In future commits, the FILE* methods will be deprecated and these will become the primary way to set the debugger I/O streams. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68181 llvm-svn: 373563
OpenPOWER on IntegriCloud