summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix "help language", the languages printer was assuming the Jim Ingham2015-04-171-6/+3
| | | | | | | eLanguageType numbers would be sequential, but vendor types are not and the printer went crazy. llvm-svn: 235153
* Making linking against Python simpler on Windows.Zachary Turner2015-04-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This patch deprecates the three Python CMake variables in favor of a single variable PYTHON_HOME which points to the root of a python installation. Since building Python doesn't output the files in a structure that is compatible with the PYTHONHOME environment variable, we also provide a script install_custom_python.py which will copy the output of a custom python build to the correct directory structure. The supported workflow after this patch will be to build python once for each configuration and architecture {Debug,Release} x {x86,x64} and then run the script. Then run CMake specifying -DPYTHON_HOME=<path> The first time you do this will probably require you to delete your CMake cache. The old workflow is still supported during a transitionary period, but a warning is printed at CMake time, and this will eventually be removed. Differential Revision: http://reviews.llvm.org/D8979 llvm-svn: 234660
* Fix a problem where 'process launch' was not correctly re-quoting arguments ↵Enrico Granata2015-04-101-1/+2
| | | | | | | | for the inferior process when handing them down for the actual launch This covers most of rdar://20490076, but leaves one corner case still open - namely the case where we try to have arguments of the form foo\ bar (unquoted, but slashed) go through argdumper llvm-svn: 234554
* [Python] Fix issue configuring sys.path during startup.Zachary Turner2015-04-091-27/+30
| | | | | | | | | | Previously, users on Windows had to manually specify PYTHONPATH to point to the site-packages directory before running LLDB. The reason for this was because sys.path was being initialized with a path containing unescaped backslashes, causing escape sequences to end up in the paths. llvm-svn: 234516
* Fix check for options in "command alias"Ted Woodward2015-04-061-3/+3
| | | | | | | | | | | | | | | | | Summary: "command alias" can add invalid options to the command. "command alias start process launch -s" will add an extra argument, "<no-argument>" to the alias, so it runs "process launch -s <no-argument>", which launches the process with args that include "<no-argument>". This patch changes the text compare of the variable value with "<OptionParser::eNoArgument>" to a compare of variable value_type with OptionParser::eNoArgument. It also moves the previous test inside the if, so it won't add a trailing space if there is no argument. Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8844 llvm-svn: 234244
* Fix warnings generated by clang-cl.Zachary Turner2015-04-021-7/+4
| | | | | | | | | | | | | | There were a couple of real bugs here regarding error checking and signed/unsigned comparisons, but mostly these were just noise. There was one class of bugs fixed here which is particularly annoying, dealing with MSVC's non-standard behavior regarding the underlying type of enums. See the comment in lldb-enumerations.h for details. In short, from now on please use FLAGS_ENUM and FLAGS_ANONYMOUS_ENUM when defining enums which contain values larger than can fit into a signed integer. llvm-svn: 233943
* Rework LLDB system initialization.Zachary Turner2015-03-312-120/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In an effort to reduce binary size for components not wishing to link against all of LLDB, as well as a parallel effort to reduce link dependencies on Python, this patch splits out the notion of LLDB initialization into "full" and "common" initialization. All code related to initializing the full LLDB suite lives directly in API now. Previously it was only referenced from API, but because it was defined in lldbCore, it would get implicitly linked against by everything including lldb-server, causing a considerable increase in binary size. By moving this to the API layer, it also creates a better layering for the ongoing effort to make the embedded interpreter replacable with one from a different language (or even be completely removeable). One semantic change necessary to get this all working was to remove the notion of a shared debugger refcount. The debugger is either initialized or uninitialized now, and calling Initialize() multiple times will simply have no effect, while the first Terminate() will now shut it down no matter how many times Initialize() was called. This behaves nicely with all of our supported usage patterns though, and allows us to fix a number of nasty hacks from before. Differential Revision: http://reviews.llvm.org/D8462 llvm-svn: 233758
* Changed '-x'/'-xsize' to '-s'/'-size' when specifyingSean Callanan2015-03-261-2/+2
| | | | | | | | the size of a watchpoint. <rdar://problem/18184972> llvm-svn: 233237
* Turn off 'quit' confirmation in lldb-miIlia K2015-03-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove ScriptInterpreterObject.Zachary Turner2015-03-172-216/+295
| | | | | | | | | | | | | | | | | | | | | | | | | This removes ScriptInterpreterObject from the codebase completely. Places that used to rely on ScriptInterpreterObject now use StructuredData::Object and its derived classes. To support this, a new type of StructuredData object is introduced, called StructuredData::Generic, which stores a void*. Internally within the python library, StructuredPythonObject subclasses this StructuredData::Generic class so that it can addref and decref the python object on construction and destruction. Additionally, all of the classes in PythonDataObjects.h such as PythonList, PythonDictionary, etc now provide a method to create an instance of the corresponding StructuredData type. For example, there is PythonDictionary::CreateStructuredDictionary. To eliminate dependencies on PythonDataObjects for external callers, all ScriptInterpreter methods now return only StructuredData classes The rest of the changes in this CL are focused on fixing up users of PythonDataObjects classes to use the new StructuredData classes. llvm-svn: 232534
* Fix broadcasters for interpreter and process:Ilia K2015-03-171-1/+1
| | | | | | | | # Fix CommandInterpreter.Broadcaster name (it should be the same as CommandInterpreter::GetStaticBroadcasterClass()) # Prevent the same error in Process.Broadcaster # Fix SBCommandInterpreter::GetBroadcasterClass (it should call CommandInterpreter::GetStaticBroadcasterClass(), was Communication::GetStaticBroadcasterClass()) llvm-svn: 232500
* Handle PyLong return values in LLDBSwigPython_CalculateNumChildren.Siva Chandra2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix a bug related to arg escaping, and add unit tests.Zachary Turner2015-03-141-1/+1
| | | | | | | | | A recent refactor had introduced a bug where if you escaped a character, the rest of the string would get processed incorrectly. This patch fixes that bug and adds some unit tests for Args. llvm-svn: 232288
* Make LLDBWrapPython.cpp depend on the .swig files (configure+make build)Ed Maste2015-03-141-1/+4
| | | | | | This is equivalent to r232175 for the CMake build. llvm-svn: 232256
* Add support for Python object commands to return custom short and long help ↵Enrico Granata2015-03-132-0/+156
| | | | | | | | | | | | | by implementing def get_short_help(self) def get_long_help(self) methods on the command object Also, add a test case for this feature llvm-svn: 232224
* Bulk of the infrastructure work to allow script commands to be backed by ↵Enrico Granata2015-03-132-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Help for _regexp-break wasn't very clear. Added more detailed explanations ↵Greg Clayton2015-03-071-2/+8
| | | | | | | | of all things that can be typed by the _regexp-break command. <rdar://problem/12281058> llvm-svn: 231537
* Make sure to re-read the file data you can get from ↵Greg Clayton2015-03-061-1/+9
| | | | | | | | | | | | | | | | | OptionValueFileSpec::GetFileContents(...) when the file has changed. This means you can set an expression prefix file with: (lldb) settings set target.expr-prefix /tmp/to/prefix.txt And you can run an expression and modify your expression prefix file in another editor without having to type: (lldb) settings set target.expr-prefix /tmp/to/prefix.txt again... <rdar://problem/12155942> llvm-svn: 231535
* Further reduce header footprint of Debugger.h.Zachary Turner2015-03-041-0/+2
| | | | llvm-svn: 231202
* Don't #include FormatManager.h from Debugger.hZachary Turner2015-03-033-0/+4
| | | | | | | | Debugger.h is a huge file that gets included everywhere, and FormatManager.h brings in a ton of unnecessary stuff and doesn't even use anything from it in the header. llvm-svn: 231161
* Fix build breakage on win7-msvc caused by r230955Pavel Labath2015-03-021-2/+1
| | | | llvm-svn: 230958
* Fix handling of backslashes in Args parsingPavel Labath2015-03-022-207/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Presently Args::SetCommandString allows quotes to be escaped with backslash. However, the backslash itself is not removed from the argument, nor there is a way to escape the backslash itself. This leads to surprising results: "a b" c" -> 'a b', 'c' # Here we actually have an unterminated quote, but that is ignored "a b\" c" -> 'a b\" c' # We try to escape the quote. That works but the backslash is not removed. "a b\\" c" -> 'a b\\" c' # Escaping the backslash has no effect. This change changes quote handling to be more shell-like: - single quotes and backquotes are literal and there is no way to escape the closing quote or anything else inside; - inside double quotes you can use backslash to escape the closing quote and another backslash - outside any quotes, you can use backslash to escape quotes, spaces and itself. This makes the parsing more consistent with what the user is familiar and increases the probability that pasting the command line from shell to the "process launch" command "just work". Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7855 llvm-svn: 230955
* Fix a typo Debugger::ExecuteIOHanders to Debugger::ExecuteIOHandlers.Siva Chandra2015-02-261-1/+1
| | | | | | | | | | | | | | Test Plan: Build LLDB. Reviewers: zturner, vharron, clayborg Reviewed By: vharron, clayborg Subscribers: jingham, lldb-commits Differential Revision: http://reviews.llvm.org/D7894 llvm-svn: 230663
* If we are trying to load the scripting resource for a module whose name ↵Enrico Granata2015-02-261-1/+16
| | | | | | | | happens to be a Python keyword, then prefix the filename with an _ (e.g. a module named def will load _def.py) Fixes rdar://13893506 llvm-svn: 230602
* Add the new file to the CMakeLists. This should appease the Windows botEnrico Granata2015-02-201-0/+1
| | | | llvm-svn: 230049
* Add an OptionValueLanguage classEnrico Granata2015-02-203-0/+127
| | | | llvm-svn: 230046
* Refactor OptionValue::SetValueFromCString to use llvm::StringRefPavel Labath2015-02-2026-117/+95
| | | | | | | | | | Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7676 llvm-svn: 230005
* Fix SettingsCommandTestCase.test_set_error_output_pathVince Harron2015-02-182-8/+16
| | | | | | | | | | target.error-path (and output-path) were getting resolved on the local file system, which doesn't make any sense for remote targets So this patch prevents file paths from being resolved on the host system. llvm-svn: 229763
* Handle trailing spaces on "settings set" command more correctlyPavel Labath2015-02-166-29/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently we have some settings which treat "\ " on settings set commands specially. E.g., it is a valid way of specifying an argument of " " to a target. However, this fails if "\ " is the last argument as CommandObjectSettingsSet strips trailing whitespace. This resulted in a surprising argument of "\" to the target. This patch disables the training whitespace removal at a global level. Instead, for each argument type we locally determine whether whitespace stripping makes sense. Currently, I strip whitespace for all simple object type except of regex and format-string, with the rationale that these two object types do their own complex parsing and we want to interfere with them as least as possible. Specifically, stripping the whitespace of a regex "\ " will result in a (surprising?) error "trailing backslash". Furthermore, the default value of dissasembly-format setting already contains a trailing space and there is no way for the user to type this in manually if we strip whitespace. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7592 llvm-svn: 229382
* Add -exec-arguments commandIlia K2015-02-131-2/+6
| | | | | | | | | | | | | | | | | Summary: This patch adds -exec-arguments command for lldb-mi. -exec-arguments command allows to specify arguments for executable file in MI mode. Also it contains tests for that command. Btw, new added files was formatted by clang-format. Reviewers: abidh, zturner, clayborg Reviewed By: clayborg Subscribers: zturner, emaste, clayborg, jingham, lldb-commits Differential Revision: http://reviews.llvm.org/D6965 llvm-svn: 229110
* Add Initialize/Terminate method to Platform base pluginTamas Berghammer2015-02-121-0/+12
| | | | | | | | | | | | | Platform holds a smart pointer to each platform object created in a static variable what cause the platform destructors called only on program exit when other static variables are not availables. With this change the destructors are called on lldb_private::Terminate() + Fix DebuggerRefCount handling in ScriptInterpreterPython Differential Revision: http://reviews.llvm.org/D7590 llvm-svn: 228944
* Unbreak the cmake build by adding some new filesReid Kleckner2015-02-041-0/+1
| | | | llvm-svn: 228224
* Get rid of Debugger::FormatPrompt() and replace it with the new FormatEntity ↵Greg Clayton2015-02-044-23/+191
| | | | | | | | | | | | | | | | | | | class. Why? Debugger::FormatPrompt() would run through the format prompt every time and parse it and emit it piece by piece. It also did formatting differently depending on which key/value pair it was parsing. The new code improves on this with the following features: 1 - Allow format strings to be parsed into a FormatEntity::Entry which can contain multiple child FormatEntity::Entry objects. This FormatEntity::Entry is a parsed version of what was previously always done in Debugger::FormatPrompt() so it is more efficient to emit formatted strings using the new parsed FormatEntity::Entry. 2 - Allows errors in format strings to be shown immediately when setting the settings (frame-format, thread-format, disassembly-format 3 - Allows auto completion by implementing a new OptionValueFormatEntity and switching frame-format, thread-format, and disassembly-format settings over to using it. 4 - The FormatEntity::Entry for each of the frame-format, thread-format, disassembly-format settings only replaces the old one if the format parses correctly 5 - Combines all consecutive string values together for efficient output. This means all "${ansi.*}" keys and all desensitized characters like "\n" "\t" "\0721" "\x23" will get combined with their previous strings 6 - ${*.script:} (like "${var.script:mymodule.my_var_function}") have all been switched over to use ${script.*:} "${script.var:mymodule.my_var_function}") to make the format easier to parse as I don't believe anyone was using these format string power user features. 7 - All key values pairs are defined in simple C arrays of entries so it is much easier to add new entries. These changes pave the way for subsequent modifications where we can modify formats to do more (like control the width of value strings can do more and add more functionality more easily like string formatting to control the width, printf formats and more). llvm-svn: 228207
* Change void* name_token to const void* to address warnings.Bruce Mitchener2015-02-031-5/+5
| | | | | | | | | | | | Reviewers: granata.enrico, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7337 llvm-svn: 227952
* Changes in 226712 needed some fixing as a platform is almost always selected ↵Greg Clayton2015-01-281-0/+35
| | | | | | | | and even if platform options are specified when doing a "target create" they would get ignored if a platform was already selected. The change was made so we could re-use a platform if one was already created instead of creating a new one, but it would fail in the above case. To fix this, if we have a selected platform, we verify that the platform matches the current platform before we try to re-use it. We do this by asking the OptionGroupPlatform if the platform matches. If so, it returns true and we don't create a new platform, else we do. llvm-svn: 227288
* Allow python command interpreter commands to be interruptable via CTRL+C.Greg Clayton2015-01-272-19/+37
| | | | | | <rdar://problem/17935601> llvm-svn: 227163
* Abstract the details from regex.h a bit more by not allowing people to ↵Greg Clayton2015-01-213-4/+4
| | | | | | | | | | specify compile and execute flags for regular expressions. Also enable better regular expressions if they are available by check if the REG_ENHANCED is available and using it if it is. Since REG_ENHANCED is available on MacOSX, this allow the use of \d (digits) \b (word boundaries) and much more without affecting other systems. <rdar://problem/12082562> llvm-svn: 226704
* Don't remove backslashes from arguments unless the following char is recognized.Zachary Turner2015-01-201-11/+9
| | | | | | | | | | | | | This fixes file paths on Windows, as you can now write, for example, file d:\foo\bar.txt, but does not break the case that this tokenization logic was originally designed for, which is to allow escaping of things like quotes and double quotes, so that all of the escapable characters can appear in the same string together. Reviewed by: Jim Ingham, Greg Clayton Differential Revision: http://reviews.llvm.org/D7018 llvm-svn: 226587
* Moved Args::StringToXIntYZ to StringConvert::ToXIntYZVince Harron2015-01-159-97/+31
| | | | | | | | | | The refactor was motivated by some comments that Greg made http://reviews.llvm.org/D6918 and also to break a dependency cascade that caused functions linking in string->int conversion functions to pull in most of lldb llvm-svn: 226199
* Three related changes to help:Kate Stone2015-01-151-76/+83
| | | | | | | | | | | | | | | | The default help display now shows the alias collection by default, and hides commands whose named begin with an underscore. Help is primarily useful to those unfamiliar with LLDB and should aim to answer typical questions while still being able to provide more esoteric answers when required. To that latter end an argument to include the hidden commands in help has been added, and instead of having a help flag to show aliases there is now one to hide them. This final change might be controversial as it repurposes the -a shorthand as the opposite of its original meaning. The previous implementation of OutputFormattedHelpText was easily confused by embedded newlines. The new algorithm correctly breaks on the FIRST newline or LAST space/tab before the target column count rather than treating all whitespace interchangeably. Command interpreters now have the ability to specify help prologue text and a command prefix string. Neither are used in the current LLDB sources but are required to support REPL-like extensions where LLDB commands must be prefixed and additional help text is required to explain how to access traditional debugging commands. <rdar://problem/17751929> <rdar://problem/16953815> <rdar://problem/16953841> <rdar://problem/16930173> <rdar://problem/16879028> llvm-svn: 226068
* Fixed an issue where if the operating system python plug-in is changed at ↵Greg Clayton2015-01-1316-18/+76
| | | | | | | | | | | | | | | | | | | | | | | runtime, it wouldn't cause the process to reload the new operating system plug-in, now it does. This is currently controlled by a setting: (lldb) settings set target.process.python-os-plugin-path <path> Or clearing it with: (lldb) settings clear target.process.python-os-plugin-path The process will now reload the OperatingSystem plug-in. This was implemented by: - adding the ability to set a notify callback for when an option value is changed - added the ability for the process plug-in to load the operating system plug-in on the fly - fixed bugs in the Process::GetStatus() so all threads are displayed if their thread IDs are larger than 32 bits - adding a callback in ProcessProperties to tell when the "python-os-plugin-path" is changed by the user - fixing a crasher in ProcessMachCore that happens when updating the thread list when the OS plugin is reloaded llvm-svn: 225831
* Add support for character option types.Zachary Turner2015-01-127-1/+147
| | | | | | | | | | | | | This will allow, in a subsequent patch, the addition of a global setting that allows the user to specify a single character that LLDB will recognize as an escape character when processing arg strings to accomodate differences in Windows/non-Windows path handling. Differential Revision: http://reviews.llvm.org/D6887 Reviewed by: Jim Ingham llvm-svn: 225694
* Respect the fact that the result object claims it doesn't want to be ↵Greg Clayton2015-01-101-12/+17
| | | | | | | | | | interactive by not forwarding STDIN to the python invocation when it isn't desired. This fixes an issue of running "script" commands via SBDebugger::HandleCommand(...) and SBCommandInterpreter::HandleCommand(...) deadlocking Xcode. <rdar://problem/18075038> llvm-svn: 225567
* Fixed an issue where you couldn't delete a user defined regex, python, or ↵Greg Clayton2015-01-092-17/+67
| | | | | | | | | | | multi-word command by adding a new "command delete" command. This new command will delete user defined regular commands, but not aliases. We still have "command unalias" to remove aliases as they are currently in different buckets. Appropriate error messages are displayed to inform the user when "command unalias" is used on removable user defined commands that points users to the "command delete" command. Added a test to verify we can remove user defined commands and also verify that "command unalias" fails when used on a user defined command. <rdar://problem/18248300> llvm-svn: 225535
* Audit uses of ConstString::AsCString() to make sure they weren't assumingJim Ingham2014-12-191-1/+1
| | | | | | | | they would always get a non-NULL string back. <rdar://problem/19298575> llvm-svn: 224602
* Enhance the Pipe interface for better portability.Zachary Turner2014-12-171-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a number of improvements to the Pipe interface. 1) An interface (PipeBase) is provided which exposes pure virtual methods for any implementation of Pipe to override. While not strictly necessary, this helps catch errors where the interfaces are out of sync. 2) All methods return lldb_private::Error instead of returning bool or void. This allows richer error information to be propagated up to LLDB. 3) A new ReadWithTimeout() method is exposed in the base class and implemented on Windows. 4) Support for both named and anonymous pipes is exposed through the base interface and implemented on Windows. For creating a new pipe, both named and anonymous pipes are supported, and for opening an existing pipe, only named pipes are supported. New methods described in points #3 and #4 are stubbed out on posix, but fully implemented on Windows. These should be implemented by someone on the linux / mac / bsd side. Reviewed by: Greg Clayton, Oleksiy Vyalov Differential Revision: http://reviews.llvm.org/D6686 llvm-svn: 224442
* Add the ability to tag one or more breakpoints with a name. TheseJim Ingham2014-12-161-0/+17
| | | | | | | | | names can then be used in place of breakpoint id's or breakpoint id ranges in all the commands that operate on breakpoints. <rdar://problem/10103959> llvm-svn: 224392
* Add the ability to set breakpoints with conditions, commands, etc,Jim Ingham2014-12-061-2/+2
| | | | | | | | | | | | | | in the "dummy-target". The dummy target breakpoints prime all future targets. Breakpoints set before any target is created (e.g. breakpoints in ~/.lldbinit) automatically get set in the dummy target. You can also list, add & delete breakpoints from the dummy target using the "-D" flag, which is supported by most of the breakpoint commands. This removes a long-standing wart in lldb... <rdar://problem/10881487> llvm-svn: 223565
* Add commandsEnrico Granata2014-12-051-1/+1
| | | | | | | | | | | | type format info type summary info type synthetic info These commands all take an expression, evaluate it, and show which of the respective formatter (if any) applies to the result of the expression Fixes rdar://12059317 llvm-svn: 223511
* Added a new regular expression to the "_regexp-break" command ("b" by default):Greg Clayton2014-12-011-0/+1
| | | | | | | | | | (lldb) b /break here/ This will set a source level regular expression breakpoint on any text between the first '/' and the last '/'. The equivalent command will be: (lldb) breakpoint set --source-pattern-regexp 'break here' llvm-svn: 223082
OpenPOWER on IntegriCloud