summaryrefslogtreecommitdiffstats
path: root/lldb/tools/driver/Driver.h
Commit message (Collapse)AuthorAgeFilesLines
* typedef enum -> enumFangrui Song2019-05-141-2/+2
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* [Driver] Change the way we deal with local lldbinit files.Jonas Devlieghere2019-05-061-8/+2
| | | | | | | | | | | | | | | | Currently we have special handling for local lldbinit files in the driver. At the same time, we have an SB API named `SourceInitFileInCurrentWorkingDirectory` that does the same thing. This patch removes the special handling from the driver and uses the API instead. In addition to the obvious advantages of having one canonical way of doing things and removing code duplication, this change also means that the code path is the same for global and local lldb init files. Differential revision: https://reviews.llvm.org/D61577 llvm-svn: 360077
* [Driver] Remove unused functions (NFC)Jonas Devlieghere2019-04-261-11/+0
| | | | | | | | Remove unused from the driver class. I noticed a bunch of small thing while doing this that didn't warrant separate commits, so I've lumped them together into this patch. llvm-svn: 359355
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-111-1/+1
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* 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
* [Driver] Some more cleanup. NFCJonas Devlieghere2019-01-051-2/+2
| | | | llvm-svn: 350446
* [Driver] Simplify OptionData. NFCJonas Devlieghere2018-12-111-27/+28
| | | | | | | | | | | | | Hopefully this makes the option data easier to understand and maintain. - Group the member variables. - Do the initialization in the header as it's less error prone. - Rename the Clean method. It was called only once and was re-initializing some but not all (?) members. The only useful thing it does is dealing with the local lldbinit file so keep that and make the name reflect that. llvm-svn: 348894
* [driver] Some NFC cleanupJonas Devlieghere2018-11-281-2/+1
| | | | | | | This patch includes some small things I noticed while refactoring the driver but didn't want to include in that patch. llvm-svn: 347817
* [Driver] Use libOption with tablegen.Jonas Devlieghere2018-11-271-10/+13
| | | | | | | | | | | | | This patch modifies the lldb driver to use libOption for option parsing. It allows us to decouple option parsing from option processing which is important when arguments affect initialization. This was previously not possible because the debugger need to be initialized as some option interpretation (like the scripting language etc) was handled by the debugger, rather than in the driver. Differential revision: https://reviews.llvm.org/D54692 llvm-svn: 347709
* [Driver] Remove unused declarations and "include" directivesTatyana Krasnukha2018-09-281-9/+0
| | | | llvm-svn: 343357
* Clean-up usage of OptionDefinition arraysTatyana Krasnukha2018-09-281-2/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D52604 llvm-svn: 343348
* Allow specifying an exit code for the 'quit' commandRaphael Isemann2018-07-111-1/+4
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the possibility to specify an exit code when calling quit. We accept any int, even though it depends on the user what happens if the int is out of the range of what the operating system supports as exit codes. Fixes rdar://problem/38452312 Reviewers: davide, jingham, clayborg Reviewed By: jingham Subscribers: clayborg, jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D48659 llvm-svn: 336824
* Finish breaking the dependency from Utility.Zachary Turner2017-02-161-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D29964 llvm-svn: 295368
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-111/+88
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* This patch stops lldb from loading a .lldbinit file from the currentJason Molenda2016-02-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | working directory by default -- a typical security problem that we need to be more conservative about. It adds a new target setting, target.load-cwd-lldbinit which may be true (always read $cwd/.lldbinit), false (never read $cwd/.lldbinit) or warn (warn if there is a $cwd/.lldbinit and don't read it). The default is set to warn. If this is met with unhappiness, we can look at changing the default to true (to match current behavior) on a different platform. This does not affect reading of ~/.lldbinit - that will still be read, as before. If you run lldb in your home directory, it will not warn about the presence of a .lldbinit file there. I had to add two SB API - SBHostOS::GetUserHomeDirectory and SBFileSpec::AppendPathComponent - for the lldb driver code to be able to get the home directory path in an OS neutral manner. The warning text is There is a .lldbinit file in the current directory which is not being read. To silence this warning without sourcing in the local .lldbinit, add the following to the lldbinit file in your home directory: settings set target.load-cwd-lldbinit false To allow lldb to source .lldbinit files in the current working directory, set the value of this variable to true. Only do so if you understand and accept the security risk. <rdar://problem/24199163> llvm-svn: 261280
* Added support for the "--repl" argument to LLDB. Sean Callanan2015-10-201-0/+3
| | | | | | | | | This makes LLDB launch and create a REPL, specifying no target so that the REPL can create one for itself. Also added the "--repl-language" option, which specifies the language to use. Plumbed the relevant arguments and errors through the REPL creation mechanism. llvm-svn: 250773
* Make command files specified to the driver actually print theirJim Ingham2015-07-081-1/+1
| | | | | | | | | | results if the -Q option is not provided. Also took out the quietly option from AddInitialCommand, we don't use that to set this option, we use the override set by the -Q option. <rdar://problem/21232087> llvm-svn: 241652
* Make the sourcing of the local .lldbinit file quiet.Jim Ingham2014-11-221-4/+17
| | | | | | <rdar://problem/19065278> llvm-svn: 222599
* Add "-k" and "-K" options to the driver, that allow you to register Jim Ingham2014-11-191-2/+10
| | | | | | | | | | | | some commands that will get run if the target crashes. Also fix the bug where the local .lldbinit file was not getting sourced before not after the target was created from the file options on the driver command line. <rdar://problem/19019843> llvm-svn: 222295
* This adds a "batch mode" to lldb kinda like the gdb batch mode. It will ↵Jim Ingham2014-10-141-0/+1
| | | | | | | | | | | | | | | | quit the debugger after all the commands have been executed except if one of the commands was an execution control command that stopped because of a signal or exception. Also adds a variant of SBCommandInterpreter::HandleCommand that takes an SBExecutionContext. That way you can run an lldb command targeted at a particular target, thread or process w/o having to select same before running the command. Also exposes CommandInterpreter::HandleCommandsFromFile to the SBCommandInterpreter API, since that seemed generally useful. llvm-svn: 219654
* (no commit message)Greg Clayton2014-07-301-1/+1
| | | | llvm-svn: 214319
* Remove unused defines from lldb driver.Todd Fiala2014-06-051-3/+0
| | | | | | | | See http://reviews.llvm.org/D3965 for details. Change by Thiago Farina. llvm-svn: 210268
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-80/+0
| | | | | | | | | | | | 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
* Patch enabling lldb command line driver to run on windows.Deepak Panickal2013-10-151-0/+1
| | | | | | | | | | | | | | | CHANGES: - Thread locking switched from pthreads to C++11 standard library. - Abstracted platform specific header includes into 'platform.h'. - Create editline emulator for windows. - Emulated various platform dependant functions on windows. TODO: - User input currently handled by gets_s(), work started on better handler: see _WIP_INPUT_METHOD define blocks in 'ELWrapper.cpp'. Aim is to handle 'tab' auto completion on windows. - Tidy up 'getopt.inc' from lldbHostCommon to serve as LLDB Drivers getopt windows implementation. llvm-svn: 192714
* This changes how the --source driver argument works. I split this into four ↵Jim Ingham2013-09-141-7/+9
| | | | | | | | | | | | | | | | | arguments: -S : Specifies a command file which will get sourced after the ~/.lldbinit but before file arguments are processed -O : Specifies a single (one-line) command that will get ditto and -s : Specifies a command file which will get sourced after `pwd`/.lldbinit -o : Specifies a command file which ditto I also changed it so that by default these sourced commands will print their command result, but there's a -q option to change that if you wish. llvm-svn: 190734
* <rdar://problem/13764135>Greg Clayton2013-05-141-0/+1
| | | | | | | | The "lldb" driver was interfering with STDOUT and STDERR if the output was over 1024 charcters long. The output was grabbing 1024 characters at a time, before it output the characters, it was writing characters to the screen to clear the current line. This has been fixed. I also fixed the command interpreter from mixing the "(lldb) " prompt in with program output by always manually checking for program output. This was done by having the command interpreter know when it is in the middle of executing a command by setting a bool. This was needed since sometimes when a command would run the target, like with a command like 'expression (int)printf("hello\n")', the process would push a new input reader, and then pop it when it was done. This popping of the input reader would cause the command interpreter to get sent a reactivated message (from the private process state thread) and cause it to ask for another command, even though we were still in the middle of the command ('expression (int)printf("hello\n")'). Now we set a bool to true, run the command and set the bool to false. If we get reactivated while we are in the middle of a command, we don't say we are ready for a new command. This coupled with emitting the STDOUT/STDERR first after each command, followed by the command results, followed by then saying we are ready for a new command, should help cleanup the command line output on all platforms. llvm-svn: 181807
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | 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
* Call el_resize when the window size changes.Jim Ingham2013-02-221-0/+3
| | | | | | <rdar://problem/13270100> llvm-svn: 175926
* Added an SBAPI to get the PythonPath (if the Host knows how to do that). ↵Jim Ingham2012-12-211-0/+1
| | | | | | | | | And a -P option to the Driver to print it out. Changed dotest.py to use that to find the PythonPath it should use given the lldb binary it was told to run. llvm-svn: 170932
* Change the Thread constructor over to take a Process& rather than a ↵Jim Ingham2012-10-101-0/+3
| | | | | | | | | | | | | ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP. Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame changes the stack. Made the Driver use this notification to print the new thread status rather than doing it in the command. Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call. <rdar://problem/12383087> llvm-svn: 165640
* rdar://problem/12096295Johnny Chen2012-08-151-0/+1
| | | | | | | Add an lldb command line option to specify a core file: --core/-c. For consistency, change the "target create" command to also use --core. llvm-svn: 161993
* <rdar://problem/10605072>Greg Clayton2012-02-291-0/+13
| | | | | | | | | | | | | Added the ability to override command line commands. In some cases GUI interfaces might want to intercept commands like "quit" or "process launch" (which might cause the process to re-run). They can now do so by overriding/intercepting commands by using functions added to SBCommandInterpreter using a callback function. If the callback function returns true, the command is assumed to be handled. If false is returned the command should be evaluated normally. Adopted this up in the Driver.cpp for intercepting the "quit" command. llvm-svn: 151708
* Send Breakpoint Changed events for all the relevant changes to breakpoints.Jim Ingham2012-02-081-0/+3
| | | | | | | Also, provide and use accessors for the thread options on breakpoints so we can control sending the appropriate events. llvm-svn: 150057
* Adding "-n", "-p" and "-w" flags to the lldb command-line tool toJim Ingham2011-09-131-0/+3
| | | | | | allow attaching from the command line. llvm-svn: 139665
* Make sure writing asynchronous output only backs upCaroline Tice2011-05-091-0/+6
| | | | | | | & overwrites prompt if the IOChannel input reader is the top input reader. llvm-svn: 131110
* This patch captures and serializes all output being written by theCaroline Tice2011-05-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed the LLDB build so that we can have private types, private enums andGreg Clayton2011-03-241-1/+1
| | | | | | | | public types and public enums. This was done to keep the SWIG stuff from parsing all sorts of enums and types that weren't needed, and allows us to abstract our API better. llvm-svn: 128239
* Any arguments that are not options to the "lldb" command line driver, now get Greg Clayton2010-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used as the arguments for the inferior program. So for example you can do % lldb /bin/ls /tmp ~/Documents And "lldb" will use "/bin/ls" as the program and send arguments "/tmp" and "~/Documents" as the launch args. If you specify a file, then all remaining args after option parsing will be used for program arguments: % lldb -f /bin/ls /tmp ~/Documents If you need to pass option values to your inferior program, just terminate the "lldb" command line driver options with "--": % lldb -- /bin/ls -AFl /tmp The arguments are placed into the "settings" variable named "target.process.run-args". This allows you to just run the program using "process launch" and, if no args are specified on that command, the "target.process.run-args" values will be used: % lldb -- /bin/ls -AFl /tmp Current executable set to '/bin/ls' (x86_64). (lldb) settings show target.process.run-args target.process.run-args (array): [0]: '-AFl' [1]: '/tmp' (lldb) (lldb) r Process 56753 launched: '/bin/ls' (x86_64) lrwxr-xr-x@ 1 root wheel 11 Nov 19 2009 /tmp@ -> private/tmp llvm-svn: 121295
* Fix various timing/threading problems in IOChannel & Driver thatCaroline Tice2010-09-291-2/+2
| | | | | | were causing the prompt to be stomped on, mangled or omitted occasionally. llvm-svn: 115059
* Added a way to open the current source file & line in an external editor, ↵Jim Ingham2010-08-301-0/+1
| | | | | | | | and you can turn this on with: lldb -e llvm-svn: 112502
* Change "Current" as in GetCurrentThread, GetCurrentStackFrame, etc, to ↵Jim Ingham2010-08-261-1/+1
| | | | | | "Selected" i.e. GetSelectedThread. Selected makes more sense, since these are set by some user action (a selection). I didn't change "CurrentProcess" since this is always controlled by the target, and a given target can only have one process, so it really can't be selected. llvm-svn: 112221
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-231-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 source/Utility/PseudoTerminal.h into include/lldb/Utility.Jason Molenda2010-06-091-1/+1
| | | | | | | | The top of the header file seems to indicate that this was intended to be over at include/lldb/Core but we should be in line with the .cpp file's location so it's include/lldb/Utility for now. llvm-svn: 105753
* Misc minor warning/error fixes.Eli Friedman2010-06-091-1/+1
| | | | llvm-svn: 105720
* And part two of two of fixing includes; somehow I thought the problem was moreEli Friedman2010-06-091-4/+4
| | | | | | widespread than it was. llvm-svn: 105689
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-081-0/+156
llvm-svn: 105619
OpenPOWER on IntegriCloud