aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-12This is the main part of a change to add breakpoint save and restore to lldb.Jim Ingham1-57/+10
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
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-639/+582
*** 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
2016-08-26Tables of command options in LLDB benefit from hand-formatting to make itKate Stone1-20/+12
easier to scan a set of options with a relatively large number of positional arguments. This commit standardizes their formatting throughout LLDB and applies surrounding directives to exempt them from being formatted by clang-format. These kinds of exemptions should be rare cases that benefit significantly from alternative formatting. They also imply a long-term obligation to maintain their format since the automated tools will not do so. llvm-svn: 279882
2016-08-11Decoupled Options from CommandInterpreter.Todd Fiala1-11/+13
Options used to store a reference to the CommandInterpreter instance in the base Options class. This made it impossible to parse options independent of a CommandInterpreter. This change removes the reference from the base class. Instead, it modifies the options-parsing-related methods to take an ExecutionContext pointer, which the options may inspect if they need to do so. Closes https://reviews.llvm.org/D23416 Reviewers: clayborg, jingham llvm-svn: 278440
2016-07-14LLDB help content has accumulated over time without a recent attempt toKate Stone1-13/+12
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
2016-02-19Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in ↵Eugene Zelenko1-63/+46
some files in source/Commands; other minor fixes. llvm-svn: 261356
2015-10-07commands: Use override instead of virtual.Bruce Mitchener1-32/+27
Summary: This removes all uses of virtual on functions where override could be used, including on destructors. It also adds override where virtual was previously missing. Reviewers: clayborg, labath Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13503 llvm-svn: 249564
2015-07-14Fixed line wrapping for the "long help" content in LLDB commands. Content ↵Kate Stone1-137/+114
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
2014-12-16Add the ability to tag one or more breakpoints with a name. TheseJim Ingham1-3/+3
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-3/+84
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-10-11Rework the way we pass "run multiple command" options to the various API's thatJim Ingham1-10/+9
do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather the options into an options class. Also expose that to the SB API's. Change the way the "-o" options to the lldb driver are processed so: 1) They are run synchronously - didn't really make any sense to run the asynchronously. 2) The stop on error 3) "quit" in one of the -o commands will not quit lldb - not the command interpreter that was running the -o commands. I added an entry to the run options to stop-on-crash, but I haven't implemented that yet. llvm-svn: 219553
2014-08-29Allow "breakpoint command add" to add commands to more than one breakpoint ↵Jim Ingham1-58/+70
at a time. <rdar://problem/13314462> llvm-svn: 216747
2014-08-28Make it clear in the help that "breakpoint command add" will act on the last setJim Ingham1-2/+3
breakpoint if no breakpoint id is specified. <rdar://problem/17885160> llvm-svn: 216637
2014-08-21Fixed a typo.Sean Callanan1-1/+1
<rdar://problem/18084105> llvm-svn: 216189
2014-07-09Revert "Fix broken tests due to new error output."Zachary Turner1-5/+5
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and re-enables OptionValidators. llvm-svn: 212627
2014-07-08Fix broken tests due to new error output.Todd Fiala1-5/+5
This reverses out the options validators changes. We'll get these back in once the changes to the output can be resolved. Restores broken tests on FreeBSD, Linux, MacOSX. Changes reverted: r212500, r212317, r212290. llvm-svn: 212543
2014-07-03Adds the notion of an OptionValidator.Zachary Turner1-5/+5
The purpose of the OptionValidator is to determine, based on some arbitrary set of conditions, whether or not a command option is valid for a given debugger state. An example of this might be to selectively disable or enable certain command options that don't apply to a particular platform. This patch contains no functional change, and does not actually make use of an OptionValidator for any purpose yet. A follow-up patch will begin to add the logic and users of OptionValidator. Reviewed by: Greg Clayton, Jim Ingham Differential Revision: http://reviews.llvm.org/D4369 llvm-svn: 212290
2014-05-08lldb TOT is dropping the last entry for multi-line IOHandlers that use the ↵Greg Clayton1-1/+1
IOHandlerDelegateMultiline. <rdar://problem/16844164> llvm-svn: 208336
2014-05-02"DONE" is being left in multi-line results when it shouldn't for non ↵Greg Clayton1-1/+1
terminal input. <rdar://problem/16790579> llvm-svn: 207818
2014-04-02Add the ability to set python breakpoint commands from the SBBreakpoint & ↵Jim Ingham1-8/+2
SBBreakpointLocation API's. You can either provide the function name, or function body text. Also propagate the compilation error up from where it is checked so we can report compilation errors. <rdar://problem/9898371> llvm-svn: 205380
2014-01-27Merging the iohandler branch back into main. Greg Clayton1-117/+39
The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
2013-09-05Add OptionParser.hVirgile Bello1-4/+4
llvm-svn: 190063
2013-05-16Note in the documentation about the fact that Python callbacks can return a ↵Enrico Granata1-0/+6
value and if that value is False, LLDB won’t stop at the breakpoint llvm-svn: 182059
2013-05-15<rdar://problem/13883385>Enrico Granata1-1/+2
Python breakpoint actions can return False to say that they don't want to stop at the breakpoint to which they are associated Almost all of the work to support this notion of a breakpoint callback was in place, but two small moving parts were missing: a) the SWIG wrapper was not checking the return value of the script b) when passing a Python function by name, the call statement was dropping the return value of the function This checkin addresses both concerns and makes this work Care has been taken that you only keep running when an actual value of False has been returned, and that any other value (None included) means Stop! llvm-svn: 181866
2013-04-18After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton1-2/+2
the macros and just use C++11. llvm-svn: 179805
2013-04-18Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton1-2/+2
C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
2013-02-28breakpoint command add currently doesn't support adding commands to more ↵Jim Ingham1-0/+7
than one breakpoint at a time. Enforce this for now (we should relax the requirement when we have a little more time.) <rdar://problem/13314462> llvm-svn: 176291
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-04<rdar://problem/12798131> Greg Clayton1-1/+1
Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite. This fix does the following: - make sure all short options are treated as "int" - make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired - fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates - fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value llvm-svn: 169189
2012-10-26Updated the "breakpoint command add" documentation and fixed the web site ↵Greg Clayton1-109/+124
docs for the signature of the python breakpoint callback functions. llvm-svn: 166789
2012-09-11Change the NULL to a 0 since we need a uint32_tFilipe Cabecinhas1-4/+4
llvm-svn: 163625
2012-08-08<rdar://problem/11975483> Removing user-visible references to 'dict' as a ↵Enrico Granata1-1/+1
parameter name for Python summary-generating functions since it is a Python keyword. llvm-svn: 161467
2012-07-17Ran the static analyzer on the codebase and found a few things.Greg Clayton1-4/+3
llvm-svn: 160338
2012-06-08Make raw & parsed commands subclasses of CommandObject rather than having ↵Jim Ingham1-574/+581
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-31<rdar://problem/11328896> Fixing a bug where regex commands were saved in ↵Enrico Granata1-1/+2
the history even if they came from a 'command sourced' file - this fix introduces a command sourcing depth and disables history for all levels of depth > 0, which means no commands go into history when being sourced from a file. we need an integer depth because command files might themselves source other command files, ... llvm-svn: 157727
2012-04-25Fix the docs for "breakpoint command add" to specify the arguments passed ↵Jim Ingham1-21/+32
into the python function. llvm-svn: 155517
2012-04-04Adding a new --python-function (-F) option to breakpoint command add. The ↵Enrico Granata1-5/+38
option allows the user to specify a Python function name instead of a Python oneliner or interactive script input as a breakpoint command llvm-svn: 154026
2012-03-06Using the new ScriptInterpreterObject in the implementation of synthetic ↵Enrico Granata1-2/+2
children to enhance type safety Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code llvm-svn: 152164
2012-02-21Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton1-2/+3
objects for the backlink to the lldb_private::Process. The issues we were running into before was someone was holding onto a shared pointer to a lldb_private::Thread for too long, and the lldb_private::Process parent object would get destroyed and the lldb_private::Thread had a "Process &m_process" member which would just treat whatever memory that used to be a Process as a valid Process. This was mostly happening for lldb_private::StackFrame objects that had a member like "Thread &m_thread". So this completes the internal strong/weak changes. Documented the ExecutionContext and ExecutionContextRef classes so that our LLDB developers can understand when and where to use ExecutionContext and ExecutionContextRef objects. llvm-svn: 151009
2012-02-17Remove unneeded includes.Jim Ingham1-1/+0
llvm-svn: 150843
2011-10-26Cleaned up many error codes. For any who is filling in error strings intoGreg Clayton1-1/+1
lldb_private::Error objects the rules are: - short strings that don't start with a capitol letter unless the name is a class or anything else that is always capitolized - no trailing newline character - should be one line if possible Implemented a first pass at adding "--gdb-format" support to anything that accepts format with optional size/count. llvm-svn: 142999
2011-10-07Re-organized the contents of RangeMap.h to be more concise and also allow ↵Greg Clayton1-39/+36
for a Range, RangeArray, RangeData (range + data), or a RangeDataArray. We have many range implementations in LLDB and I will be converting over to using the classes in RangeMap.h so we can have one set of code that does ranges and searching of ranges. Fixed up DWARFDebugAranges to use the new range classes. Fixed the enumeration parsing to take a lldb_private::Error to avoid a lot of duplicated code. Now when an invalid enumeration is supplied, an error will be returned and that error will contain a list of the valid enumeration values. llvm-svn: 141382
2011-09-22Converted the lldb_private::Process over to use the intrusiveGreg Clayton1-2/+3
shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
2011-06-16Add 'batch_mode' to CommandInterpreter. Modify InputReaders toCaroline Tice1-14/+21
not write output (prompts, instructions,etc.) if the CommandInterpreter is in batch_mode. Also, finish updating InputReaders to write to the asynchronous stream, rather than using the Debugger's output file directly. llvm-svn: 133162
2011-06-02Added Debugger::GetAsync{Output/Error}Stream, and use it to print parse ↵Jim Ingham1-4/+2
errors when we go to run a breakpoint condition. llvm-svn: 132517
2011-05-22Change the command 'breakpoint command remove' to 'breakpoint command delete',Caroline Tice1-12/+12
to be more consistent with other commands. llvm-svn: 131848
2011-05-16Fix places that were writing directly to the debugger's outputCaroline Tice1-4/+11
handles to go through the appropriate channels instead. llvm-svn: 131415
2011-05-02This patch captures and serializes all output being written by theCaroline Tice1-0/+3
command line driver, including the lldb prompt being output by editline, the asynchronous process output & error messages, and asynchronous messages written by target stop-hooks. As part of this it introduces a new Stream class, StreamAsynchronousIO. A StreamAsynchronousIO object is created with a broadcaster, who will eventually broadcast the stream's data for a listener to handle, and an event type indicating what type of event the broadcaster will broadcast. When the Write method is called on a StreamAsynchronousIO object, the data is appended to an internal string. When the Flush method is called on a StreamAsynchronousIO object, it broadcasts it's data string and clears the string. Anything in lldb-core that needs to generate asynchronous output for the end-user should use the StreamAsynchronousIO objects. I have also added a new notification type for InputReaders, to let them know that a asynchronous output has been written. This is to allow the input readers to, for example, refresh their prompts and lines, if desired. I added the case statements to all the input readers to catch this notification, but I haven't added any code for handling them yet (except to the IOChannel input reader). llvm-svn: 130721
2011-04-13Added two new classes for command options:Greg Clayton1-2/+2
lldb_private::OptionGroup lldb_private::OptionGroupOptions OptionGroup lets you define a class that encapsulates settings that you want to reuse in multiple commands. It contains only the option definitions and the ability to set the option values, but it doesn't directly interface with the lldb_private::Options class that is the front end to all of the CommandObject option parsing. For that the OptionGroupOptions class can be used. It aggregates one or more OptionGroup objects and directs the option setting to the appropriate OptionGroup class. For an example of this, take a look at the CommandObjectFile and how it uses its "m_option_group" object shown below to be able to set values in both the FileOptionGroup and PlatformOptionGroup classes. The members used in CommandObjectFile are: OptionGroupOptions m_option_group; FileOptionGroup m_file_options; PlatformOptionGroup m_platform_options; Then in the constructor for CommandObjectFile you can combine the option settings. The code below shows a simplified version of the constructor: CommandObjectFile::CommandObjectFile(CommandInterpreter &interpreter) : CommandObject (...), m_option_group (interpreter), m_file_options (), m_platform_options(true) { m_option_group.Append (&m_file_options); m_option_group.Append (&m_platform_options); m_option_group.Finalize(); } We append the m_file_options and then the m_platform_options and then tell the option group the finalize the results. This allows the m_option_group to become the organizer of our prefs and after option parsing we end up with valid preference settings in both the m_file_options and m_platform_options objects. This also allows any other commands to use the FileOptionGroup and PlatformOptionGroup classes to implement options for their commands. Renamed: virtual void Options::ResetOptionValues(); to: virtual void Options::OptionParsingStarting(); And implemented a new callback named: virtual Error Options::OptionParsingFinished(); This allows Options subclasses to verify that the options all go together after all of the options have been specified and gives the chance for the command object to return an error. It also gives a chance to take all of the option values and produce or initialize objects after all options have completed parsing. Modfied: virtual Error SetOptionValue (int option_idx, const char *option_arg) = 0; to be: virtual Error SetOptionValue (uint32_t option_idx, const char *option_arg) = 0; (option_idx is now unsigned). llvm-svn: 129415