aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandObject.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-03-08A few more improvements on the way to the command alias refactoringEnrico Granata1-1/+0
- move alias help generation to CommandAlias, out of CommandInterpreter - make alias creation use argument strings instead of OptionArgVectorSP; the former is a more reasonable currency than the latter - remove m_is_alias from CommandObject, it wasn't actually being used llvm-svn: 262912
2016-03-08Change the way command aliases are stored. Go from a model where a map holds ↵Enrico Granata1-39/+0
the alias -> underlying command binding and another map holds the alias -> options, to a model where one single map holds the alias -> (all useful data) combination Right now, obviously, this is just the pair of (CommandObjectSP,OptionArgVectorSP), so NFC This is step one of a larger - and tricky - refactoring which will turn command aliases into interesting objects instead of passive storage that the command interpreter does smart things to This refactoring, in turn, will allow us to do interesting things with aliases, such as intelligent and customizable help llvm-svn: 262900
2016-02-29Change the user-visible name for the argument type language to source-languageEnrico Granata1-1/+1
This makes it so that help language provides help on the language command and help source-language provides the list of source languages one can pass as an option Fixes rdar://24869942 llvm-svn: 262259
2015-09-02Move things from the LanguageRuntime that obviously belong in the new ↵Jim Ingham1-1/+3
Language plugin instead. llvm-svn: 246611
2015-07-22Fix typos.Bruce Mitchener1-1/+1
Summary: Fix a bunch of typos. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11386 llvm-svn: 242856
2015-07-14Fixed line wrapping for the "long help" content in LLDB commands. Content ↵Kate Stone1-2/+24
is now dynamically wrapped for the column width of the current terminal. Lines that begin with whitespace will be indented identically on subsequent lines to maintain formatting. Existing commands supplying this type of help content have been reworked to take advantage of the changes. In addition to formatting changes, content was changes for accuracy and clarity purposes. <rdar://problem/21269977> llvm-svn: 242122
2015-05-29Don't #include "lldb-python.h" from anywhere.Zachary Turner1-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
2015-05-28Remove unused #includes of ScriptInterpreterPython.hZachary Turner1-2/+0
llvm-svn: 238470
2015-05-27Add support for custom commands to set flags on themselvesEnrico Granata1-15/+15
This works for Python commands defined via a class (implement get_flags on your class) and C++ plugin commands (which can call SBCommand::GetFlags()/SetFlags()) Flags allow features such as not letting the command run if there's no target, or if the process is not stopped, ... Commands could always check for these things themselves, but having these accessible via flags makes custom commands more consistent with built-in ones llvm-svn: 238286
2015-05-13Fixed a ton of gcc compile warningsVince Harron1-4/+4
Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
2015-04-22This is some groundwork for filtering the language ExceptionJim Ingham1-0/+1
breakpoints, for instance on the class of the thrown object. This change doesn't actually make that work, the part where we extract the thrown object type from the throw site isn't done yet. This provides a general programmatic "precondition" that you can add to breakpoints to give them the ability to do filtering on the LLDB side before we pass the stop on to the user-provided conditions & callbacks. llvm-svn: 235538
2015-04-17Fix "help language", the languages printer was assuming the Jim Ingham1-6/+3
eLanguageType numbers would be sequential, but vendor types are not and the printer went crazy. llvm-svn: 235153
2015-04-02Fix warnings generated by clang-cl.Zachary Turner1-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
2015-03-13Add support for Python object commands to return custom short and long help ↵Enrico Granata1-0/+6
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
2015-03-03Don't #include FormatManager.h from Debugger.hZachary Turner1-0/+1
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
2014-12-16Add the ability to tag one or more breakpoints with a name. TheseJim Ingham1-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
2014-12-06Add the ability to set breakpoints with conditions, commands, etc,Jim Ingham1-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
2014-12-05Add commandsEnrico Granata1-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
2014-11-22This is the first step of making lldb able to create target-specific thingsJim Ingham1-0/+12
(e.g. breakpoints, stop-hooks) before we have any targets - for instance in your ~/.lldbinit file. These will then get copied over to any new targets that get created. So far, you can only make stop-hooks. Breakpoints will have to learn to move themselves from target to target for us to get them from no-target to new-target. We should also make a command & SB API way to prime this ur-target. llvm-svn: 222600
2014-09-20Have CommandObject::CheckRequirements() report the largest missingJason Molenda1-3/+18
requirement for a command instead of the smallest. e.g. if a command requires a Target, Process, Thread, and Frame, and none of those are available, report the largest -- Target -- as being missing instead of the smallest -- Frame. Patch by Paul Osmialowski. llvm-svn: 218181
2014-09-15Add a --help (-h) option to "command script add" that enables users to ↵Enrico Granata1-0/+1
define a one-liner short help for their command Also, in case they don't define any, change the default from "Run Python function <blah>" into "For more information run help <blah>" The core issue here is that Python only allows one docstring per function, so we can't really attach both a short and a long help to the same command easily There are alternatives but this is not a pressing enough concern to go through the motions quite yet Fixes rdar://18322737 llvm-svn: 217795
2014-08-06Probably should initialize that new ivar while I'm at it...Jim Ingham1-0/+1
llvm-svn: 214941
2014-08-06Add a variant of the CommandOverrideCallback that takes aJim Ingham1-6/+4
CommandReturnObject. Otherwise, all the overridden command can do is say it overrode the command, not say what it did... Also removed the duplicate definition of CommandOverrideCallback from the private interfaces. Now to figure out how to get this through the SB API's... <rdar://problem/17911629> llvm-svn: 214938
2014-04-20Switch NULL to C++11 nullptr in source/InterpreterEd Maste1-100/+100
Patch by Robert Matusewicz llvm-svn: 206711
2014-04-02sanitise sign comparisonsSaleem Abdulrasool1-1/+1
This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390
2014-02-07Now that the command interpreter runs in a separate thread in Xcode, we need ↵Greg Clayton1-7/+1
to lock the target API lock instead of trying to lock it. What was happening was: 1 - Xcode ran and stopped and was doing work on thread 2 2 - Users would type something in Xcode console on thread 1 3 - thread 3 would be running command interpreter thread and try to execute command but get "failed to get API lock" error for any command that wanted the target API lock (like "expression") <rdar://problem/15775016> llvm-svn: 200997
2013-09-30<rdar://problem/14393032>Enrico Granata1-0/+1
DumpValueObject() 2.0 This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command: - expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull) When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in (lldb) expr -O -v -- foo (id) $0 = 0x000000010010baf0 { 1 = 2; 2 = 3; } When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in (lldb) expr -O -- foo { 1 = 2; 2 = 3; } - for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display (lldb) po 5 5 -v also works in this mode (lldb) expr -O -vfull -- 5 (int) $4 = 5 On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed Test case to follow llvm-svn: 191694
2013-09-05Add OptionParser.hVirgile Bello1-1/+0
llvm-svn: 190063
2013-08-26merge lldb-platform-work branch (and assorted fixes) into trunkDaniel Malea1-0/+3
Summary: This merge brings in the improved 'platform' command that knows how to interface with remote machines; that is, query OS/kernel information, push and pull files, run shell commands, etc... and implementation for the new communication packets that back that interface, at least on Darwin based operating systems via the POSIXPlatform class. Linux support is coming soon. Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS X Mountain Lion. Additional improvements (not in the source SVN branch 'lldb-platform-work'): - cmake build scripts for lldb-platform - cleanup test suite - documentation stub for qPlatform_RunCommand - use log class instead of printf() directly - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely. - add new logging category 'platform' Reviewers: Matt Kopec, Greg Clayton Review: http://llvm-reviews.chandlerc.com/D1493 llvm-svn: 189295
2013-06-18<rdar://problem/13270271>Enrico Granata1-8/+1
Only add the — (double dash) separator to a command syntax if it has any options to be separated from arguments Also remove the unused Translate() method from CommandObject llvm-svn: 184163
2013-06-12<rdar://problem/11914077>Enrico Granata1-0/+77
If you type help command <word> <word> <word> <missingSubCommand> (e.g. help script import or help type summary fake), you will get help on the deepest matched command word (i.e. script or type summary in the examples) Also, reworked the logic for commands to produce their help to make it more object-oriented llvm-svn: 183822
2013-05-02Recommitting r180831 with trivial fix - remember to return errors if you ↵Jim Ingham1-1/+0
compute. llvm-svn: 180898
2013-05-01Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.pyDaniel Malea1-0/+1
llvm-svn: 180868
2013-04-30Added an option to "process detach" to keep the process stopped, if the ↵Jim Ingham1-1/+0
process plugin (or in the case of ProcessGDBRemote the stub we are talking to) know how to do that. rdar://problem/13680832 llvm-svn: 180831
2013-04-04<rdar://problem/13457391>Greg Clayton1-2/+2
LLDB now can use a single dash for all long options for all commands form the command line and from the command interpreter. This involved just switching all calls from getopt_long() to getopt_long_only(). llvm-svn: 178789
2013-03-02Convert from the C-based LLVM Disassembler shim to the full MC Disassembler ↵Jim Ingham1-0/+1
API's. Calculate "can branch" using the MC API's rather than our hand-rolled regex'es. As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att. <rdar://problem/11319574> <rdar://problem/9329275> llvm-svn: 176392
2013-01-29Since an address (0x12346) is an expression, be brief.Enrico Granata1-1/+1
llvm-svn: 173757
2013-01-29<rdar://problem/12552374>Enrico Granata1-0/+1
Replacing the address argument type with address-expression in cases where StringToAddress() is used, and hence an expression can be passed where previously only a numeric address was allowed This makes the documentation more clear and helps users discover that they can truly pass in an expression in these situations. llvm-svn: 173753
2013-01-25<rdar://problem/13069948>Greg Clayton1-6/+2
Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
2013-01-09Expanded the flags that can be set for a command object in ↵Greg Clayton1-11/+90
lldb_private::CommandObject. This list of available flags are: enum { //---------------------------------------------------------------------- // eFlagRequiresTarget // // Ensures a valid target is contained in m_exe_ctx prior to executing // the command. If a target doesn't exist or is invalid, the command // will fail and CommandObject::GetInvalidTargetDescription() will be // returned as the error. CommandObject subclasses can override the // virtual function for GetInvalidTargetDescription() to provide custom // strings when needed. //---------------------------------------------------------------------- eFlagRequiresTarget = (1u << 0), //---------------------------------------------------------------------- // eFlagRequiresProcess // // Ensures a valid process is contained in m_exe_ctx prior to executing // the command. If a process doesn't exist or is invalid, the command // will fail and CommandObject::GetInvalidProcessDescription() will be // returned as the error. CommandObject subclasses can override the // virtual function for GetInvalidProcessDescription() to provide custom // strings when needed. //---------------------------------------------------------------------- eFlagRequiresProcess = (1u << 1), //---------------------------------------------------------------------- // eFlagRequiresThread // // Ensures a valid thread is contained in m_exe_ctx prior to executing // the command. If a thread doesn't exist or is invalid, the command // will fail and CommandObject::GetInvalidThreadDescription() will be // returned as the error. CommandObject subclasses can override the // virtual function for GetInvalidThreadDescription() to provide custom // strings when needed. //---------------------------------------------------------------------- eFlagRequiresThread = (1u << 2), //---------------------------------------------------------------------- // eFlagRequiresFrame // // Ensures a valid frame is contained in m_exe_ctx prior to executing // the command. If a frame doesn't exist or is invalid, the command // will fail and CommandObject::GetInvalidFrameDescription() will be // returned as the error. CommandObject subclasses can override the // virtual function for GetInvalidFrameDescription() to provide custom // strings when needed. //---------------------------------------------------------------------- eFlagRequiresFrame = (1u << 3), //---------------------------------------------------------------------- // eFlagRequiresRegContext // // Ensures a valid register context (from the selected frame if there // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx) // is availble from m_exe_ctx prior to executing the command. If a // target doesn't exist or is invalid, the command will fail and // CommandObject::GetInvalidRegContextDescription() will be returned as // the error. CommandObject subclasses can override the virtual function // for GetInvalidRegContextDescription() to provide custom strings when // needed. //---------------------------------------------------------------------- eFlagRequiresRegContext = (1u << 4), //---------------------------------------------------------------------- // eFlagTryTargetAPILock // // Attempts to acquire the target lock if a target is selected in the // command interpreter. If the command object fails to acquire the API // lock, the command will fail with an appropriate error message. //---------------------------------------------------------------------- eFlagTryTargetAPILock = (1u << 5), //---------------------------------------------------------------------- // eFlagProcessMustBeLaunched // // Verifies that there is a launched process in m_exe_ctx, if there // isn't, the command will fail with an appropriate error message. //---------------------------------------------------------------------- eFlagProcessMustBeLaunched = (1u << 6), //---------------------------------------------------------------------- // eFlagProcessMustBePaused // // Verifies that there is a paused process in m_exe_ctx, if there // isn't, the command will fail with an appropriate error message. //---------------------------------------------------------------------- eFlagProcessMustBePaused = (1u << 7) }; Now each command object contains a "ExecutionContext m_exe_ctx;" member variable that gets initialized prior to running the command. The validity of the target objects in m_exe_ctx are checked to ensure that any target/process/thread/frame/reg context that are required are valid prior to executing the command. Each command object also contains a Mutex::Locker m_api_locker which gets used if eFlagTryTargetAPILock is set. This centralizes a lot of checking code that was previously and inconsistently implemented across many commands. llvm-svn: 171990
2012-12-05Fix Linux build warnings due to redefinition of macros:Daniel Malea1-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
2012-12-04A few more build fixes for gcc 4.6:Daniel Malea1-2/+2
- use const char* instead of char* as needed in ObjC language runtime plugin - use int to iterate through enum (operator++ on enum not defined) - use initializer list instead of inline initialization of const field llvm-svn: 169185
2012-10-24This is a fix for the command option parser.Sean Callanan1-1/+1
There was a generic catch-all type for path arguments called "eArgTypePath," and a specialized version called "eArgTypeFilename." It turns out all the cases where we used eArgTypePath we could have used Filename or we explicitly meant a directory. I changed Path to DirectoryName, made it use the directory completer, and rationalized the uses of Path. <rdar://problem/12559915> llvm-svn: 166533
2012-10-23Improved support for language types as commandSean Callanan1-1/+28
options: - added help ("help language") listing the possible options; - added the possibility of synonyms for language names, in this case "ObjC" for "Objective-C"; and - made matching against language names case insensitive. This should improve discoverability. <rdar://problem/12552359> llvm-svn: 166457
2012-10-13<rdar://problem/12491387>Greg Clayton1-10/+6
I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override: virtual CommandObject * GetPluginCommandObject(); This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented! llvm-svn: 165861
2012-09-13Made the help for the -n option onSean Callanan1-0/+1
"target image lookup" a bit better documented by indicating that it takes symbols OR functions. <rdar://problem/12281325> llvm-svn: 163839
2012-08-23Clarify the doc string for register-name a bit, add flags.Jim Ingham1-1/+4
llvm-svn: 162503
2012-08-23Document the generic register names in help for register-name.Jim Ingham1-1/+15
llvm-svn: 162500
2012-06-08Make raw & parsed commands subclasses of CommandObject rather than having ↵Jim Ingham1-26/+62
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
2012-05-29Fix arch_helper() to return the list of supported architectures.Johnny Chen1-2/+2
llvm-svn: 157643