summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python
Commit message (Collapse)AuthorAgeFilesLines
* Remove dependency from Host to pythonPavel Labath2018-06-203-1/+85
| | | | | | | | | | | | | | | | Summary: The only reason python was used in the Host module was to compute the python path. I resolve this the same way as D47384 did for clang, by moving the path computation into the python plugin and modifying SBHostOS class to call into this module for ePathTypePythonDir. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D48215 llvm-svn: 335104
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-191-3/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
* [FileSpec] Delegate common operations to llvm::sys::pathJonas Devlieghere2018-06-131-2/+2
| | | | | | | | | | | | | | | With the recent changes in FileSpec to use LLVM's path style, it is possible to delegate a bunch of common path operations to LLVM's path helpers. This means we only have to maintain a single implementation and at the same time can benefit from the efforts made by the rest of the LLVM community. This is part one of a set of patches. There was no obvious way to split this so I just worked from top to bottom. Differential revision: https://reviews.llvm.org/D48084 llvm-svn: 334615
* Reflow paragraphs in comments.Adrian Prantl2018-04-303-199/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* s/LLVM_ON_WIN32/_WIN32/, lldbNico Weber2018-04-101-1/+1
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 329697
* Revert r317182 for https://reviews.llvm.org/D39128Jason Molenda2017-11-024-172/+17
| | | | | | | we're still failing on android. I'll ask Larry to ask Pavel for any tips he might be able to give. llvm-svn: 317183
* Commit Lawrence D'Anna's patch to changeJason Molenda2017-11-024-17/+172
| | | | | | | | | | | | | | | SetOututFileHandle to work with IOBase. I did make one change after checking with Larry -- I renamed SBDebugger::Flush to FlushDebuggerOutputHandles and added a short docstring to the .i file to make it a little clearer under which context programs may need to use this API. Differential Revision: https://reviews.llvm.org/D39128 <rdar://problem/34870417> llvm-svn: 317182
* Ahhhh roll back that commit, I didn't see that Lawrence had filedJason Molenda2017-11-023-134/+18
| | | | | | | a separate phabracator with the revised change. This was his first atttempt which broke on the bots the second time too. llvm-svn: 317181
* Commit Lawrence D'Anna's patch to changeJason Molenda2017-11-023-18/+134
| | | | | | | | | | | | | | SetOututFileHandle to work with IOBase. I did make one change after checking with Larry -- I renamed SBDebugger::Flush to FlushDebuggerOutputHandles and added a short docstring to the .i file to make it a little clearer under which context programs may need to use this API. Differential Revision: https://reviews.llvm.org/D38829 llvm-svn: 317180
* Reverting r315966 - it caused a build failure on an ubuntu x android bot.Jason Molenda2017-10-173-134/+18
| | | | llvm-svn: 315967
* Committing this for Larry D'Anna:Jason Molenda2017-10-173-18/+134
| | | | | | | | | | | This patch adds support for passing an arbitrary python stream (anything inheriting from IOBase) to SetOutputFileHandle or SetErrorFileHandle. Differential revision: https://reviews.llvm.org/D38829 <rdar://problem/34870417> llvm-svn: 315966
* Don't access Python objects while not holding the GIL.Zachary Turner2017-07-091-8/+6
| | | | | | | Patch by Tatyana Krasnukha Differential Revision: https://reviews.llvm.org/D34942 llvm-svn: 307512
* Move Timer and TraceOptions from Core to UtilityPavel Labath2017-06-291-1/+1
| | | | | | | | | | | | | | Summary: The classes have no dependencies, and they are used both by lldb and lldb-server, so it makes sense for them to live in the lowest layers. Reviewers: zturner, jingham Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34746 llvm-svn: 306682
* Move StructuredData from Core to UtilityPavel Labath2017-06-271-1/+1
| | | | | | | | | | | | | | | | Summary: It had a dependency on StringConvert and file reading code, which is not in Utility. I've replaced that code by equivalent llvm operations. I've added a unit test to demonstrate that parsing a file still works. Reviewers: zturner, jingham Subscribers: kubamracek, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34625 llvm-svn: 306394
* Remove an expensive lock from TimerPavel Labath2017-05-151-5/+8
| | | | | | | | | | | | | The Timer destructor would grab a global mutex in order to update execution time. Add a class to define a category once, statically; the class adds itself to an atomic singly linked list, and thus subsequent updates only need to use an atomic rather than grab a lock and perform a hashtable lookup. Differential Revision: https://reviews.llvm.org/D32823 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 303058
* Rename Error -> Status.Zachary Turner2017-05-122-44/+44
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Resubmit FileSystem changes.Zachary Turner2017-03-081-5/+8
| | | | | | | | | | This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
* Revert "Use LLVM for all stat-related functionality."Pavel Labath2017-03-071-9/+5
| | | | | | | | | | | | | | | this reverts r297116 because it breaks the unittests and TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat functionality is not a drop-in replacement for lldb's. The former is based on stat(2) (which does symlink resolution), while the latter is based on lstat(2) (which does not). This also reverts subsequent build fixes (r297128, r297120, 297117) and r297119 (Remove FileSpec dependency on FileSystem) which builds on top of this. llvm-svn: 297139
* Use LLVM for all stat-related functionality.Zachary Turner2017-03-071-5/+9
| | | | | | | | | | This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
* Remove dependencies from Utility to Core and Target.Zachary Turner2017-02-141-1/+2
| | | | | | | | | | With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 llvm-svn: 295088
* Switch std::call_once to llvm::call_onceKamil Rytarowski2017-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
* Remove LIBLLDB_LOG_VERBOSE categoryPavel Labath2017-02-051-24/+12
| | | | | | | | | | | | | | | | | | | | | Summary: Per discussion in D28616, having two ways two request logging (log enable lldb XXX verbose && log enable -v lldb XXX) is confusing. This removes the first option and standardizes all code to use the second one. I've added a LLDB_LOGV macro as a shorthand for if(log && log->GetVerbose()) and switched most of the affected log statements to use that (I've only left a couple of cases that were doing complex computations in an if(log) block). Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D29510 llvm-svn: 294113
* Move classes from Core -> Utility.Zachary Turner2017-02-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* [CMake] [4/4] Update a batch of pluginsChris Bieneman2017-01-311-1/+11
| | | | | | This is extending the updates from r293696 to more LLDB plugins. llvm-svn: 293701
* Fix clang build for r291198Pavel Labath2017-01-061-1/+1
| | | | | | | | | Older clangs (<=3.6) complain about a redefinition when we try to specialize a templace function declared with = delete. Instead, I just don't define the function body, which will trigger a linker error if someone tries to use an unknown function. llvm-svn: 291226
* Make lldb -Werror clean for -Wstring-conversionDavid Blaikie2017-01-061-6/+1
| | | | | | | | | Also found/fixed one bug identified by this warning in RenderScriptx86ABIFixups.cpp where a string literal was being used in an effort to provide a name for an instruction/register, but was instead being passed as the bool 'isVolatile' parameter. llvm-svn: 291198
* 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
OpenPOWER on IntegriCloud