summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python
Commit message (Collapse)AuthorAgeFilesLines
* Remove `FindSessionDictionary` and rely on PythonDataObjects.Zachary Turner2015-11-111-190/+140
| | | | | | | | This had been relegated to a simple forwarding function, so just delete it in preparation of migrating all of these functions out of python-wrapper.swig. llvm-svn: 252803
* Convert python-wrapper.swig to use PythonDataObjects.Zachary Turner2015-11-111-99/+43
| | | | | | | | | This only begins to port python-wrapper.swig over. Since this code can be pretty hairy, I plan to do this incrementally over a series of patches, each time removing or converting more code over to the PythonDataObjects code. llvm-svn: 252788
* Symlink the `six` module during swig generation.Zachary Turner2015-11-111-22/+43
| | | | llvm-svn: 252764
* Fixed TypeMemberFunctionImpl to not use clang types directly but use the new ↵Greg Clayton2015-11-101-0/+14
| | | | | | | | | | CompilerDecl class to do the job in an abstract way. Fixed a crash that would happen if you tried to get the name of a constructor or destructor by calling "getDeclName()" instead of calling getName() (which would assert and crash). Added the ability to get function arguments names from SBFunction. llvm-svn: 252622
* Use PythonDataObjects in swig helper functions.Zachary Turner2015-11-091-31/+31
| | | | | | | | | | | | | | | | | Relying on manual Python C API calls is error prone, especially when trying to maintain compatibility with Python 2 and Python 3. This patch additionally fixes what appears to be a potentially serious memory leak, in that were were incref'ing two values returned from the session dictionary but never decref'ing them. There was a comment indicating that it was intentional, but the reasoning was, I believe, faulty and it resulted in a legitimate memory leak. Switching everything to PythonObject based classes solves both the compatibility issues as well as the resource leak issues. llvm-svn: 252536
* Remove a debug print statement.Zachary Turner2015-11-071-1/+0
| | | | llvm-svn: 252384
* Python 3 - Use __bool__() instead of __nonzero__() for truthiness.Zachary Turner2015-11-072-1/+38
| | | | | | | | | | | | | | | | | | | | | | | Python has a complicated mechanism of checking an objects truthity. This involves a number of steps, which end with calling two private methods on an object (if they are implemented). In Python 2 these two methods are `__nonzero__` and `__len__`, and in Python 3 they are `__bool__` and `__len__`. Because we *also* define a __len__ method for certain iterable types, this was triggering a situation in Python 3 where `__nonzero__` wasn't defined, so it was calling `__len__`, which was returning 0 (for example an SBDebugger with no targets), and as a result the truthosity was determined to be False. We fix this by correctly using ` __bool__` for Python 3, and leave the behavior under Python 2 unchanged. Note that this fix is only implemented in the SWIG generation python script, and not the SWIG generation shell script. Someone more familiar than me with shell scripts will need to fix them to support this for Python 3 if desired. llvm-svn: 252382
* [swig] Remove check_lldb_swig_executable_file_exists.Bruce Mitchener2015-11-061-33/+21
| | | | | | | | | | | | | | | | | Summary: Code that tried to find swig and then split the path into a separate path and filename is being removed. The invoking build system always provides the location of swig and we don't need to split it into 2 pieces only to recombine it a short time later. Reviewers: zturner, domipheus Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14415 llvm-svn: 252330
* [swig] Start of pylint on python build scripts.Bruce Mitchener2015-11-053-1059/+1053
| | | | | | | | | | | | | | | | | | | | | | | Summary: This does a broad first pass on cleaning up a lot of the noise when using pylint on these scripts. It mostly addresses issues of: * Mixed tabs and spaces. * Trailing whitespace. * Semicolons where they aren't needed. * Incorrect whitespace around () and []. * Superfluous parentheses. There will be subsequent patches with further changes that build upon these. Reviewers: zturner, domipheus Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14375 llvm-svn: 252244
* Revert "Python 3 - Don't add the _d suffix to the symlink on Windows."Zachary Turner2015-11-041-4/+2
| | | | | | | | | | | | This reverts commit e59c95ca936f5a0a8abb987b8605fd8bf82b03b6. This was a mistake on my part. The real problem was with my environment. I was using a release interpreter to try to load my debug extension module. I noticed this after I finally managed to get into my extension module's init method, and then it segfaulted with heap errors due to mismatched CRT (debug vs. release) llvm-svn: 252030
* Python 3 - Don't add the _d suffix to the symlink on Windows.Zachary Turner2015-11-041-2/+4
| | | | | | | | | | | In Python 2, a debug extension module required an _d suffix, so for example the extension module `_lldb` would be backed by the file `_lldb_d.pyd` if built in debug mode, and `_lldb.pyd` if built in release mode. In Python 2, although undocumented, this seems to no longer be the case, and even for a debug extension module, the interpreter will only look for the `_lldb.pyd` name. llvm-svn: 252026
* Revert part of r239007 related to creating the Python symlink.Zachary Turner2015-11-021-9/+0
| | | | | | | | | | | | | | | This has apparently been broken since June, but only on non-Windows. Perhaps nobody noticed it because if the symlink is already there it won't try to re-create it, and nobody ever tried doing a clean build. In any case, I will let the original author attempt to fix this if he is still interested. the problem is that in the normal case of not setting BUILD_SHARED_LIBS and simply running ninja, it would link _lldb.so to a non-existent location, creating a dangling symlink. llvm-svn: 251840
* Rename argdumper to lldb-argdumperTodd Fiala2015-10-292-13/+13
| | | | | | http://reviews.llvm.org/D14169 llvm-svn: 251616
* [SBValue] Add a method GetNumChildren(uint32_t max)Siva Chandra2015-10-211-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Run py2to3 on lldb/scripts folder.Zachary Turner2015-10-192-19/+19
| | | | | | | This mostly fixes some print statements, but there were also some instances of dict.iteritems() lingering that this found. llvm-svn: 250762
* Python: follow python guidelines for header usageSaleem Abdulrasool2015-10-191-1/+5
| | | | | | | Python requires that Python.h is included before any std header. Not doing so results in conflicts with standards macros such as `_XOPEN_SOURCE`. NFC. llvm-svn: 250673
* Make swig generation python scripts python 3 compatible.Zachary Turner2015-10-161-26/+26
| | | | llvm-svn: 250532
* Convert SWIG typemap string operations to PythonObjects.Zachary Turner2015-10-161-32/+45
| | | | llvm-svn: 250530
* Update SWIG typemaps to use `PythonFile`.Zachary Turner2015-10-161-12/+18
| | | | | | | | 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
* Change swig interface files to use PythonDataObjects.Zachary Turner2015-10-142-82/+85
| | | | llvm-svn: 250303
* Simple readline functionality for interactive python on linux.Ryan Brown2015-10-062-6/+55
| | | | | | Differential Revision: http://reviews.llvm.org/D13268 llvm-svn: 249478
* Update swig generation scripts to support Python 3.Zachary Turner2015-10-062-31/+35
| | | | llvm-svn: 249467
* Convert "long" input to "long long" in typemap for lldb::tid_t.Siva Chandra2015-09-041-1/+1
| | | | | | | | | | | | Summary: lldb::tid_t is 64 bit, but "long" need not always be 64 bit. Reviewers: chying, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12650 llvm-svn: 246885
* We want Python int or long to both be usable as-a tid_t for API purposes. ↵Enrico Granata2015-09-021-0/+12
| | | | | | Introduce a typemap to this effect llvm-svn: 246709
* [Python] Allow PyLong values in integer lists (when converting to C lists)Siva Chandra2015-07-011-0/+32
| | | | | | | | | | | | | | Test Plan: dotest.py -p TestSBData Reviewers: clayborg, granata.enrico Reviewed By: clayborg, granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10821 llvm-svn: 241208
* [LLDBSwigPythonCallTypeScript] Remove redundant call to type summary func.Siva Chandra2015-06-251-2/+0
| | | | | | | | | | | | Reviewers: clayborg, granata.enrico Reviewed By: clayborg, granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10625 llvm-svn: 240698
* [lldb] Enable building with Cmake/BUILD_SHARED_LIBSAndrew Wilkins2015-06-041-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Several changes to fix CMake builds of LLDB with the BUILD_SHARED_LIBS setting on. - Force all internal libraries to be built STATIC. - Add additional library dependencies (pthread, dl, runtimedyld). - modify finalisation of SWIG wrapper to symlink the "lib" dir into python/site-packages, so _lldb.so's RPATH resolves. Test Plan: Verified one test case with "dotest.py". Reviewers: sylvestre.ledru, zturner Reviewed By: zturner Subscribers: zturner, ted, tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D10157 llvm-svn: 239007
* Add language option in -gdb-show command (MI)Ilia K2015-04-282-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add language option in -gdb-show command + test: ``` $ bin/lldb-mi ~/p/hello [...] b main [...] r [...] (gdb) -gdb-show language ^done,value="c++" (gdb) quit ``` Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/ Reviewers: abidh, granata.enrico, jingham, clayborg Reviewed By: clayborg Subscribers: lldb-commits, jingham, granata.enrico, clayborg, abidh Differential Revision: http://reviews.llvm.org/D9279 llvm-svn: 235983
* Add SBLaunchInfo in include/lldb/API/SBDefines.h and fix spacing in ↵Ilia K2015-04-261-2/+2
| | | | | | scripts/Python/buildSwigPython.py llvm-svn: 235819
* Start to share SWIG interface files between languages.Bruce Mitchener2015-04-2459-9837/+100
| | | | | | | | | | | | | | | | | | | | Summary: Move scripts/Python/interface to scripts/interface so that we can start making iterative improvements towards sharing the interface files between multiple languages (each of which would have their own directory as now). Test Plan: Build and see. Reviewers: zturner, emaste, clayborg Reviewed By: clayborg Subscribers: mjsabby, lldb-commits Differential Revision: http://reviews.llvm.org/D9212 llvm-svn: 235676
* Factor resolution of abbreviations and aliases so that they can be tested ↵Adrian McCarthy2015-04-231-0/+3
| | | | | | directly. http://reviews.llvm.org/D9033 llvm-svn: 235633
* Use the debugginess of the python interpreter when symlinking _lldb.pyd.Zachary Turner2015-04-221-2/+4
| | | | | | | | | | | | | | Previously we would pass an argument to finishSwigWrapperClasses.py which specified whether this was a debug or a release build. But sometimes CMAKE_BUILD_TYPE would not be set to anything, causing this argument to be empty when passed in. The only purpose of this argument was to determine whether or not to append _d to the extension module when creating the symlink. This is only necessary when doing a debug build of LLDB on Windows, which implies a debug interpreter, so we replace this with a check to see if the running interpreter is a debug one, and append _d if so. llvm-svn: 235559
* Add properties to SBExecutionContext to access the several entities it ↵Enrico Granata2015-04-211-0/+15
| | | | | | stores in a more Pythonic fashion llvm-svn: 235447
* Don't use literal slashes when concatenating paths in Python.Zachary Turner2015-04-031-38/+34
| | | | | | | | This patch fixes the swig generation scripts to use os.path.join instead, which produces correctly normalized paths for platforms that don't use the standard forward slash separator. llvm-svn: 234030
* Turn off 'quit' confirmation in lldb-miIlia K2015-03-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: # Turn off interpreter.prompt-on-quit on startup (MI) # Add CommandInterpreter::SetPromptOnQuit # Add SBCommandInterpreter::GetPromptOnQuit/SetPromptOnQuit All tests pass on OS X. Test Plan: ``` -file-exec-and-symbols ~/p/hello -break-insert -f main -exec-run -interpreter-exec console quit ``` Reviewers: abidh, clayborg Reviewed By: abidh, clayborg Subscribers: lldb-commits, clayborg, abidh Differential Revision: http://reviews.llvm.org/D8444 llvm-svn: 233034
* Fix missing interfaces to scripts/Python/interface after r229110, r231858 ↵Ilia K2015-03-233-1/+28
| | | | | | | | | | | and r232891 This includes: # SBCommandInterpreter::EventIsCommandInterpreterEvent # SBModule::GetSymbolFileSpec/GetObjectFileHeaderAddress # SBTarget::EventIsTargetEvent/GetTargetFromEvent/GetNumModulesFromEvent/GetModuleAtIndexFromEvent/GetLaunchInfo/SetLaunchInfo llvm-svn: 233029
* Remove non-standard Environment header sectionEd Maste2015-03-232-10/+0
| | | | llvm-svn: 232973
* Use .so library extension by default if platform is not Windows or DarwinEd Maste2015-03-231-3/+3
| | | | llvm-svn: 232970
* Fix whitespace in finishSwigWrapperClasses.pyEd Maste2015-03-231-659/+659
| | | | | | | - replace hard tabs with 4-space indents - delete EOL whitespace llvm-svn: 232969
* Fix the clang -Werror build & make the unit tests link under LinuxDavid Blaikie2015-03-171-16/+10
| | | | | | | | The order of libraries passed to the linker didn't work under linux (you need the llvm libraries first, then the lldb libraries). I modelled this after clang's setup here. Seemed simple enough to just be consistent. llvm-svn: 232461
* Handle PyLong return values in LLDBSwigPython_CalculateNumChildren.Siva Chandra2015-03-161-4/+24
| | | | | | | | | | | | | | | | | | | | | | Summary: Also, change its return type to size_t to match the return types of its callers. With this change, std::vector and std::list data formatter tests pass on Linux (when using libstdc++) with clang as well as with gcc. These tests have also been enabled in this patch. Test Plan: dotest.py -p <TestDataFormatterStdVector|TestDataFormatterStdList> Reviewers: vharron, clayborg Reviewed By: clayborg Subscribers: zturner, lldb-commits Differential Revision: http://reviews.llvm.org/D8337 llvm-svn: 232399
* Strip trailing whitespace from python-wrapper.swigEd Maste2015-03-141-158/+158
| | | | | | (To test the dependency added in r232256.) llvm-svn: 232257
* Bulk of the infrastructure work to allow script commands to be backed by ↵Enrico Granata2015-03-131-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | object instances in addition to free functions This works by creating a command backed by a class whose interface should - at least - include def __init__(self, debugger, session_dict) def __call__(self, args, return_obj, exe_ctx) What works: - adding a command via command script add --class - calling a thusly created command What is missing: - support for custom help - test cases The missing parts will follow over the next couple of days This is an improvement over the existing system as: a) it provides an obvious location for commands to provide help strings (i.e. methods) b) it allows commands to store state in an obvious fashion c) it allows us to easily add features to script commands over time (option parsing and subcommands registration, I am looking at you :-) llvm-svn: 232136
* [swig] Fix some typos in the build scripts.Bruce Mitchener2015-02-262-3/+3
| | | | | | | | | | | | Reviewers: zturner, ki.stfu Reviewed By: zturner, ki.stfu Subscribers: ki.stfu, lldb-commits Differential Revision: http://reviews.llvm.org/D7912 llvm-svn: 230706
* [swig] Generate bindings for SBDebugger::*UseColor().Bruce Mitchener2015-02-261-0/+6
| | | | | | | | | | | | | | | | Summary: These functions were added in 2013, but not added to the SWIG bindings. Reviewers: ki.stfu, clayborg Reviewed By: ki.stfu, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7909 llvm-svn: 230646
* Rename the "glob arguments" feature to "shell expand arguments"Enrico Granata2015-02-201-2/+2
| | | | | | This should not bring any feature change, except changing names of things here and there llvm-svn: 230077
* Fix make_symlink in case when symlink already exists (after r229517)Ilia K2015-02-181-0/+2
| | | | llvm-svn: 229682
* Fix typo in make_symlink after r229517. It fixes symlinks on a UNIX style ↵Ilia K2015-02-181-1/+0
| | | | | | platform. llvm-svn: 229674
* Fix argdumper build in cmake (OS X) after r228636Ilia K2015-02-172-127/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previos version of this patch (see r229148) contained two errors: * make_symlink_darwin_debug passes 2 arguments into make_symlink, but it required 4 arguments (was fixed by r229159) * make_symlink doesn't work on OS X As a quick fix, the r229148 and the r229159 were reverted. Now these errors are fixed. Summary: This patch fixes the following tests on OS X: ``` FAIL: test_with_dsym (TestLaunchWithGlob.LaunchWithGlobTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 456, in wrapper return func(self, *args, **kwargs) File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 21, in test_with_dsym self.do_test () File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd())) File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd msg if msg else CMD_MSG(cmd)) AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully Config=x86_64-clang ====================================================================== FAIL: test_with_dwarf (TestLaunchWithGlob.LaunchWithGlobTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 473, in wrapper return func(self, *args, **kwargs) File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 28, in test_with_dwarf self.do_test () File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd())) File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd msg if msg else CMD_MSG(cmd)) AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully ``` Reviewers: epertoso, emaste, abidh, clayborg, zturner Reviewed By: clayborg Subscribers: abidh, lldb-commits, emaste, epertoso, zturner, clayborg Differential Revision: http://reviews.llvm.org/D7550 llvm-svn: 229517
* Revert "Revert "I had recently added a new SBFrame::GetVariables() overload ↵Zachary Turner2015-02-173-6/+64
| | | | | | | | | | | with yet another bool argument"" Reverting this commit led to other failures which I did not see at first. This turned out to be an easy problem to fix, so I added SBVariablesOptions.cpp to the CMakeLists.txt. In the future please try to make sure new files are added to CMake. llvm-svn: 229516
OpenPOWER on IntegriCloud