summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/Reproducer] Add SBReproducer::Replay overload (again)Jonas Devlieghere2020-01-101-0/+4
| | | | | | | I modified the SBAPI under the assumption that nobody was using the old API yet. However, that turns out to be false. So instead of adding the deafault argument I've reintroduced the old API and made the new one an overload.
* Data formatters: Look through array element typedefsJaroslav Sevcik2020-01-101-2/+4
| | | | | | | | | | | | | | | | | Summary: Motivation: When formatting an array of typedefed chars, we would like to display the array as a string. The string formatter currently does not trigger because the formatter lookup does not resolve typedefs for array elements (this behavior is inconsistent with pointers, for those we do look through pointee typedefs). This patch tries to make the array formatter lookup somewhat consistent with the pointer formatter lookup. Reviewers: teemperor, clayborg Reviewed By: teemperor, clayborg Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72133
* [lldb/Bindings] Move bindings into their own subdirectoryJonas Devlieghere2020-01-091-4/+4
| | | | | | | | | | | | All the code required to generate the language bindings for Python and Lua lives under scripts, even though the majority of this code aren't scripts at all, and surrounded by scripts that are totally unrelated. I've reorganized these files and moved everything related to the language bindings into a new top-level directory named bindings. This makes the corresponding files self contained and much more discoverable. Differential revision: https://reviews.llvm.org/D72437
* [lldb][NFC] Use static_cast instead of reinterpret_cast where possibleRaphael Isemann2020-01-071-1/+1
| | | | | | | | | | | | | | Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161
* [CMake] Add $ORIGIN/../../../../lib to rpath if BUILD_SHARED_LIBS or ↵Fangrui Song2020-01-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM_LINK_LLVM_DYLIB on *nix Summary: lib/python2.7/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so, which depends on lib/libLLVM*.so (-DBUILD_SHARED_LIBS=ON) or lib/libLLVM-10git.so (-DLLVM_LINK_LLVM_DYLIB=ON). Add an additional rpath `$ORIGIN/../../../../lib` so that _lldb.so can be loaded from Python. This fixes an import error from lib/python2.7/dist-packages/lldb/__init__.py from . import _lldb ImportError: libLLVMAArch64CodeGen.so.10git: cannot open shared object file: No such file or directory The following configurations will work: * -DBUILD_SHARED_LIBS=ON * -DBUILD_SHARED_LIBS=OFF -DLLVM_LINK_LLVM_DYLIB=ON * -DBUILD_SHARED_LIBS=OFF -DLLVM_LINK_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON (-DCLANG_LINK_CLANG_DYLIB=ON depends on -DLLVM_LINK_LLVM_DYLIB=ON) Reviewed By: labath Differential Revision: https://reviews.llvm.org/D71800
* [lldb/CMake] Use PYTHON_LIBRARIES instead of PYTHON_LIBRARYJonas Devlieghere2020-01-021-2/+2
| | | | | | PYTHON_LIBRARIES is the canonical variable set by FindPythonLibs while PYTHON_LIBRARY is an implementation detail. This replaces the uses of the latter with the former.
* [Lldb/Lua] Generate Lua BindingsJonas Devlieghere2019-12-211-0/+19
| | | | | | | | | | | This patch uses SWIG to generate the Lua bindings for the SB API. It covers most of the API, but some methods require a type map similar to Python. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html Differential revision: https://reviews.llvm.org/D71235
* [lldb] Expose more optional dependencies through GetBuildConfiguration()Jonas Devlieghere2019-12-201-0/+12
| | | | | Expose all the externally-observable optional dependencies through SBDebugger::GetBuildConfiguration().
* [lldb/Lua] Add Boilerplate for a Lua Script InterpreterJonas Devlieghere2019-12-191-0/+8
| | | | | | | | | | | This adds the boilerplate necessary to support the Lua script interpreter. The interpreter is not functional yet and just reports that it's not implemented. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html Differential revision: https://reviews.llvm.org/D71232
* [lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHONJonas Devlieghere2019-12-133-8/+8
| | | | | | | This matches the naming scheme used by LLVM and all the other optional dependencies in LLDB. Differential revision: https://reviews.llvm.org/D71482
* [lldb/CMake] Rename LLDB_DISABLE_CURSES to LLDB_ENABLE_CURSESJonas Devlieghere2019-12-121-5/+1
| | | | | | This matches the naming scheme used by LLVM. Differential revision: https://reviews.llvm.org/D71377
* Remove TypeValidators (NFC in terms of the testsuite)Adrian Prantl2019-12-111-20/+0
| | | | | | | | This is a half-implemented feature that as far as we can tell was never used by anything since its original inclusion in 2014. This patch removes it to make remaining the code easier to understand. Differential Revision: https://reviews.llvm.org/D71310
* Revert "Temporarily revert [lldb] e81268d - [lldb/Reproducers] Support ↵Eric Christopher2019-12-101-2/+3
| | | | | | | | | multiple GDB remotes" On multiple retry this issue won't duplicate - will revisit with author if duplication works again. This reverts commit c9e0b354e2749ce7ab553974692cb35c8651a869.
* Temporarily revert [lldb] e81268d - [lldb/Reproducers] Support multiple GDB ↵Eric Christopher2019-12-101-3/+2
| | | | | | | | | remotes This was causing a crash in opt+assert builds on linux and a follow-up message was posted. This reverts commit e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf
* [lldb/Host] Use Host/Config.h entries instead of a global define.Jonas Devlieghere2019-12-103-2/+4
| | | | | | | | | | | As suggested by Pavel in a code review: > Can we replace this (and maybe python too, while at it) with a > Host/Config.h entry? A global definition means that one has to > recompile everything when these change in any way, whereas in > practice only a handful of files need this.. Differential revision: https://reviews.llvm.org/D71280
* [lldb/Reproducers] Support multiple GDB remotesJonas Devlieghere2019-12-101-2/+3
| | | | | | | | | | | | | | | | When running the test suite with always capture on, a handful of tests are failing because they have multiple targets and therefore multiple GDB remote connections. The current reproducer infrastructure is capable of dealing with that. This patch reworks the GDB remote provider to support multiple GDB remote connections, similar to how the reproducers support shadowing multiple command interpreter inputs. The provider now keeps a list of packet recorders which deal with a single GDB remote connection. During replay we rely on the order of creation to match the number of packets to the GDB remote connection. Differential revision: https://reviews.llvm.org/D71105
* [lldb/Reproducers] Don't instrument SBFileSpec::GetPathJonas Devlieghere2019-12-041-1/+1
| | | | | This method uses a char* and length as output arguments and the reproducer instrumentation doesn't know how to deal with that (yet).
* [lldb/Reproducers] Add missing instrumentation for SBFile (2/2)Jonas Devlieghere2019-12-041-3/+3
| | | | Found another issue while running TestDefaultConstructorForAPIObjects.
* [lldb/Reproducers] Add missing instrumentation for SBFileJonas Devlieghere2019-12-042-16/+19
| | | | | This was properly captured by the instrumentation framework when running TestRunCommandInterpreterAPI.py in capture-mode.
* Change Target::FindBreakpointsByName to return Expected<vector>Joseph Tremoulet2019-12-041-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Using a BreakpointList corrupts the breakpoints' IDs because BreakpointList::Add sets the ID, so use a vector instead, and update the signature to return the vector wrapped in an llvm::Expected which can propagate any error from the inner call to StringIsBreakpointName. Note that, despite the similar name, SBTarget::FindBreakpointsByName doesn't suffer the same problem, because it uses a SBBreakpointList, which is more like a BreakpointIDList than a BreakpointList under the covers. Add a check to TestBreakpointNames that, without this fix, notices the ID getting mutated and fails. Reviewers: jingham, JDevlieghere Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70907
* [lldb] Remove FileSpec(FileSpec*) constructorPavel Labath2019-12-041-1/+1
| | | | | This constructor was the cause of some pretty weird behavior. Remove it, and update all code to properly dereference the argument instead.
* [lldb][NFC] Migrate to raw_ostream in Module::GetDescriptionRaphael Isemann2019-12-041-1/+1
|
* [lldb/Reproducer] Add version checkJonas Devlieghere2019-12-031-2/+18
| | | | | | | | | | | | | | | | | | | 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] Remove FileSpec->CompileUnit inheritancePavel Labath2019-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: CompileUnit is a complicated class. Having it be implicitly convertible to a FileSpec makes reasoning about it even harder. This patch replaces the inheritance by a simple member and an accessor function. This avoid the need for casting in places where one needed to force a CompileUnit to be treated as a FileSpec, and does not add much verbosity elsewhere. It also fixes a bug where we were wrongly comparing CompileUnit& and a CompileUnit*, which compiled due to a combination of this inheritance and the FileSpec*->FileSpec implicit constructor. Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70827
* [lldb] NFC: refactor CompileUnit::ResolveSymbolContextKonrad Kleine2019-11-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I found the above named method hard to read because it had a) many nested blocks, b) one return statement at the end with some logic involved, c) a duplicated while-loop with just small differences in it. I decided to refactor this function by employing an early exit strategy. In order to capture the logic in the return statement and to not have it repeated more than once I chose to implement a very small lamda function that captures all the variables it needs. I also replaced the two while-loops with just one. This is a non-functional change (NFC). Reviewers: jdoerfert, teemperor Reviewed By: teemperor Subscribers: labath, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70774
* Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"Raphael Isemann2019-11-281-4/+3
| | | | | | This reverts commit 373e2a4f69d623e59329ff801f261d8b299e12d2. This broke breakpoint setting.
* [lldb] NFC: refactor CompileUnit::ResolveSymbolContextKonrad Kleine2019-11-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: I found the above named method hard to read because it had a) many nested blocks and b) one return statement at the end with some logic involved. I decided to refactor this function by employing an early exit strategy. In order to capture the logic in the return statement and to not have it repeated more than once I chose to implement a very small lamda function that captures all the variables it needs. This is a non-functional change (NFC). Reviewers: jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70774
* [lldb][NFC] Allow range-based for-loops on VariableListRaphael Isemann2019-11-253-24/+15
| | | | | | | | | | | | | | | | Summary: Adds support for doing range-based for-loops on LLDB's VariableList and modernises all the index-based for-loops in LLDB where possible. Reviewers: labath, jdoerfert Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70668
* [Reproducer] Generate LLDB reproducer on crashJonas Devlieghere2019-11-201-1/+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] Only set FRAMEWORK when we're actually building a framework.Jonas Devlieghere2019-11-121-1/+2
|
* [LLDB] Fix/silence CMake developer warning for LLDB framework.Jonas Devlieghere2019-11-121-1/+1
| | | | | | | | | | | | This fixes the following warning for developers: Target 'liblldb' was changed to a FRAMEWORK sometime after install(). This may result in the wrong install DESTINATION. Set the FRAMEWORK property earlier. The solution is to pass the FRAMEWORK flag to add_lldb_library and set the target property before install(). For now liblldb is the only customer.
* [lldb] Remove dead code from STLUtils.hJonas Devlieghere2019-11-061-2/+1
|
* Add the ability to pass extra args to a Python breakpoint callback.Jim Ingham2019-10-253-21/+81
| | | | | | | | | | | | | | | | | For example, it is pretty easy to write a breakpoint command that implements "stop when my caller is Foo", and it is pretty easy to write a breakpoint command that implements "stop when my caller is Bar". But there's no way to write a generic "stop when my caller is..." function, and then specify the caller when you add the command to a breakpoint. With this patch, you can pass this data in a SBStructuredData dictionary. That will get stored in the PythonCommandBaton for the breakpoint, and passed to the implementation function (if it has the right signature) when the breakpoint is hit. Then in lldb, you can say: (lldb) break com add -F caller_is -k caller_name -v Foo More generally this will allow us to write reusable Python breakpoint commands. Differential Revision: https://reviews.llvm.org/D68671
* Modernize the rest of the Find.* API (NFC)Adrian Prantl2019-10-172-35/+27
| | | | | | | | | | | | This patch removes the size_t return value and the append parameter from the remainder of the Find.* functions in LLDB's internal API. As in the previous patches, this is motivated by the fact that these parameters aren't really used, and in the case of the append parameter were frequently implemented incorrectly. Differential Revision: https://reviews.llvm.org/D69119 llvm-svn: 375160
* [ARC] Add SystemV ABITatyana Krasnukha2019-10-171-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D55724 llvm-svn: 375123
* SBCommandReturnObject: change LLDB_RECORD_METHOD(..., FILE *, ...) to use ↵Fangrui Song2019-10-171-11/+10
| | | | | | | | | | | | | | | | | | | LLDB_RECORD_DUMMY POSIX says FILE is a typedef to a structure containing information about a file. The structure is unspecified, i.e. it may be an incomplete type, as is the case on musl (`struct _IO_FILE` is an implementation detail that is not exposed). `LLDB_RECORD_METHOD(..., (FILE *), ...)` transitively uses sizeof(FILE) and requires the structure to be complete. Change it to LLDB_RECORD_DUMMY to fix the build failure on musl (regression of D57475). Reviewed By: JDevlieghere, labath, lawrence_danna Differential Revision: https://reviews.llvm.org/D68872 llvm-svn: 375072
* remove FILE* usage from SBStream.iLawrence D'Anna2019-10-151-2/+16
| | | | | | | | | | | | | | | | | | | | Summary: This patch removes FILE* and replaces it with SBFile and FileSP the SWIG interface for `SBStream.i`. And this is the last one. With this change, nothing in the python API will can access a FILE* method on the C++ side. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68960 llvm-svn: 374924
* SBFile::GetFile: convert SBFile back into python native files.Lawrence D'Anna2019-10-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: This makes SBFile::GetFile public and adds a SWIG typemap to convert the result back into a python native file. If the underlying File itself came from a python file, it is returned identically. Otherwise a new python file object is created using the file descriptor. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68737 llvm-svn: 374911
* build fix for SBInstruction.Lawrence D'Anna2019-10-142-2/+2
| | | | | | | | | | | | | | oops! I cherry-picked rL374820 thinking it was completely independent of D68737, but it wasn't. It makes an incidental use of SBFile::GetFile, which is introduced there, so I broke the build. The docs say you can commit without review for "obvious". I think this qualifies. If this kind of fix isn't considered obvious, let me know and I'll revert instead. Fixes: rL374820 llvm-svn: 374825
* remove FILE* bindings from SBInstruction.Lawrence D'Anna2019-10-142-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch replaces the FILE* python bindings for SBInstruction and SBInstructionList and replaces them with the new, safe SBFile and FileSP bindings. I also re-enable `Test_Disassemble_VST1_64`, because now we can use the file bindings as an additional test of the disassembler, and we can use the disassembler test as a test of the file bindings. The bugs referred to in the comments appear to have been fixed. The radar is closed now and the bugzilla bug does not reproduce with the instructions given. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68890 llvm-svn: 374820
* uint32_t options -> File::OpenOptions optionsLawrence D'Anna2019-10-142-2/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch re-types everywhere that passes a File::OpenOptions as a uint32_t so it actually uses File::OpenOptions. It also converts some OpenOptions related functions that fail by returning 0 or NULL into llvm::Expected split off from https://reviews.llvm.org/D68737 Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68853 llvm-svn: 374817
* remove FILE* usage from ReportEventState() and HandleProcessEvent()Lawrence D'Anna2019-10-142-15/+60
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP and SBFile versions of the API methods ReportEventState and HandleProcessEvent. It points the SWIG wrappers at these instead of the ones that use FILE* streams. Reviewers: JDevlieghere, jasonmolenda, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68546 llvm-svn: 374816
* update SBDebugger::SetInputFile() etc to work on native FilesLawrence D'Anna2019-10-101-0/+27
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP versions of SetInputFile(), SetOutputFile, and SetErrorFile(). SWIG will convert native python file objects into FileSP. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68734 llvm-svn: 374422
* remove a smattering of isolated, unnecessary uses of FILE*Lawrence D'Anna2019-10-091-4/+2
| | | | | | | | | | | | | | | | | | Summary: There a a few call sites that use FILE* which are easy to fix without disrupting anything else. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere, labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68444 llvm-svn: 374239
* SBFile support in SBCommandReturnObjectLawrence D'Anna2019-10-093-10/+77
| | | | | | | | | | | | | | | | | | 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
* allow arbitrary python streams to be converted to SBFileLawrence D'Anna2019-10-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds SWIG typemaps that can convert arbitrary python file objects into lldb_private::File. A SBFile may be initialized from a python file using the constructor. There are also alternate, tagged constructors that allow python files to be borrowed, and for the caller to control whether or not the python I/O methods will be called even when a file descriptor is available.I Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: zturner, amccarth, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68188 llvm-svn: 374225
* Remove the is_mangled flag from Mangled and SymbolAdrian Prantl2019-10-091-1/+1
| | | | | | | | | | | | | | | Testing whether a name is mangled or not is extremely cheap and can be done by looking at the first two characters. Mangled knows how to do it. On the flip side, many call sites that currently pass in an is_mangled determination do not know how to correctly do it (for example, they leave out Swift mangling prefixes). This patch removes this entry point and just forced Mangled to determine the mangledness of a string itself. Differential Revision: https://reviews.llvm.org/D68674 llvm-svn: 374180
* [Reproducer] Don't isntrument methods that get called from the signal handler.Jonas Devlieghere2019-10-081-5/+4
| | | | | | | | | | | | | | LLDB's signal handlers call SBDebugger methods, which themselves try to be really careful about not doing anything non-signal safe. The Reproducer record macro is not careful though, and does unsafe things which potentially caused LLDB to crash. Given that these methods are not particularly interesting I've swapped the RECORD macros with DUMMY ones, so that we still register the API boundary but don't do anything non-signal safe. Thanks Jim for figuring this one out! llvm-svn: 374104
* [lldb] Fix crash on SBCommandReturnObject & assignmentJan Kratochvil2019-10-042-56/+68
| | | | | | | | | | | | | | | | | I was writing an SB API client and it was crashing on: bool DoExecute(SBDebugger dbg, char **command, SBCommandReturnObject &result) { result = subcommand(dbg, "help"); That is because SBCommandReturnObject &result gets initialized inside LLDB by: bool DoExecute(Args &command, CommandReturnObject &result) override { // std::unique_ptr gets initialized here from `&result`!!! SBCommandReturnObject sb_return(&result); DoExecute(...); sb_return.Release(); Differential revision: https://reviews.llvm.org/D67589 llvm-svn: 373775
* [lldb] Get the TargetAPI lock in SBProcess::IsInstrumentationRuntimePresentRaphael Isemann2019-10-041-0/+3
| | | | | | | | | | | | | | | | | | | Summary: We should get the TargetAPI lock here to prevent the process of being destroyed while we are in the function. Thanks Jim for explaining what's going on. Fixes rdar://54424754 Reviewers: jingham Reviewed By: jingham Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67831 llvm-svn: 373725
OpenPOWER on IntegriCloud