|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
8184b252 |
| 12-Jul-2022 |
Michael Buch <[email protected]> |
[LLDB][ClangExpression] Allow expression evaluation from within C++ Lambdas
This patch adds support for evaluating expressions which reference a captured `this` from within the context of a C++ lamb
[LLDB][ClangExpression] Allow expression evaluation from within C++ Lambdas
This patch adds support for evaluating expressions which reference a captured `this` from within the context of a C++ lambda expression. Currently LLDB doesn't provide Clang with enough information to determine that we're inside a lambda expression and are allowed to access variables on a captured `this`; instead Clang simply fails to parse the expression.
There are two problems to solve here: 1. Make sure `clang::Sema` doesn't reject the expression due to an illegal member access. 2. Materialize all the captured variables/member variables required to evaluate the expression.
To address (1), we currently import the outer structure's AST context onto `$__lldb_class`, making the `contextClass` and the `NamingClass` match, a requirement by `clang::Sema::BuildPossibleImplicitMemberExpr`.
To address (2), we inject all captured variables as locals into the expression source code.
**Testing**
* Added API test
show more ...
|
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2 |
|
| #
4125b462 |
| 11-Jun-2021 |
Raphael Isemann <[email protected]> |
Revert "[lldb] Add support for evaluating expressions in static member functions"
This reverts commit 00764c36edf88ae9806e8d57a6addb782e6ceae8 and the follow up d2223c7a49973a61cc2de62992662afa8d190
Revert "[lldb] Add support for evaluating expressions in static member functions"
This reverts commit 00764c36edf88ae9806e8d57a6addb782e6ceae8 and the follow up d2223c7a49973a61cc2de62992662afa8d19065a.
The original patch broke that one could use static member variables while inside a static member functions without having a running target. It seems that LLDB currently requires that static variables are only found via the global variable lookup so that they can get materialized and mapped to the argument struct of the expression.
After 00764c36edf88ae9806e8d57a6addb782e6ceae8 static variables of the current class could be found via Clang's lookup which LLDB isn't observing. This resulting in expressions actually containing these variables as normal globals that can't be rewritten to a member of the argument struct.
More specifically, in the test TestCPPThis, the expression `expr --j false -- s_a` is now only passing if we have a runnable target.
I'll revert the patch as the possible fixes aren't trivial and it degrades the debugging experience more than the issue that the revert patch addressed.
The underlying bug can be reproduced before/after this patch by stopping in `TestCPPThis` main function and running: `e -j false -- my_a; A<int>::s_a`. The `my_a` will pull in the `A<int>` class and the second expression will be resolved by Clang on its own (which causes LLDB to not materialize the static variable).
Note: A workaround is to just do `::s_a` which will force LLDB to take the global variable lookup.
show more ...
|
|
Revision tags: llvmorg-12.0.1-rc1 |
|
| #
00764c36 |
| 19-Apr-2021 |
Raphael Isemann <[email protected]> |
[lldb] Add support for evaluating expressions in static member functions
At the moment the expression parser doesn't support evaluating expressions in static member functions and just pretends the e
[lldb] Add support for evaluating expressions in static member functions
At the moment the expression parser doesn't support evaluating expressions in static member functions and just pretends the expression is evaluated within a non-member function. This causes that all static members are inaccessible when doing unqualified name lookup.
This patch adds support for evaluating in static member functions. It essentially just does the same setup as what LLDB is already doing for non-static member functions (i.e., wrapping the expression in a fake member function) with the difference that we now mark the wrapping function as static (to prevent access to non-static members).
Reviewed By: shafik, jarin
Differential Revision: https://reviews.llvm.org/D81550
show more ...
|
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3 |
|
| #
38dfb235 |
| 24-Feb-2021 |
Jonas Devlieghere <[email protected]> |
[lldb] Support debugging utility functions
LLDB uses utility functions to run code in the inferior for its own internal purposes, such as reading classes from the Objective-C runtime for example. Be
[lldb] Support debugging utility functions
LLDB uses utility functions to run code in the inferior for its own internal purposes, such as reading classes from the Objective-C runtime for example. Because these expressions should be transparent to the user, we ignore breakpoints and unwind the stack on errors, which makes them hard to debug.
This patch adds a new setting target.debug-utility-expression that, when enabled, changes these options to facilitate debugging. It enables breakpoints, disables unwinding and writes out the utility function source code to disk so it shows up in the source view.
Differential revision: https://reviews.llvm.org/D97249
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2 |
|
| #
2b37c5b5 |
| 01-Jun-2020 |
Raphael Isemann <[email protected]> |
[lldb][NFC] Make ClangExpressionSourceCode's wrapping logic more consistent
Summary: ClangExpressionSourceCode has different ways to wrap the user expression based on which context the expression is
[lldb][NFC] Make ClangExpressionSourceCode's wrapping logic more consistent
Summary: ClangExpressionSourceCode has different ways to wrap the user expression based on which context the expression is executed in. For example, if we're in a C++ member function we put the expression inside a fake member function of a fake class to make the evaluation possible. Similar things are done for Objective-C instance/static methods. There is also a default wrapping where we put the expression in a normal function just to make it possible to execute it.
The way we currently define which kind of wrapping the expression needs is based on the `wrapping_language` we keep passing to the ClangExpressionSourceCode instance. We repurposed the language type enum for that variable to distinguish the cases above with the following mapping: * language = C_plus_plus -> member function wrapping * language = ObjC -> instance/static method wrapping (`is_static` distinguished between those two). * language = C -> normal function wrapping * all other cases like C_plus_plus11, Haskell etc. make our class a no-op that does mostly nothing.
That mapping is currently not documented and just confusing as the `language` is unrelated to the expression language (and in the ClangUserExpression we even pretend that it *is* the actual language, but luckily never used it for anything). Some of the code in ClangExpressionSourceCode is also obviously thinking that this is the actual language of the expression as it checks for non-existent cases such as `ObjC_plus_plus` which is not part of the mapping.
This patch makes a new enum to describe the four cases above (with instance/static Objective-C methods now being their own case). It also make that enum just a member of ClangExpressionSourceCode instead of having to pass the same value to the class repeatedly. This gets also rid of all the switch-case-checks for 'unknown' language such as C_plus_plus11 as this is no longer necessary.
Reviewers: labath, JDevlieghere
Reviewed By: labath
Subscribers: abidh
Differential Revision: https://reviews.llvm.org/D80793
show more ...
|
|
Revision tags: llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3 |
|
| #
cdc514e4 |
| 17-Feb-2020 |
Jonas Devlieghere <[email protected]> |
[lldb] Update header guards to be consistent and compliant with LLVM (NFC)
LLDB has a few different styles of header guards and they're not very consistent because things get moved around or copy/pa
[lldb] Update header guards to be consistent and compliant with LLVM (NFC)
LLDB has a few different styles of header guards and they're not very consistent because things get moved around or copy/pasted. This patch unifies the header guards across LLDB and converts everything to match LLVM's style.
Differential revision: https://reviews.llvm.org/D74743
show more ...
|
|
Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1 |
|
| #
bd2a910a |
| 24-Sep-2019 |
Raphael Isemann <[email protected]> |
Ignore generated @import statements in the expression evaluator
Summary: The ClangModulesDeclVendor is currently interpreting all injected `@import` statements in our expression wrapper as modules t
Ignore generated @import statements in the expression evaluator
Summary: The ClangModulesDeclVendor is currently interpreting all injected `@import` statements in our expression wrapper as modules that the user has explicitly requested to be persistently loaded. As we inject `@import` statements with our std module prototype, the ClangModulesDeclVendor will start compiling and loading unrelated C++ modules because it thinks the user has requested that it should load them. As the ClangModulesDeclVendor is lacking the setup to compile these modules (e.g. it lacks the include paths), it will then actually just fail to compile them and cause the whole expression evaluation to fail. This causes these tests to fail on systems that enable the ClangModulesDeclVendor (such as macOS).
This patch fixes this by preventing the ClangModulesDeclVendor from interpreting `@import` statements in the wrapper source code. This is done by check if the import happens in the fake source file containing our wrapper code (which implies it was generated by LLDB).
This patch doesn't reenable the tests as there is more work needed to get the tests running on macOS (D67760)
Reviewers: aprantl, shafik, jingham
Subscribers: lldb-commits
Tags: #c_modules_in_lldb, #lldb
Differential Revision: https://reviews.llvm.org/D61565
llvm-svn: 372690
show more ...
|
| #
1442efea |
| 18-Sep-2019 |
Raphael Isemann <[email protected]> |
[lldb] Print better diagnostics for user expressions and modules
Summary: Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions.
[lldb] Print better diagnostics for user expressions and modules
Summary: Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions.
For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong: ``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: invalid operands to binary expression ('int' and 'double') ```
This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this:
``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float') printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) ~~~~~~^~~~ ```
To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to our internal wrapper code we inject.
Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function) will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible. We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message without any context (and the original diagnostic in the user expression should be enough to explain the issue).
Fixes rdar://24306342
Reviewers: JDevlieghere, aprantl, shafik, #lldb
Reviewed By: JDevlieghere, #lldb
Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D65646
llvm-svn: 372203
show more ...
|
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2 |
|
| #
4c7b28d6 |
| 06-Aug-2019 |
Raphael Isemann <[email protected]> |
[lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode
llvm-svn: 368082
|
| #
08f81513 |
| 05-Aug-2019 |
Raphael Isemann <[email protected]> |
[lldb][NFC] Remove unimplemented ClangExpressionSourceCode::GetNumBodyLines
llvm-svn: 367830
|
|
Revision tags: llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1 |
|
| #
71569d0d |
| 02-May-2019 |
Raphael Isemann <[email protected]> |
Inject only relevant local variables in the expression evaluation context
Summary: In r259902, LLDB started injecting all the locals in every expression evaluation. This fixed a bunch of issues, but
Inject only relevant local variables in the expression evaluation context
Summary: In r259902, LLDB started injecting all the locals in every expression evaluation. This fixed a bunch of issues, but also caused others, mostly performance regressions on some codebases. The regressions were bad enough that we added a setting in r274783 to control the behavior and we have been shipping with the setting off to avoid the perf regressions.
This patch changes the logic injecting the local variables to only inject the ones present in the expression typed by the user. The approach is fairly simple and just scans the typed expression for every local name. Hopefully this gives us the best of both world as it just realizes the types of the variables really used by the expression.
Landing this requires the 2 other issues I pointed out today to be addressed but I wanted to gather comments right away.
Original patch by Frédéric Riss!
Reviewers: jingham, clayborg, friss, shafik
Reviewed By: jingham, clayborg
Subscribers: teemperor, labath, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D46551
llvm-svn: 359773
show more ...
|
|
Revision tags: llvmorg-8.0.0 |
|
| #
6c0bbfc0 |
| 12-Mar-2019 |
Raphael Isemann <[email protected]> |
Add ability to import std module into expression parser to improve C++ debugging
Summary: This patch is the MVP version of importing the std module into the expression parser to improve C++ debuggin
Add ability to import std module into expression parser to improve C++ debugging
Summary: This patch is the MVP version of importing the std module into the expression parser to improve C++ debugging.
What happens in this patch is that we inject a `@import std` into our expression source code. We also modify our internal Clang instance for parsing this expression to work with modules and debug info at the same time (which is the main change in terms of LOC). We implicitly build the `std` module on the first use. The C++ include paths for building are extracted from the debug info, which means that this currently only works if the program is compiled with `-glldb -fmodules` and uses the std module. The C include paths are currently specified by LLDB.
I enabled the tests currently only for libc++ and Linux because I could test this locally. I'll enable the tests for other platforms once this has landed and doesn't break any bots (and I implemented the platform-specific C include paths for them).
With this patch we can now: * Build a libc++ as a module and import it into the expression parser. * Read from the module while also referencing declarations from the debug info. E.g. `std::abs(local_variable)`.
What doesn't work (yet): * Merging debug info and C++ module declarations. E.g. `std::vector<CustomClass>` doesn't work. * Pretty much anything that involves the ASTImporter and templated code. As the ASTImporter is used for saving the result declaration, this means that we can't call yet any function that returns a non-trivial type. * Use libstdc++ for this, as it requires multiple include paths and Clang only emits one include path per module. Also libstdc++ doesn't support Clang modules without patches.
Reviewers: aprantl, jingham, shafik, friss, davide, serge-sans-paille
Reviewed By: aprantl
Subscribers: labath, mgorny, abidh, jdoerfert, lldb-commits
Tags: #c_modules_in_lldb, #lldb
Differential Revision: https://reviews.llvm.org/D58125
llvm-svn: 355939
show more ...
|
|
Revision tags: llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4 |
|
| #
ea401ec7 |
| 06-Mar-2019 |
Jim Ingham <[email protected]> |
Factor the clang specific parts of ExpressionSourceCode.{h,cpp} into the clang plugin.
NFC
Differential Revision: https://reviews.llvm.org/D59040
llvm-svn: 355560
|