summaryrefslogtreecommitdiffstats
path: root/lldb/tools/driver
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/Reproducer] Add version checkJonas Devlieghere2019-12-032-1/+5
| | | | | | | | | | | | | | | | | | | To ensure a reproducer works correctly, the version of LLDB used for capture and replay must match. Right now the reproducer already contains the LLDB version. However, this is purely informative. LLDB will happily replay a reproducer generated with a different version of LLDB, which can cause subtle differences. This patch adds a version check which compares the current LLDB version with the one in the reproducer. If the version doesn't match, LLDB will refuse to replay. It also adds an escape hatch to make it possible to still replay the reproducer without having to mess with the recorded version. This might prove useful when you know two versions of LLDB match, even though the version string doesn't. This behavior is triggered by passing a new flag -reproducer-skip-version-check to the lldb driver. Differential revision: https://reviews.llvm.org/D70934
* [lldb] fix a -Wcast-qual warningPavel Labath2019-11-261-1/+1
|
* [Driver] Fix newline at the end of help outputJonas Devlieghere2019-11-211-3/+2
| | | | | Print a regular newline at the end of the help output. The current string literal seems to throw off shells.
* [Reproducer] Instruct users to replay reproducerJonas Devlieghere2019-11-211-4/+12
| | | | | | | | | | | | | | | | | | | | Improve the message printed when LLDB crashes by asking the user to replay the reproducer before attaching it to a bugreport.. ******************** Crash reproducer for lldb version 10.0.0 (git@github.com:llvm/llvm-project.git revision ...) clang revision ... llvm revision ... Reproducer written to '/path/to/reproducer' Before attaching the reproducer to a bug report: - Look at the directory to ensure you're willing to share its content. - Make sure the reproducer works by replaying the reproducer. Replay the reproducer with the following command: ./bin/lldb -replay /path/to/reproducer ********************
* [Docs] Generate the LLDB man page with SphinxJonas Devlieghere2019-11-211-1/+3
| | | | | | | | | | | This patch replaces the existing out-of-date man page for lldb and replaces it with an RST file from which sphinx generates the actual troff file. This is similar to how man pages are generated for the rest of the LLVM utilities. The man page is generated by building the `docs-lldb-man` target. Differential revision: https://reviews.llvm.org/D70514
* [Driver] Fix missing space in lldb --help output.Jonas Devlieghere2019-11-201-1/+1
|
* [Reproducer] Generate LLDB reproducer on crashJonas Devlieghere2019-11-201-0/+17
| | | | | | | | | | | | | | | | | | | | This patch hooks the reproducer infrastructure with the signal handlers. When lldb crashes with reproducers capture enabled, it will now generate the reproducer and print a short message the standard out. This doesn't affect the pretty stack traces, which are still printed before. This patch also introduces a new reproducer sub-command that intentionally raises a given signal to test the reproducer signal handling. Currently the signal handler is doing too much work. Instead of copying over files into the reproducers in the signal handler, we should re-invoke ourselves with a special command line flag that looks at the VFS mapping and performs the copy. This is a NO-OP when reproducers are disabled. Differential revision: https://reviews.llvm.org/D70474
* [LLDB] Fix formatting in the driver (NFC)Jonas Devlieghere2019-11-191-2/+1
|
* [Signal] Allow llvm clients to opt into one-shot SIGPIPE handlingVedant Kumar2019-11-181-20/+1
| | | | | | | | | | | | | | | | | | | | Allow clients of the llvm library to opt-in to one-shot SIGPIPE handling, instead of forcing them to undo llvm's SIGPIPE handler registration (which is brittle). The current behavior is preserved for all llvm-derived tools (except lldb) by means of a default-`true` flag in the InitLLVM constructor. This prevents "IO error" crashes in long-lived processes (lldb is the motivating example) which both a) load llvm as a dynamic library and b) *really* need to ignore SIGPIPE. As llvm signal handlers can be installed when calling into libclang (say, via RemoveFileOnSignal), thereby overriding a previous SIG_IGN for SIGPIPE, there is no clean way to opt-out of "exit-on-SIGPIPE" in the current model. Differential Revision: https://reviews.llvm.org/D70277
* [CMake] Configure the Info.plist so it contains a real version number.Jonas Devlieghere2019-11-152-2/+6
| | | | | Use CMake to configure the Info.plist file so that we have a real version number in things like crash reporter.
* [LLDB] Don't install the pretty stack trace handler twice.Jonas Devlieghere2019-11-131-7/+3
| | | | | | | | | I noticed that currently we are printing LLVM's pretty stack trace twice. The reason is that we're calling PrintStackTraceOnErrorSignal in addition to InitLLVM, which besides some other useful things, also register LLVM's pretty stack trace handler. Differential revision: https://reviews.llvm.org/D70216
* [lldb] Record framework build path and use it everywhereHaibo Huang2019-11-061-2/+1
| | | | This avoids config time dependencies on liblldb. And enables other refactoring.
* [Driver] Force llvm to install its handlers before lldb'sVedant Kumar2019-10-251-0/+19
| | | | | | | | | | | | | | | | | | | | | | Install llvm's signal handlers up front to prevent lldb's handlers from being ignored. This is (hopefully) a stopgap workaround. When lldb invokes an llvm API that installs signal handlers (e.g. llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within lldb), lldb's signal handlers are overriden if llvm is installing its handlers for the first time. To work around llvm's behavior, force it to install its handlers up front, and *then* install lldb's handlers. In practice this is used to prevent lldb test processes from exiting due to IO_ERR when SIGPIPE is received. Note that when llvm installs its handlers, it 1) records the old handlers it replaces and 2) re-installs the old handlers when its new handler is invoked. That means that a signal not explicitly handled by lldb can fall back to being handled by llvm's handler the first time it is received, and then by the default handler the second time it is received. Differential Revision: https://reviews.llvm.org/D69403
* Revert "Disable exit-on-SIGPIPE in lldb"Vedant Kumar2019-10-241-10/+0
| | | | | | | This reverts commit 32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30. In post-commit review, Pavel pointed out that there's a simpler way to ignore SIGPIPE in lldb that doesn't rely on llvm's handlers.
* Disable exit-on-SIGPIPE in lldbVedant Kumar2019-10-181-0/+10
| | | | | | | | | | | | | | | | | | Occasionally, during test teardown, LLDB writes to a closed pipe. Sometimes the communication is inherently unreliable, so LLDB tries to avoid being killed due to SIGPIPE (it calls `signal(SIGPIPE, SIG_IGN)`). However, LLVM's default SIGPIPE behavior overrides LLDB's, causing it to exit with IO_ERR. Opt LLDB out of the default SIGPIPE behavior. I expect that this will resolve some LLDB test suite flakiness (tests randomly failing with IO_ERR) that we've seen since r344372. rdar://55750240 Differential Revision: https://reviews.llvm.org/D69148 llvm-svn: 375288
* [LLDB] [Driver] Use llvm::InitLLVM to do unicode argument conversion on WindowsMartin Storsjo2019-10-111-17/+3
| | | | | | | | | This avoids the currently MSVC specific codepath of using the wchar entry point and converting that to utf8. Differential Revision: https://reviews.llvm.org/D68770 llvm-svn: 374526
* SBFile support in SBCommandReturnObjectLawrence D'Anna2019-10-091-6/+7
| | | | | | | | | | | | | | | | | | Summary: This patch add SBFile interfaces to SBCommandReturnObject, and removes the internal callers of its FILE* interfaces. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68434 llvm-svn: 374238
* [Driver] Remove duplicate option parsing (NFC)Jonas Devlieghere2019-09-031-8/+1
| | | | | | | | We were checking OPT_no_use_colors three times, twice to disable colors and once to enable debug mode. This simplifies things and now the option is only checked once. llvm-svn: 370814
* Detect HAVE_SYS_TYPES_H in lldbHaibo Huang2019-08-071-0/+2
| | | | | | | | | | | | | | | | Summary: After rL368069 I noticed that HAVE_SYS_TYPES_H is not defined in Platform.h, or anywhere else in lldb. This change fixes that. Reviewers: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65822 llvm-svn: 368125
* Various build fixes for lldb on MinGWHaibo Huang2019-08-061-0/+3
| | | | | | | | | | Subscribers: mstorsjo, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65691 llvm-svn: 368069
* [windows] re-call signal in sigint_handler for WindowsNathan Lanza2019-07-121-0/+3
| | | | | | | | | | | | Summary: Windows requires re-setting the signal handler each time it is used and thus ctrl-c was not behaving properly on Windows Reviewers: jfb Differential Revision: https://reviews.llvm.org/D64046 llvm-svn: 365868
* [CMake] LLDB.framework tools handlingStefan Granitz2019-05-291-1/+11
| | | | | | | | | | | | | | | | | | | | Summary: Modify the way LLDB.framework tools are collected. This allows for better fine-tuning of the install behavior downstream. Each target calls `lldb_add_to_framework()` individually. When entering the function, the target exists and we can tweak its very own post-build and install steps. This was not possible with the old `LLDB_FRAMEWORK_TOOLS` approach. No function change otherwise. This is a reduced follow-up from the proposal in D61952. Reviewers: xiaobai, compnerd, JDevlieghere Reviewed By: JDevlieghere Subscribers: clayborg, friss, ki.stfu, mgorny, lldb-commits, labath, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D62472 llvm-svn: 361946
* [CMake] Folder structure for generated Xcode project to cover more targetsStefan Granitz2019-05-281-0/+2
| | | | llvm-svn: 361799
* [lldb] Fix use-of-uninitialized-value in DriverJorge Gorbe Moya2019-05-221-1/+1
| | | | | | | | | | | | The driver passes by reference an uninitialized num_errors variable to RunCommandInterpreter. This should be fine, as it's supposed to be an output argument, but the reproducer instrumentation reads it in order to record the value of all the arguments to the function. This change fixes it by initializing num_errors to 0 before calling RunCommandInterpreter. llvm-svn: 361444
* [CMake] Inline info plist in lldb driverStefan Granitz2019-05-171-0/+5
| | | | llvm-svn: 361068
* typedef enum -> enumFangrui Song2019-05-141-2/+2
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* [Driver] Add command line option to allow loading local lldbinit file.Jonas Devlieghere2019-05-072-0/+8
| | | | | | | | | This patch adds a command line flag that allows lldb to load local lldbinit files. Differential revision: https://reviews.llvm.org/D61578 llvm-svn: 360172
* [Driver] Change the way we deal with local lldbinit files.Jonas Devlieghere2019-05-062-60/+12
| | | | | | | | | | | | | | | | 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-262-53/+27
| | | | | | | | 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
* Fix signed-unsigned comparison warning in Driver.cppPavel Labath2019-04-081-1/+1
| | | | llvm-svn: 357893
* Fix and simplify PrepareCommandsForSourcingAdrian McCarthy2019-04-031-75/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spotted some problems in the Driver's PrepareCommandsForSourcing while helping a colleague track another problem. 1. One error case was not handled because there was no else clause. Fixed by switching to llvm's early-out style instead of nested `if (succes) { } else { }` cases. This keeps error handling close to the actual error. 2. One call-site failed to call the clean-up function. I solved this by simplifying the API. PrepareCommandsForSourcing no longer requires the caller to provide a buffer for the pipe's file descriptors and to call a separate clean-up function later. PrepareCommandsForSourcing now ensures the file descriptors are handled before returning. (The read end of the pipe is held open by the returned FILE * as before.) I also eliminated an unnecessary local, shorted the lifetime of another, and tried to improve the comments. I wrapped the call to open the pipe to get the `#ifdef`s out of the mainline. I replaced the `close`/`_close` calls with a platform-neutral helper from `llvm::sys` for the same reason. Per discussion on the review, I'm leaving the `fdopen` call to use the spelling that Windows has officially deprecated because it still works it avoids more `#ifdef`s. Differential Revision: https://reviews.llvm.org/D60152 llvm-svn: 357626
* Update the lldb driver to support the -O and -S options when passing --replAdrian Prantl2019-03-251-125/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment when --repl is passed to lldb it silently ignores any commands passed via the options below: --one-line-before-file <command> Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded. --one-line <command> Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded. --source-before-file <file> Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded. --source <file> Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded. -O <value> Alias for --one-line-before-file -o <value> Alias for --one-line -S <value> Alias for --source-before-file -s <value> Alias for --source The -O and -S options are quite useful when writing tests for the REPL though, e.g. to change settings prior to entering REPL mode. This patch updates the driver to still respect the commands supplied via -O and -S when passing --repl instead of silently ignoring them. As -s and -o don't really make sense in REPL mode, commands supplied via those options are still ignored, but the driver now emits a warning to make that clear to the user. Patch by Nathan Hawes! Differential Revision: https://reviews.llvm.org/D59681 llvm-svn: 356911
* [Reproducers] Support capturing a reproducer without an explicit path.Jonas Devlieghere2019-03-122-19/+38
| | | | | | | | | | | | | | Tablegen doesn't support options that are both flags and take values as an argument. I noticed this when doing the tablegen rewrite, but forgot that that affected the reproducer --capture flag. This patch makes --capture a flag and adds --capture-path to specify a path for the reproducer. In reality I expect this to be mostly used for testing, but it could be useful nonetheless. Differential revision: https://reviews.llvm.org/D59238 llvm-svn: 355936
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-111-1/+1
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* [Reproducers] Enable replay from SBRepro.Jonas Devlieghere2019-03-061-1/+1
| | | | | | | | | Now that the LLDB instrumentation macros are in place, we should use that to test reproducer replay. Differential revision: https://reviews.llvm.org/D58565 llvm-svn: 355470
* [Reproducers] Initialize reproducers before initializing the debugger.Jonas Devlieghere2019-02-211-7/+13
| | | | | | | | | | | | | | | | As per the discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20190218/048007.html This commit implements option (3): > Go back to initializing the reproducer before the rest of the debugger. > The method wouldn't be instrumented and guarantee no other SB methods are > called or SB objects are constructed. The initialization then becomes part > of the replay. Differential revision: https://reviews.llvm.org/D58410 llvm-svn: 354631
* Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)Pavel Labath2019-02-071-4/+0
| | | | | | | | | | | | GetIndexForObjectImpl generated a bunch of "conversion casts away constness warnings". Change the function to use "const void *" (and static_cast, while I'm at it), to avoid this. Driver.cpp: unused variable "replay" (this was actually caused by a subsequent partial revert of this patch). I just finish the revert by removing the variable completely. llvm-svn: 353405
* [Driver] Don't try to replay reproducer in the driver.Jonas Devlieghere2019-02-071-9/+0
| | | | | | | Because the macros for the SBReproducers have not been committed yet, the driver should not attempt to replay a reproducer this way. llvm-svn: 353362
* [Reproducers] SBReproducer framework: Capture & ReplayJonas Devlieghere2019-02-061-1/+13
| | | | | | | | | | | | | This is part two of the reproducer instrumentation framework. It contains the code to capture and replay function calls. The main user of this framework will be the SB API layer. For all the details refer to the RFC on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-January/014530.html Differential revision: https://reviews.llvm.org/D56322 llvm-svn: 353324
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-194-16/+12
| | | | | | | | | | | | | | | | | 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-052-34/+35
| | | | llvm-svn: 350446
* [CMake] Revised RPATH handlingStefan Granitz2019-01-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling. * In the build-tree, tools use the absolute path to the framework's actual output location. * In the install-tree, tools get a list of RPATHs to look for the framework when deployed. `LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree. If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree). If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree. For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks". Reviewers: xiaobai, JDevlieghere, aprantl, clayborg Reviewed By: JDevlieghere Subscribers: ki.stfu, mgorny, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D55330 llvm-svn: 350392
* [CMake] Revised LLDB.framework buildsStefan Granitz2019-01-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements. Options: * `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree) * `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree * `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`) * `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets) Other changes: * clean up `add_lldb_executable()` * include `LLDBFramework.cmake` from `source/API/CMakeLists.txt` * use `*.plist.in` files, which are typical for CMake and independent from Xcode * add clang headers to the framework bundle Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath Reviewed By: aprantl Subscribers: friss, mgorny, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D55328 llvm-svn: 350391
* [Driver] Remove unused importsJonas Devlieghere2019-01-021-7/+0
| | | | | | Removes some unneeded includes from the driver. llvm-svn: 350267
* [Driver] Fix --repl argument.Jonas Devlieghere2018-12-172-8/+19
| | | | | | | | | | | | | | | | | The --repl option was incorrectly defined as "Separate" (option and value separated by a space). This resulted in the option not being picked up when no value was specified. This patch fixes the driver so that `--repl` is recognized again. I split the option into two: - A flag: `--repl` and `-r` which take no arguments. - A joined option: `--repl=<flags>` and `-r=<flags>` that forward its values to the repl. This should match the driver's old behavior. llvm-svn: 349371
* [Driver] Simplify OptionData. NFCJonas Devlieghere2018-12-112-68/+36
| | | | | | | | | | | | | 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
* [Reproducers] Change how reproducers are initialized.Jonas Devlieghere2018-12-032-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the way the reproducer is initialized. Rather than making changes at run time we now do everything at initialization time. To make this happen we had to introduce initializer options and their SB variant. This allows us to tell the initializer that we're running in reproducer capture/replay mode. Because of this change we also had to alter our testing strategy. We cannot reinitialize LLDB when using the dotest infrastructure. Instead we use lit and invoke two instances of the driver. Another consequence is that we can no longer enable capture or replay through commands. This was bound to go away form the beginning, but I had something in mind where you could enable/disable specific providers. However this seems like it adds very little value right now so the corresponding commands were removed. Finally this change also means you now have to control this through the driver, for which I replaced --reproducer with --capture and --replay to differentiate between the two modes. Differential revision: https://reviews.llvm.org/D55038 llvm-svn: 348152
* Fix windows build broken by r347846Pavel Labath2018-11-291-1/+0
| | | | | | | | | The changed order of includes caused compile errors on MSVC due to snprintf macro definition. snprintf should available since VS2015, and the rest of the code seems to be able to use snprintf just fine without this macro, so this removes it from the lldb driver as well. llvm-svn: 347855
* Remove getopt includes from the driverPavel Labath2018-11-292-13/+0
| | | | | | | | | | | | | They are not needed now that we use LLVMOption for command-line parsing thank you, Jonas). This also allows us to avoid linking of lldbHost into the driver which was breaking liblldb encapsulation. (Technically, there is still a lldb/Host/windows/windows.h include which is needed on windows, but this is a header-only wrapper for <windows.h>, so it is not necessary to link lldbHost for that. But ideally, that should go away too.) llvm-svn: 347846
* [driver] Fix --core/-c and add testJonas Devlieghere2018-11-292-50/+48
| | | | | | | | | | | Because the optarg variable was shadowed we didn't notice we weren't extracting the value from the option. This patch fixes that and renames the variable to prevent this from happening in the future. I also added two tests to check the error output for --core and --file when the given value doesn't exist. llvm-svn: 347821
OpenPOWER on IntegriCloud