summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandObjectScript.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/Scripting] Simplify code by removing the #if.Jonas Devlieghere2019-12-181-11/+3
| | | | | | | | | The "none" script interpreter does not depend on Python so it doesn't make sense to have it withing the if-block. The only goal seems to be to have a slightly different error for when there's no script interpreter, but as per the comment this doesn't make sense for more than one scripting language. I think the existing error is perfectly clear, so I just removed this altogether.
* [lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHONJonas Devlieghere2019-12-131-7/+7
| | | | | | | This matches the naming scheme used by LLVM and all the other optional dependencies in LLDB. Differential revision: https://reviews.llvm.org/D71482
* [lldb/Host] Use Host/Config.h entries instead of a global define.Jonas Devlieghere2019-12-101-4/+1
| | | | | | | | | | | As suggested by Pavel in a code review: > Can we replace this (and maybe python too, while at it) with a > Host/Config.h entry? A global definition means that one has to > recompile everything when these change in any way, whereas in > practice only a handful of files need this.. Differential revision: https://reviews.llvm.org/D71280
* [ScriptInterpreter] Move ownership into debugger (NFC)Jonas Devlieghere2019-04-261-1/+1
| | | | | | | | | | | | | | This is part two of the change started in r359330. This patch moves the ownership of the script interpreter from the command interpreter into the debugger. I would've preferred to remove the lazy initialization, however the fact that the scripting language is set after the debugger is created makes that tricky. So for now this does exactly the same thing as when it was under the command interpreter. The result is that this patch is fully NFC. Differential revision: https://reviews.llvm.org/D61211 llvm-svn: 359354
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Get rid of the C-string parameter in DoExecuteRaphael Isemann2018-07-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch gets rid of the C-string parameter in the RawCommandObject::DoExecute function, making the code simpler and less memory unsafe. There seems to be a assumption in some command objects that this parameter could be a nullptr, but from what I can see the rest of the API doesn't actually allow this (and other command objects and related code pieces dereference this parameter without any checks). Especially CommandObjectRegexCommand has error handling code for a nullptr that is now gone. Reviewers: davide, jingham, teemperor Reviewed By: teemperor Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D49207 llvm-svn: 336955
* Move Args.cpp from Interpreter to UtilityPavel Labath2018-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: The Args class is used in plenty of places besides the command interpreter (e.g., anything requiring an argc+argv combo, such as when launching a process), so it needs to be in a lower layer. Now that the class has no external dependencies, it can be moved down to the Utility module. This removes the last (direct) dependency from the Host module to Interpreter, so I remove the Interpreter module from Host's dependency list. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D45480 llvm-svn: 330200
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-50/+46
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* LLDB help content has accumulated over time without a recent attempt toKate Stone2016-07-141-5/+4
| | | | | | | | | review it for consistency, accuracy, and clarity. These changes attempt to address all of the above while keeping the text relatively terse. <rdar://problem/24868841> llvm-svn: 275485
* Don't #include "lldb-python.h" from anywhere.Zachary Turner2015-05-291-2/+0
| | | | | | | | | | | | | Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
* Switch NULL to C++11 nullptr in source/InterpreterEd Maste2014-04-201-2/+2
| | | | | | Patch by Robert Matusewicz llvm-svn: 206711
* *ahem* Enrico.Jason Molenda2013-02-201-1/+1
| | | | llvm-svn: 175691
* <rdar://problem/13147878>Enrico Granata2013-02-191-0/+14
| | | | | | | | | | Be more user-friendly about not having scripting enabled: a) if Python was built-out then tell people about it explicitly b) if we are told to use none as a scripting language, then tell people about that too This should limit the cases where the semi-cryptic error message "there is no embedded script interpreter in this mode." actually shows llvm-svn: 175570
* <rdar://problem/12978143>Enrico Granata2013-01-281-3/+4
| | | | | | | | | | | Data formatters now cache themselves. This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval. Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization. The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime. Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type. Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose. llvm-svn: 173728
* Fix a few more clang (3.2) warnings on Linux:Daniel Malea2012-12-071-2/+1
| | | | | | | | | | | | | | | | | - remove unused members - add NO_PEDANTIC to selected Makefiles - fix return values (removed NULL as needed) - disable warning about four-char-constants - remove unneeded const from operator*() declaration - add missing lambda function return types - fix printf() with no format string - change sizeof to use a type name instead of variable name - fix Linux ProcessMonitor.cpp to be 32/64 bit friendly - disable warnings emitted by swig-generated C++ code Patch by Matt Kopec! llvm-svn: 169645
* Fix Linux build warnings due to redefinition of macros:Daniel Malea2012-12-051-0/+2
| | | | | | | | | - add new header lldb-python.h to be included before other system headers - short term fix (eventually python dependencies must be cleaned up) Patch by Matt Kopec! llvm-svn: 169341
* <rdar://problem/12586188> Make ImportError a special case for "command ↵Enrico Granata2012-10-311-1/+1
| | | | | | | | | | | 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
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-0/+1
| | | | llvm-svn: 165808
* Make raw & parsed commands subclasses of CommandObject rather than having ↵Jim Ingham2012-06-081-23/+5
| | | | | | | | | | | | | | | | the raw version implement an Execute which was never going to get run and another ExecuteRawCommandString. Took the knowledge of how to prepare raw & parsed commands out of CommandInterpreter and put it in CommandObject where it belongs. Also took all the cases where there were the subcommands of Multiword commands declared in the .h file for the overall command and moved them into the .cpp file. Made the CommandObject flags work for raw as well as parsed commands. Made "expr" use the flags so that it requires you to be paused to run "expr". llvm-svn: 158235
* <rdar://problem/11538779> Fixing issues where Python scripts were not able ↵Enrico Granata2012-06-071-1/+1
| | | | | | 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
* More cleanups ; Separated implementation of FormatManager from class ↵Enrico Granata2011-08-221-1/+1
| | | | | | DataVisualization as a front-end by using separate .h/.cpp files - Final aim is to break up FormatManager.h/cpp into several separate files llvm-svn: 138279
* Second round of code cleanups:Enrico Granata2011-08-181-1/+2
| | | | | | | | | | | | | | | - reorganizing classes layout to have public part first Typedefs that we want to keep private, but must be defined for some public code to work correctly are an exception - avoiding methods in the form T foo() { code; } all on one-line - moving method implementations from .h to .cpp whenever feasible Templatized code is an exception and so are very small methods - generally, adhering to coding conventions followed project-wide Functional changes: - fixed an issue where using ${var} in a summary for an aggregate, and then displaying a pointer-to-aggregate would lead to no summary being displayed The issue was not a major one because all ${var} was meant to do in that context was display an error for invalid use of pointer Accordingly fixed test cases and added a new test case llvm-svn: 137944
* First round of code cleanups:Enrico Granata2011-08-171-2/+2
| | | | | | | | | | | | | | | | | | - all instances of "vobj" have been renamed to "valobj" - class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp) The interface to this class has not changed - FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting from ConstString to const char* and back all the time Next step is making the same happen for categories themselves - category gnu-libstdc++ is defined in the constructor for a FormatManager The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time All references to previous 'osxcpp' name have been removed from both code and file names Functional changes: - the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script will become -o llvm-svn: 137886
* Python synthetic children:Enrico Granata2011-07-241-0/+5
| | | | | | | | | | | | | | - you can now define a Python class as a synthetic children producer for a type the class must adhere to this "interface": def __init__(self, valobj, dict): def get_child_at_index(self, index): def get_child_index(self, name): then using type synth add -l className typeName (e.g. type synth add -l fooSynthProvider foo) (This is still WIP with lots to be added) A small test case is available also as reference llvm-svn: 135865
* Split up the Python script interpreter code to allow multiple script ↵Caroline Tice2011-01-141-24/+3
| | | | | | | | | | | interpreter objects to exist within the same process (one script interpreter object per debugger object). The python script interpreter objects are all using the same global Python script interpreter; they use separate dictionaries to keep their data separate, and mutex's to prevent any object attempting to use the global Python interpreter when another object is already using it. llvm-svn: 123415
* Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener.Greg Clayton2011-01-081-1/+1
| | | | | | Thanks Bruce! llvm-svn: 123083
* Fixed the way set/show variables were being accessed to being natively Greg Clayton2010-09-181-10/+9
| | | | | | | | | | | | | | | | | | accessed by the objects that own the settings. The previous approach wasn't very usable and made for a lot of unnecessary code just to access variables that were already owned by the objects. While I fixed those things, I saw that CommandObject objects should really have a reference to their command interpreter so they can access the terminal with if they want to output usaage. Fixed up all CommandObjects to take an interpreter and cleaned up the API to not need the interpreter to be passed in. Fixed the disassemble command to output the usage if no options are passed down and arguments are passed (all disassebmle variants take options, there are no "args only"). llvm-svn: 114252
* Small help text fixes, to make it more consistent and accurate.Caroline Tice2010-09-071-2/+2
| | | | | | Temporarily remove -l option from 'expr' command (at Sean's request). llvm-svn: 113298
* We can do better when reporting the status of one-liner script execution.Johnny Chen2010-07-301-3/+10
| | | | | | | | | Change the prototype of ScriptInterpreter::ExecuteOneLine() to return bool instead of void and take one additional parameter as CommandReturnObject *. Propagate the status of one-liner execution back appropriately. llvm-svn: 109899
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-231-58/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to the debugger from GUI windows. Previously there was one global debugger instance that could be accessed that had its own command interpreter and current state (current target/process/thread/frame). When a GUI debugger was attached, if it opened more than one window that each had a console window, there were issues where the last one to setup the global debugger object won and got control of the debugger. To avoid this we now create instances of the lldb_private::Debugger that each has its own state: - target list for targets the debugger instance owns - current process/thread/frame - its own command interpreter - its own input, output and error file handles to avoid conflicts - its own input reader stack So now clients should call: SBDebugger::Initialize(); // (static function) SBDebugger debugger (SBDebugger::Create()); // Use which ever file handles you wish debugger.SetErrorFileHandle (stderr, false); debugger.SetOutputFileHandle (stdout, false); debugger.SetInputFileHandle (stdin, true); // main loop SBDebugger::Terminate(); // (static function) SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to ensure nothing gets destroyed too early when multiple clients might be attached. Cleaned up the command interpreter and the CommandObject and all subclasses to take more appropriate arguments. llvm-svn: 106615
* Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.Jim Ingham2010-06-151-1/+1
| | | | llvm-svn: 106034
* Moved files around for linux build. Fixed up Xcode project toGreg Clayton2010-06-121-0/+149
refer to the new locations. llvm-svn: 105885
OpenPOWER on IntegriCloud