summaryrefslogtreecommitdiffstats
path: root/lldb/tools/driver/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-1170/+1068
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* Don't disable stdin buffering on WindowsAdrian McCarthy2016-04-141-6/+5
| | | | | | | | Disabling buffering exposes a bug in the MS VS 2015 CRT implementation of fgets, where you sometimes have to hit Enter twice, depending on if the input had an odd or even number of characters. This was hidden until a few days ago by the Python initialization which was re-enabling buffering on the streams. A few days ago, Enrico make the Python initialization on-demand, which exposed this problem. llvm-svn: 266384
* [Driver] Fix a segfault in signal handlersPavel Labath2016-04-111-2/+6
| | | | | | | | | | | | | | | Summary: If we recieve a SIGCONT or SIGTSTP, while the driver is shutting down (which, sometimes, we do, for reasons which are not completely clear to me), we would crash to due a null pointer dereference. Guard against this situation. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D18965 llvm-svn: 265958
* Unicode support on Win32.Zachary Turner2016-03-221-30/+47
| | | | | | | | | | | | | Win32 API calls that are Unicode aware require wide character strings, but LLDB uses UTF8 everywhere. This patch does conversions wherever necessary when passing strings into and out of Win32 API calls. Patch by Cameron Differential Revision: http://reviews.llvm.org/D17107 Reviewed By: zturner, amccarth llvm-svn: 264074
* Delete the custom implementation of signal() on Windows.Zachary Turner2016-03-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Windows SDK provides a version of signal() that is much more limited compared to other platforms. It only supports about 5-6 signal values. LLDB uses signals for a number of things, most notably to handle Ctrl+C so we can gracefully shut down. The portability solution to this on Windows has been to provide a hand-rolled implementation of `signal` using the name `signal` so that you could write code that simply calls signal directly and it would work. But this introduces a multiply defined symbol with the builtin version and depending on how you included header files, you could get yourself into a situation where you had linker errors. To make matters worse, it led to a ton of compiler warnings. Worst of all though is that this custom implementation of signal was, in fact, identical for the purposes of handling Ctrl+C as the builtin implementation of signal. So it seems to have literally not been serving any useful purpose. This patch deletes all the custom signal() functions for Windows, and includes the signal.h system header, so that any calls to signal now go to the actual version provided by the Windows SDK. Differential Revision: http://reviews.llvm.org/D18287 llvm-svn: 263858
* This patch stops lldb from loading a .lldbinit file from the currentJason Molenda2016-02-191-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Silence some clang warningsSaleem Abdulrasool2016-02-151-1/+2
| | | | | | Silences -Wmissing-brace and -Wformat-pedantic warnings from clang on Linux. NFC. llvm-svn: 260914
* Wrap Notes in --help output to 80 columnsEd Maste2015-12-161-7/+13
| | | | llvm-svn: 255774
* Added support for the "--repl" argument to LLDB. Sean Callanan2015-10-201-77/+120
| | | | | | | | | 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-10/+10
| | | | | | | | | | 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
* Fixed a ton of gcc compile warningsVince Harron2015-05-131-4/+0
| | | | | | | | | | 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
* Work around lack of %zd printf format specifier in MSVC libs.Adrian McCarthy2015-03-301-2/+2
| | | | llvm-svn: 233569
* Removed an unused global variable.Hafiz Abid Qadeer2015-03-121-5/+0
| | | | | | | | | | This variable "g_debugger_name" is not used anywhere. It also causes a warning. I was first going to change its type to fix the warning then noticed that it is not being used. So removing it. Committed as Obvious. llvm-svn: 232043
* Correctly quote arguments in LLDB driverPavel Labath2015-03-051-12/+18
| | | | | | | | | | | | | | Summary: LLDB driver was simply tacking quotes around the strings in lldb commands, hoping that will work. This changes it to properly escape quotes and backslashes. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8083 llvm-svn: 231394
* Make the sourcing of the local .lldbinit file quiet.Jim Ingham2014-11-221-18/+21
| | | | | | <rdar://problem/19065278> llvm-svn: 222599
* Make the option parsing of -k & -K match the help strings.Jim Ingham2014-11-201-2/+2
| | | | llvm-svn: 222479
* Add "-k" and "-K" options to the driver, that allow you to register Jim Ingham2014-11-191-96/+183
| | | | | | | | | | | | 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
* LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166Shawn Best2014-11-081-0/+2
| | | | llvm-svn: 221570
* This adds a "batch mode" to lldb kinda like the gdb batch mode. It will ↵Jim Ingham2014-10-141-4/+27
| | | | | | | | | | | | | | | | 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
* Rework the way we pass "run multiple command" options to the various API's thatJim Ingham2014-10-111-3/+21
| | | | | | | | | | | | | | | 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
* Fix build break in Xcode build of lldb-tool.Todd Fiala2014-09-151-0/+2
| | | | llvm-svn: 217772
* Fix Windows build.Zachary Turner2014-09-111-0/+2
| | | | | | | | * ssize_t isn't defined by default on Windows. * New public API files need to be defined in a different file for Windows. llvm-svn: 217624
* driver: handle write error betterSaleem Abdulrasool2014-09-081-2/+18
| | | | | | | | | | | | | | | We would previously simply assume that the write would always succeed. However, write(2) may return -1 for error as well as fail to perform a complete write (in which case the returned number of bytes will be less than the requested bytes). Explicitly check if an error condition is encountered. This would previously not be caught as we default initialized success to true. Add an assertion that we always perform a complete write (a continuous retry could be added to ensure that we finish writing completely). This was caught by GCC's signed comparison warning and manual inspection. llvm-svn: 217355
* Restore the handling of the --arch argument passed to the Driver that was ↵Jim Ingham2014-08-071-1/+6
| | | | | | | | | | inadvertently removed in r214319. <rdar://problem/17948431> llvm-svn: 215165
* Convert over to using pipes for the initial LLDB commands in the Driver.Greg Clayton2014-08-011-35/+77
| | | | | | This will avoid having to use a temp file and adding temp file related calls to the public API. llvm-svn: 214536
* Fix build: remove bogus ./ at end of lineEd Maste2014-07-301-1/+1
| | | | llvm-svn: 214326
* (no commit message)Greg Clayton2014-07-301-105/+90
| | | | llvm-svn: 214319
* Fix Windows build using portable types for formatting the log outputsDeepak Panickal2014-03-031-0/+6
| | | | llvm-svn: 202723
* The "-n" and "-p" options to the lldb driver no longer worked after recent ↵Greg Clayton2014-02-061-0/+17
| | | | | | | | IOHandler changes, this is now fixed. <rdar://problem/15962763> llvm-svn: 200930
* Fix the --source-quietly option to the driver so that it actually works. ↵Jim Ingham2014-02-051-16/+20
| | | | | | | | Clean up the help output a bit. llvm-svn: 200878
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-847/+84
| | | | | | | | | | | | 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-14/+23
| | | | | | | | | | | | | | | 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
* Make the docs for the -s -o -S and -O options clearer.Jim Ingham2013-09-171-4/+13
| | | | llvm-svn: 190838
* This changes how the --source driver argument works. I split this into four ↵Jim Ingham2013-09-141-61/+118
| | | | | | | | | | | | | | | | | 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
* Add ${ansi.XX} parsing to lldb prompt, use-color setting, and -no-use-colors ↵Michael Sartain2013-05-231-1/+7
| | | | | | | | | | command line options. settings set use-color [false|true] settings set prompt "${ansi.bold}${ansi.fg.green}(lldb)${ansi.normal} " also "--no-use-colors" on the command prompt llvm-svn: 182609
* Fix shutdown to correctly close stdout and stop showing garbage characters ↵Michael Sartain2013-05-221-1/+7
| | | | | | | | on exit. Patch by Matthew Sorrels llvm-svn: 182539
* <rdar://problem/13764135>Greg Clayton2013-05-141-5/+18
| | | | | | | | 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
* <rdar://problem/13457391>Greg Clayton2013-04-041-5/+5
| | | | | | 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
* Call el_resize when the window size changes.Jim Ingham2013-02-221-1/+10
| | | | | | <rdar://problem/13270100> llvm-svn: 175926
* Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction ↵Jim Ingham2013-02-091-3/+24
| | | | | | | | | | | interoperate to fix problems where hitting auto-continue signals while running a thread plan would cause us to lose control of the debug session. <rdar://problem/12993641> llvm-svn: 174793
* Added an SBAPI to get the PythonPath (if the Host knows how to do that). ↵Jim Ingham2012-12-211-0/+26
| | | | | | | | | 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
* Adding eStopReasonThreadExiting and fixing the handling of this state on Linux.Andrew Kaylor2012-12-201-0/+1
| | | | llvm-svn: 170800
* Initialize m_done to false in Driver constructor to avoid premature exit bug ↵Daniel Malea2012-12-171-1/+2
| | | | | | | | (spotted on Linux) Patch by Chia-Hung Duan! llvm-svn: 170348
* Trigger the display of error and output in sourced commands from the result ↵Enrico Granata2012-12-141-3/+4
| | | | | | | | | object's status instead of the presence of text in the error stream This should be more consistent with the notion of command success/failure and avoids spewing warnings that the user might not care about There will need to be an option to specify the level of verbosity desired (never show anything, only show failures, errors and warning, everything) llvm-svn: 170167
* <rdar://problem/12700464>Enrico Granata2012-12-131-0/+13
| | | | | | Fixing an issue where errors in command files sourced as arguments to command-line lldb (e.g. ./lldb -s foo.cmd) would not be shown to the user llvm-svn: 170146
* Broadcast an event when the selected thread is changed.Jim Ingham2012-12-111-2/+4
| | | | | | <rdar://problem/10976636> llvm-svn: 169810
* More Linux warnings fixes (remove default labels as needed):Daniel Malea2012-12-071-1/+0
| | | | | | | | - as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations Patch by Matt Kopec! llvm-svn: 169633
* <rdar://problem/12649160>Greg Clayton2012-12-051-0/+1
| | | | | | Added the ability to debug through your process exec'ing itself to the same architecture. llvm-svn: 169340
* <rdar://problem/12798131> Greg Clayton2012-12-041-2/+2
| | | | | | | | | | | | 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
* Save and restore terminal state when lldb is suspended with SIGTSTP and ↵Jim Ingham2012-11-301-0/+20
| | | | | | | | | resumed with SIGCONT. Readline & gdb have a bunch of code to handle older UNIX'es with other job control mechanisms. I didn't try to replicate that. llvm-svn: 169032
OpenPOWER on IntegriCloud