summaryrefslogtreecommitdiffstats
path: root/lldb/scripts
Commit message (Collapse)AuthorAgeFilesLines
...
* Insert blocks of python code with swig instead of modify-python-lldb.pyPavel Labath2019-02-274-125/+98
| | | | | | | | | | | | | | | | | | | Summary: Swig is perfectly capable of inserting blocks of python code into its output (and we use those fascilities already), so there's no need for this to be done in a post-process step. lldb_iter is a general-purpose utility used from many classes, so I add it to the main swig file. The other two blocks are tied to a specific class, so I add it to the interface file of that class. Reviewers: zturner, jingham, serge-sans-paille Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58350 llvm-svn: 354975
* [Reproducers] Initialize reproducers before initializing the debugger.Jonas Devlieghere2019-02-213-26/+2
| | | | | | | | | | | | | | | | 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
* Embed swig version into lldb.py in a different wayPavel Labath2019-02-152-22/+16
| | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of doing string chopping on the resulting python file, get swig to output the version for us. The two things which make slightly non-trivial are: - in order to get swig to expand SWIG_VERSION for us, we cannot use %pythoncode directly, but we have to go through an intermediate macro. - SWIG_VERSION is a hex number, but it's components are supposed to be interpreted decimally, so there is a bit of integer magic needed to get the right number to come out. I've tested that this approach works both with the latest (3.0.12) and oldest (1.3.40) supported swig. Reviewers: zturner, jingham, serge-sans-paille Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58172 llvm-svn: 354104
* use_lldb_suite.py: Fix potential infinite loopPavel Labath2019-02-071-3/+4
| | | | | | | | | | | | | | The loop searching for use_lldb_suite_root had a bug where if the marker file happened to be missing, it would enter an infinite loop. While this shouldn't happen in normal circumstances, it can happen accidentally, and debugging it is not very pleasant. The loop had an exit condition, but it was incorrent (os.path.dirname returning None). This will never happen as dirname will just return the same folder over and over again once it reaches the root folder. This fixes the exit condition to account for that. llvm-svn: 353406
* [Expressions] Add support of expressions evaluation in some object's contextAleksandr Urakov2019-02-051-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support of expression evaluation in a context of some object. Consider the following example: ``` struct S { int a = 11; int b = 12; }; int main() { S s; int a = 1; int b = 2; // We have stopped here return 0; } ``` This patch allows to do something like that: ``` lldb.frame.FindVariable("s").EvaluateExpression("a + b") ``` and the result will be `33` (not `3`) because fields `a` and `b` of `s` will be used (not locals `a` and `b`). This is achieved by replacing of `this` type and object for the expression. This has some limitations: an expression can be evaluated only for values located in the debuggee process memory (they must have an address of `eAddressTypeLoad` type). Reviewers: teemperor, clayborg, jingham, zturner, labath, davide, spyffe, serge-sans-paille Reviewed By: jingham Subscribers: abidh, lldb-commits, leonid.mashinskiy Tags: #lldb Differential Revision: https://reviews.llvm.org/D55318 llvm-svn: 353149
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1968-272/+204
| | | | | | | | | | | | | | | | | 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
* [Python] Update PyString_FromString() to work for python 2 and 3.Davide Italiano2019-01-092-10/+3
| | | | | | | | | | Reviewers: aprantl, JDevlieghere, friss, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56511 llvm-svn: 350769
* [CMake] Python bindings generation polishingStefan Granitz2019-01-041-25/+20
| | | | | | | | | | | | | | | | | Summary: Simplify SWIG invocation and handling of generated files. The `swig_wrapper` target can generate `LLDBWrapPython.cpp` and `lldb.py` in its own binary directory, so we can get rid of a few global variables and their logic. We can use the swig_wrapper's BINARY_DIR target property to refer to it and liblldb's LIBRARY_OUTPUT_DIRECTORY to refer to the framework/shared object output directory. Reviewers: JDevlieghere, aprantl, stella.stamenova, beanz, zturner, xiaobai Reviewed By: aprantl Subscribers: mgorny, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D55332 llvm-svn: 350393
* [lldb] Add a "display-recognized-arguments" target setting to show ↵Kuba Mracek2018-12-201-1/+1
| | | | | | | | recognized arguments by default Differential Revision: https://reviews.llvm.org/D55954 llvm-svn: 349856
* Overload GetMemoryRegions for the ProcessMinidumpTatyana Krasnukha2018-12-201-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D55841 llvm-svn: 349767
* [lldb] Retrieve currently handled Obj-C exception via ↵Kuba Mracek2018-12-201-0/+18
| | | | | | | | | | | | __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI This builds on https://reviews.llvm.org/D43884 and https://reviews.llvm.org/D43886 and extends LLDB support of Obj-C exceptions to also look for a "current exception" for a thread in the C++ exception handling runtime metadata (via call to __cxa_current_exception_type). We also construct an actual historical SBThread/ThreadSP that contains frames from the backtrace in the Obj-C exception object. The high level goal this achieves is that when we're already crashed (because an unhandled exception occurred), we can still access the exception object and retrieve the backtrace from the throw point. In Obj-C, this is particularly useful because a catch+rethrow is very common and in those cases you currently don't have any access to the throw point backtrace. Differential Revision: https://reviews.llvm.org/D44072 llvm-svn: 349718
* Make scripts/analyzer-project-deps compatible with python3Pavel Labath2018-12-061-19/+19
| | | | llvm-svn: 348479
* [Reproducers] Change how reproducers are initialized.Jonas Devlieghere2018-12-033-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Target] Do not skip a stop on a breakpoint if a plan was completedAleksandr Urakov2018-11-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes the next situation. On Windows clang-cl makes no stub before the main function, so the main function is located exactly on module entry point. May be it is the same on other platforms. So consider the following sequence: - set a breakpoint on main and stop there; - try to evaluate expression, which requires a code execution on the debuggee side. Such an execution always returns to the module entry, and the plan waits for it there; - the plan understands that it is complete now and removes its breakpoint. But the breakpoint site is still there, because we also have a breakpoint on entry; - StopInfo analyzes a situation. It sees that we have stopped on the breakpoint site, and it sees that the breakpoint site has owners, and no one logical breakpoint is internal (because the plan is already completed and it have removed its breakpoint); - StopInfo thinks that it's a user breakpoint and skips it to avoid recursive computations; - the program continues. So in this situation the program continues without a stop right after the expression evaluation. To avoid this an additional check that the plan was completed was added. Reviewers: jingham, zturner, boris.ulasevich Reviewed by: jingham Tags: #lldb Differential Revision: https://reviews.llvm.org/D53761 llvm-svn: 347974
* [Reproducers] Improve reproducer API and add unit tests.Jonas Devlieghere2018-11-271-2/+2
| | | | | | | | | | | | | | | | | | | When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716
* Add setting to require hardware breakpoints.Jonas Devlieghere2018-11-151-0/+3
| | | | | | | | | | | | | | | | When debugging read-only memory we cannot use software breakpoint. We already have support for hardware breakpoints and users can specify them with `-H`. However, there's no option to force LLDB to use hardware breakpoints internally, for example while stepping. This patch adds a setting target.require-hardware-breakpoint that forces LLDB to always use hardware breakpoints. Because hardware breakpoints are a limited resource and can fail to resolve, this patch also extends error handling in thread plans, where breakpoints are used for stepping. Differential revision: https://reviews.llvm.org/D54221 llvm-svn: 346920
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-131-24/+30
| | | | llvm-svn: 346780
* Remove the last CURRENT_ARCH reference in Xcode's build scripts.Frederic Riss2018-11-121-1/+1
| | | | | | In the same spirit as r346443. llvm-svn: 346684
* Update framework-header-fix to force system sedDave Lee2018-11-041-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are 2 changes here: 1. Use system sed instead of the sed found in the user's path. This fixes this script in the case the user has gnu-sed in their $PATH before bsd sed since `-i ''` isn't compatible and you need `-i` instead. 2. `set -e` in this script so it fails as soon as one of these commands fail instead of throwing errors for each file if they fail Since this is only ran on macOS, and we're already using this absolute path below, this seems like a safe addition Reviewers: kastiglione, beanz Reviewed By: kastiglione Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D49776 llvm-svn: 346099
* Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit.Jim Ingham2018-11-021-0/+8
| | | | | | | | <rdar://problem/44809176> Differential Revision: https://reviews.llvm.org/D54056 llvm-svn: 346053
* [lldb] Introduce StackFrameRecognizer [take 3]Kuba Mracek2018-10-312-1/+53
| | | | | | | | This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345693
* Revert r345686 due to build failuresKuba Mracek2018-10-312-53/+1
| | | | llvm-svn: 345688
* [lldb] Introduce StackFrameRecognizer [take 2]Kuba Mracek2018-10-312-1/+53
| | | | | | | | This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345686
* Revert r345678 (build failure on Linux machines).Kuba Mracek2018-10-312-53/+1
| | | | llvm-svn: 345680
* [lldb] Introduce StackFrameRecognizerKuba Mracek2018-10-312-1/+53
| | | | | | | | This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345678
* [API] Extend the `SBThreadPlan` interfaceAleksandr Urakov2018-10-251-0/+3
| | | | | | | | | | | | | | | | | | Summary: This patch extends the `SBThreadPlan` to allow retrieving of thread plans for scripted steps. Reviewers: labath, zturner, jingham Reviewed By: jingham Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53361 llvm-svn: 345247
* Fix double import of _lldb module.Vadim Chugunov2018-10-141-5/+5
| | | | | | | | | | | | Fix llvm.org/pr39054: - Register _lldb as a built-in module during initialization of script interpreter, - Reverse the order of imports in __init__.py: first try to import by absolute name, which will find the built-in module in the context of lldb (and other hosts that embed liblldb), then try relative import, in case the module is being imported from Python interpreter. This works for SWIG>=3.0.11; before that, SWIG did not support custom module import code. Differential revision: https://reviews.llvm.org/D52404 llvm-svn: 344474
* Upstreaming the BridgeOS device support and the Jason Molenda2018-10-111-0/+3
| | | | | | | | | | | | | | | LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out. Also update Xcode project file to build the NativePDB etc plugins. <rdar://problem/43353615> llvm-svn: 344209
* Add support for artificial tail call framesVedant Kumar2018-10-051-0/+11
| | | | | | | | | | | | | | | | This patch teaches lldb to detect when there are missing frames in a backtrace due to a sequence of tail calls, and to fill in the backtrace with artificial tail call frames when this happens. This is only done when the execution history can be determined from the call graph and from the return PC addresses of calls on the stack. Ambiguous sequences of tail calls (e.g anything involving tail calls and recursion) are detected and ignored. Depends on D49887. Differential Revision: https://reviews.llvm.org/D50478 llvm-svn: 343900
* The Python 3 part of the script was missed when adding OpenBSD support.Brad Smith2018-10-041-2/+3
| | | | llvm-svn: 343810
* [SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().Davide Italiano2018-09-281-0/+4
| | | | | | <rdar://problem/44875808> llvm-svn: 343368
* [Swig] Merge typemaps with same bodiesTatyana Krasnukha2018-09-251-196/+53
| | | | | | Differential Revision: https://reviews.llvm.org/D52376 llvm-svn: 342959
* Add a "scripted" breakpoint type to lldb.Jim Ingham2018-09-135-0/+183
| | | | | | | | | | This change allows you to write a new breakpoint type where the logic for setting breakpoints is determined by a Python callback written using the SB API's. Differential Revision: https://reviews.llvm.org/D51830 llvm-svn: 342185
* Add support for descriptions with command completions.Raphael Isemann2018-09-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a framework for adding descriptions to the command completions we provide. It also adds descriptions for completed top-level commands so that we can test this code. Completions are in general supposed to be displayed alongside the completion itself. The descriptions can be used to provide additional information about the completion to the user. Examples for descriptions are function signatures when completing function calls in the expression command or the binary name when providing completion for a symbol. There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be used), so that's why I still had to change some function signatures. Also, as the old API only passes around a list of matches, and the descriptions are for these functions just another list, I had to add some code that essentially just ensures that both lists are always the same side (e.g. all the manual calls to `descriptions->AddString(X)` below a `matches->AddString(Y)` call). The initial command descriptions that come with this patch are just reusing the existing short help that is already added in LLDB. An example completion with descriptions looks like this: ``` (lldb) pl Available completions: platform -- Commands to manage and create platforms. plugin -- Commands for managing LLDB plugins. ``` Reviewers: #lldb, jingham Reviewed By: #lldb, jingham Subscribers: jingham, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D51175 llvm-svn: 342181
* Remove undefined behavior around the use of StateTypeShafik Yaghmour2018-09-111-0/+20
| | | | | | | | | | rdar://problem/43530233 Patch by Shafik Yaghmour. Differential Revision: https://reviews.llvm.org/D51445 llvm-svn: 341957
* Hold GIL while allocating memory for PythonString.Tatyana Krasnukha2018-09-051-0/+82
| | | | | | | | | | | | | | Summary: Swig wraps C++ code into SWIG_PYTHON_THREAD_BEGIN_ALLOW; ... SWIG_PYTHON_THREAD_END_ALLOW; Thus, LLDB crashes with "Fatal Python error: Python memory allocator called without holding the GIL" when calls an lldb_SB***___str__ function. Reviewers: clayborg Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D51569 llvm-svn: 341482
* Support setting a breakpoint by FileSpec+Line+Column in the SBAPI.Adrian Prantl2018-08-301-0/+5
| | | | | | | | | | | | This patch extends the SBAPI to allow for setting a breakpoint not only at a specific line, but also at a specific (minimum) column. When a column is specified, it will try to find an exact match or the closest match on the same line that comes after the specified location. Differential Revision: https://reviews.llvm.org/D51461 llvm-svn: 341078
* [LLDB] Fix script to work with GNU sedShoaib Meenai2018-08-281-5/+6
| | | | | | | | | | | | | | | | | GNU sed and BSD sed have a different command-line syntax for in-place editing, and the current form of the script would only work with BSD sed. The easiest way to get cross-platform behavior is to specify a backup suffix and then just delete the backup file at the end. (BSD sed is the default on macOS, but it's possible to acquire GNU coreutils and have your `sed` be GNU sed even on macOS; I'm aware it's not officially supported in any capacity, but it's easy enough to support here.) An alternative would be using `perl -p -i -e` instead of `sed -i`, but I figured it was best to make the minimal working change. Differential Revision: https://reviews.llvm.org/D51374 llvm-svn: 340885
* Add documentation for SBTarget::AppendImageSearchPathAlexander Polyakov2018-08-071-0/+3
| | | | llvm-svn: 339189
* Add new API to SBTarget classAlexander Polyakov2018-08-071-0/+5
| | | | | | | | | | | | | | | | Summary: The new API appends an image search path to the target's path mapping list. Reviewers: aprantl, clayborg, labath Reviewed By: aprantl Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D49739 llvm-svn: 339175
* Revert "Stop building liblldb with CMake's framework functionality"Alex Langford2018-07-271-3/+3
| | | | | | | | | | This reverts r338154. This change is actually unnecessary, as the CMake bug I referred to was actually not a bug but a misunderstanding of CMake. Original Differential Revision: https://reviews.llvm.org/D49888 llvm-svn: 338178
* Stop building liblldb with CMake's framework functionalityAlex Langford2018-07-271-3/+3
| | | | | | | | | | | | Summary: CMake has a bug in its ninja generator that prevents you from installing targets that are built with framework support. Therefore, I want to not rely on CMake's framework support. See https://gitlab.kitware.com/cmake/cmake/issues/18216 Differential Revision: https://reviews.llvm.org/D49888 llvm-svn: 338154
* Change sort-pbxproj.rb to find the project.pbxproj in the Jason Molenda2018-07-231-8/+18
| | | | | | | most likely locations. And have it overwrite the original file with the sorted output. llvm-svn: 337774
* Allow specifying an exit code for the 'quit' commandRaphael Isemann2018-07-111-0/+9
| | | | | | | | | | | | | | | | | | | 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
* Fix and simplify lldb.command decoratorDave Lee2018-07-041-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes one issue with `lldb.command`, and also reduces the implementation. The fix: a command function's docstring was not shown when running `help <command_name>`. This is because the docstring attached the source function is not propagated to the decorated function (`f.__call__`). By returning the original function, the docstring will be properly displayed by `help`. Also with this change, the command name is assumed to be the function's name, but can still be explicitly defined as previously. Additionally, the implementation was updated to: * Remove inner class * Remove use of `inspect` module * Remove `*args` and `**kwargs` Reviewers: clayborg Reviewed By: clayborg Subscribers: keith, xiaobai, lldb-commits Differential Revision: https://reviews.llvm.org/D48658 llvm-svn: 336287
* Add new API to SBTarget and SBModule classes.Alexander Polyakov2018-07-032-0/+34
| | | | | | | | | | | | | | Summary: The new API allows to find a list of compile units related to target/module. Reviewers: aprantl, clayborg Reviewed By: aprantl Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D48801 llvm-svn: 336200
* Re-sort the lldb.xcodeproj project file and commit the scriptJason Molenda2018-07-031-0/+241
| | | | | | | | | | | | that I used to sort it to scripts/sort-pbxproj.rb. It turns out that Xcode will perturb the order of the file lists every time we add a file, following its own logic, and unfortunately we'll still end up with lots of merge conflicts when that tries to merge to the github swift repositories. We talked this over and we're going to keep it in a canonical state by running this script over it when Xcode tries to reorder it. llvm-svn: 336158
* Add a way to load an image using a library name and list of paths.Jim Ingham2018-06-281-0/+13
| | | | | | | | | | This provides an efficient (at least on Posix platforms) way to offload to the target process the search & loading of a library when all we have are the library name and a set of potential candidate locations. <rdar://problem/40905971> llvm-svn: 335912
* Move AddressClass to private enums since API doesn't provide any functions ↵Tatyana Krasnukha2018-06-272-7/+1
| | | | | | | | to manage it. This change allows to make AddressClass strongly typed enum and not to have issues with old versions of SWIG that don't support enum classes. llvm-svn: 335710
* Fix a single typo in SBSymbolContextDave Lee2018-06-271-1/+1
| | | | | | | | | | | | | | Summary: Fix a "Manay" in SBSymbolContext.i Reviewers: xiaobai Reviewed By: xiaobai Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48620 llvm-svn: 335709
OpenPOWER on IntegriCloud