summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/expression_command
Commit message (Collapse)AuthorAgeFilesLines
* typedef enum -> enumFangrui Song2019-05-141-2/+2
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* Fixed some minor style issues in rLLDB359921 [NFC]Raphael Isemann2019-05-031-6/+6
| | | | | | | | Ran clang-format on the added test file and use the new StringRef comparison over the temporary ConstStrings. Also aligned the end of one of the code string literals. llvm-svn: 359931
* Fix for ambiguous lookup in expressions between local variable and namespaceShafik Yaghmour2019-05-037-0/+117
| | | | | | | | | Summary: In an Objective-C context a local variable and namespace can cause an ambiguous name lookup when used in an expression. The solution involves mimicking the existing C++ solution which is to add local using declarations for local variables. This causes a different type of lookup to be used which eliminates the namespace during acceptable results filtering. Differential Revision: https://reviews.llvm.org/D59960 llvm-svn: 359921
* Disable TestArgumentPassingRestrictions for clang < 7Jonas Devlieghere2019-05-021-1/+2
| | | | | | http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/ llvm-svn: 359812
* [test] TestSharedPtr -> TestSharedPtrDbgInfoContentJonas Devlieghere2019-05-021-1/+1
| | | | | | | | | | Two tests cannot share the same name, because they will generate an identical trace file. When that happens, this can lead to a race condition where dotest fails when trying to move both files into the trace directory, because the file has already been moved. Additionally, the trace will have been overwritten by the test that finishes last. llvm-svn: 359807
* Add std::stack and std::queue support to CxxModuleHandlerRaphael Isemann2019-05-026-0/+139
| | | | | | | | | | | | | | Reviewers: aprantl, shafik Reviewed By: aprantl, shafik Subscribers: lldb-commits Tags: #c_modules_in_lldb, #lldb Differential Revision: https://reviews.llvm.org/D61305 llvm-svn: 359779
* Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference ↵Shafik Yaghmour2019-05-013-0/+56
| | | | | | | | | | | | | when loading from DWARF Summary: This will fix a bug where during expression parsing we are not setting a CXXRecordDecl to not be passed in registers and the resulting code generation is wrong. The DWARF attribute DW_CC_pass_by_reference tells us that we should not be passing in registers i.e. RAA_Indirect. This change depends this clang change which fixes the fact that the ASTImporter does not copy RecordDeclBits for CXXRecordDecl: https://reviews.llvm.org/D61140 Differential Revision: https://reviews.llvm.org/D61146 llvm-svn: 359732
* Instantiate 'std' templates explicitly in the expression evaluatorRaphael Isemann2019-04-3048-0/+800
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is a follow-up for D58125. It implements the manual instantiation and merging of 'std' templates like `std::vector` and `std::shared_ptr` with information from the debug info AST. This (finally) allows using these classes in the expression evaluator like every other class (i.e. things like `vec.size()` and shared_ptr debugging now works, yay!). The main logic is the `CxxModuleHandler` which intercept the ASTImporter import process and replaces any `std` decls by decls from the C++ module. The decls from the C++ module are "imported" by just deserializing them directly in the expression evaluation context. This is mostly because we don't want to rely on the ASTImporter to correctly import these declarations, but in the future we should also move to the ASTImporter for that. This patch doesn't contain the automatic desugaring for result variables. This means that if you call for example `size` of `std::vector` you maybe get some very verbose typedef'd type as the variable type, e.g. `std::vector<int, std::allocator<int>>::value_type`. This is not only unreadable, it also means that our ASTImporter has to import all these types and associated decls into the persisent variable context. This currently usually leads to some assertion getting triggered in Clang when the ASTImporter either makes a mistake during importing or our debug info AST is inconsitent. The current workaround I use in the tests is to just cast the result to it's actual type (e.g. `size_t` or `int`) to prevent the ASTImporter from having to handle all these complicated decls. The automatic desugaring will be a future patch because I'm not happy yet with the current code for that and because I anticipate that this will be a controversial patch. Reviewers: aprantl, shafik, jingham, martong, serge-sans-paille Reviewed By: martong Subscribers: balazske, rnkovacs, mgorny, mgrang, abidh, jdoerfert, lldb-commits Tags: #c_modules_in_lldb, #lldb Differential Revision: https://reviews.llvm.org/D59537 llvm-svn: 359538
* Two tests were using the interactive convenience variableJason Molenda2019-04-251-1/+1
| | | | | | | lldb.debugger. They should not be. <rdar://problem/50210340> llvm-svn: 359234
* [ASTImporter] Regression test to ensure that we handling importing of ↵Shafik Yaghmour2019-04-153-0/+36
| | | | | | | | | | | | | anonymous enums correctly Summary: https://reviews.llvm.org/D51633 added error handling in the ASTImporter.cpp which uncovered an underlying bug in which we used the wrong name when handling naming conflicts. This could cause a segmentation fault when attempting to cast an int to an enum during expression parsing. This test should pass once https://reviews.llvm.org/D59665 is committed. Differential Revision: https://reviews.llvm.org/D59667 llvm-svn: 358462
* Fix for regression test, since we rely on the formatter for std::vector in ↵Shafik Yaghmour2019-03-281-0/+1
| | | | | | | | the test we need a libc++ category. See differential https://reviews.llvm.org/D59847 for initial change that this fixes llvm-svn: 357210
* Regression test to ensure that we handling importing of std::vector of enums ↵Shafik Yaghmour2019-03-283-0/+47
| | | | | | | | | | | correctly Summary: https://reviews.llvm.org/D59845 added a fix for the IsStructuralMatch(...) specialization for EnumDecl this test should pass once this fix is committed. Differential Revision: https://reviews.llvm.org/D59847 llvm-svn: 357188
* Rename some variables in the std-module testsPavel Labath2019-03-272-2/+2
| | | | | | | They cause failures on some systems due to an unrelated bug (pr35043). This works around that. llvm-svn: 357080
* Add ability to import std module into expression parser to improve C++ debuggingRaphael Isemann2019-03-1215-0/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Correctly look up declarations in inline namespacesRaphael Isemann2019-03-123-0/+41
| | | | | | | | | | | | | | | | | | Summary: This patch marks the inline namespaces from DWARF as inline and also ensures that looking up declarations now follows the lookup rules for inline namespaces. Reviewers: aprantl, shafik, serge-sans-paille Reviewed By: aprantl Subscribers: eraman, jdoerfert, lldb-commits Tags: #c_modules_in_lldb, #lldb Differential Revision: https://reviews.llvm.org/D59198 llvm-svn: 355897
* [lldb] [test] Mark more tests flakey on NetBSDMichal Gorny2019-03-111-0/+1
| | | | llvm-svn: 355838
* [lldb] [test] Mark a few tests flakey on NetBSDMichal Gorny2019-03-111-0/+1
| | | | llvm-svn: 355830
* Adding test to cover the correct import of SourceLocation pertaining to a ↵Shafik Yaghmour2019-03-063-0/+39
| | | | | | | | | | | | built-in during expression parsing Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import built-in correctly, see differential: https://reviews.llvm.org/D58743 Once this change is merged this test should pass and should catch regressions in this feature. Differential Revision: https://reviews.llvm.org/D58790 llvm-svn: 355525
* [lldb] [test] Mark failing tests XFAIL on NetBSDMichal Gorny2019-03-048-0/+8
| | | | | | | | | | | | | | | | Add a convenience 'expectedFailureNetBSD' decorator and mark all tests currently failing on NetBSD with it. Also skip a few tests that hang the test suite. This should establish a baseline for the test suite and get us closer to enabling tests on buildbot. This will help us catch regressions while we still have a lot of work to do to get tests working. It seems that there are also some flaky tests. I am going to address them later on. Differential Revision: https://reviews.llvm.org/D58527 llvm-svn: 355320
* [Expressions] Add support of expressions evaluation in some object's contextAleksandr Urakov2019-02-056-0/+327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix handling of CreateTemplateParameterList when there is an empty packShafik Yaghmour2019-01-303-0/+37
| | | | | | | | | Summary: When we are creating a ClassTemplateSpecializationDecl in ParseTypeFromDWARF(...) we are not handling the case where variadic pack is empty in the specialization. This patch handles that case and adds a test to prevent future regressions. Differential Revision: https://reviews.llvm.org/D57363 llvm-svn: 352677
* Rename test directoryAdrian Prantl2019-01-243-0/+0
| | | | llvm-svn: 352073
* Add decorator support for the DWARF version produced by the compilerAdrian Prantl2019-01-241-0/+1
| | | | | | | and mark up some tests failing in http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/ llvm-svn: 352072
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-197-28/+21
| | | | | | | | | | | | | | | | | 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
* Don't run TestBreakpointThumbCodesection.py on darwin systems;Jason Molenda2019-01-171-1/+3
| | | | | | | | | we don't use a thumb code section. Don't run Test128BitsInteger.py on armv7k; it's not a supported type on that target. llvm-svn: 351490
* [test] Remove flakiness decorator from TestObjCDynamicSBTypeJonas Devlieghere2018-12-301-2/+0
| | | | | | The quoted bug report (llvm.org/PR20270) was closed in 2014. llvm-svn: 350160
* [lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)Stella Stamenova2018-12-202-5/+1
| | | | | | This is a set of tests that were all marked as failing becuse of several different bugs. A couple of the bugs are now resolved as fixed since all the tests that were failing associated with the bug are now passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green. llvm-svn: 349713
* [lldbsuite] Un-xfail tests on Windows that are now passing (pt.2)Stella Stamenova2018-12-198-15/+1
| | | | | | This is a set of tests that were all marked as failing becuse of pr21765. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green. llvm-svn: 349668
* [lldbsuite] Un-xfail tests on Windows that are now passingStella Stamenova2018-12-195-16/+1
| | | | | | This is a set of tests that were all marked as failing becuse of pr24489. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green. llvm-svn: 349665
* [Expr] Fix `TestExprOptions` after r348240 on MacOS XAleksandr Urakov2018-12-041-0/+15
| | | | | | | | | | Summary: r348240 assumes that an expression contains the Objective C option if Objective C Runtime is found. But on MacOS X it seems that the test application process always contains Objective C Runtime, so the test fails when it assumes that the language is C++ only. Skip this part on Darwin. llvm-svn: 348250
* [Expr] Check the language before ignoring Objective C keywordsAleksandr Urakov2018-12-042-1/+16
| | | | | | | | | | | | | | | | | | Summary: This patch adds the check of the language before ignoring names like `id` or `Class`, which are reserved in Objective C, but are allowed in C++. It is needed to make it possible to evaluate expressions in a C++ program containing names like `id` or `Class`. Reviewers: jingham, zturner, labath, clayborg Reviewed By: jingham, clayborg Tags: #lldb Differential Revision: https://reviews.llvm.org/D54843 llvm-svn: 348240
* [lldbsuite] Each lldb suite test must have a unique class nameStella Stamenova2018-11-271-1/+1
| | | | | | A couple of new tests have been added that use existing class names. This causes failures on Windows if the tests run at the same time and on any platform it results in the logs being overwritten. llvm-svn: 347717
* Remove the expectedFlakeyDsym decorator. It's not useful anymore.Adrian Prantl2018-11-141-1/+0
| | | | llvm-svn: 346906
* Remove header grouping comments.Jonas Devlieghere2018-11-111-1/+1
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove ↵Shafik Yaghmour2018-11-083-0/+66
| | | | | | | | | | redundant parameter which can be calculated from other parameter. rdar://problem/43822994 Differential Revision: https://reviews.llvm.org/D54003 llvm-svn: 346428
* Fix duplicate testcase filenameJan Kratochvil2018-11-041-0/+0
| | | | | | | | | dotest.py started reporting: Exception: Found multiple tests with the name TestSampleTest.py After the commit of: https://reviews.llvm.org/D54056 llvm-svn: 346089
* Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit.Jim Ingham2018-11-023-0/+115
| | | | | | | | <rdar://problem/44809176> Differential Revision: https://reviews.llvm.org/D54056 llvm-svn: 346053
* Revert "Return a named error in the result object of an expression with no ↵Krasimir Georgiev2018-10-183-60/+0
| | | | | | | | | | | | | | | | | result" This reverts commit r344647. This causes build failures with [-Werror, -Wswitch]. Some cases where the newly introduced enum value is not handled in particular are in: lldb/source/Expression/REPL.cpp:350 lldb/source/Interpreter/CommandInterpreter.cpp:1529 (maybe there could be more) As I don't understand lldb to make sure the likely trivial fixes are correct and also as they might need additional tests, leaving to the author to resolve. llvm-svn: 344722
* Return a named error in the result object of an expression with no resultJim Ingham2018-10-163-0/+60
| | | | | | | | | | | | Before we returned an error that was not exposed in the SB API and no useful error message. This change returns eExpressionProducedNoResult and an appropriate error string. <rdar://problem/44539514> Differential Revision: https://reviews.llvm.org/D53309 llvm-svn: 344647
* [lldbsuite] Disable Test128BitsInteger on WindowsStella Stamenova2018-10-151-1/+4
| | | | | | | | | | | | | | Summary: This test is failing on Windows because lldb does not support JIT on Windows. Reviewers: davide, asmith Reviewed By: davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D53226 llvm-svn: 344543
* TestMultilineExpr: validate evaluation for expressions that span multiple linesStefan Granitz2018-10-053-101/+0
| | | | | | | | | | | | | | Summary: When LLDB successfully parses a command (like "expression" in this case) and determines incomplete input, the user can continue typing on multiple lines (in this case "2+3"). This should provide the correct result. Note that LLDB reverts input from the additional lines, so they are not present in the output. Reviewers: vsk, davide, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52270 llvm-svn: 343860
* Allow use of self.filecheck in LLDB tests (c.f self.expect)Vedant Kumar2018-09-181-65/+53
| | | | | | | | | | | | | Add a "filecheck" method to the LLDB test base. This allows test authors to pattern match command output using FileCheck, making it possible to write stricter tests than what `self.expect` allows. For context (motivation, examples of stricter checking, etc), see the lldb-dev thread: "Using FileCheck in lldb inline tests". Differential Revision: https://reviews.llvm.org/D50751 llvm-svn: 342508
* Add descriptions to completed expressionsRaphael Isemann2018-09-171-0/+33
| | | | | | | | | | | | | | | | | Summary: Completing inside the expression command now uses the new description API to also provide additional information to the user. For now this information are the types of variables/fields and the signatures of completed function calls. Reviewers: #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D52103 llvm-svn: 342385
* [IRInterpreter] Fall back to JIT with 128-bit values.Davide Italiano2018-09-143-0/+15
| | | | | | | | | | | | | They're not that common, and falling back is definitely better than throwing an error instead of the result. If we feel motivated, we might end up implementing support for these, but it's unclear whether it's worth the effort/complexity. Fixes PR38925. <rdar://problem/44436068> llvm-svn: 342262
* Added initial code completion support for the `expr` commandRaphael Isemann2018-08-305-0/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds initial code completion support for the `expr` command. We now have a completion handler in the expression CommandObject that essentially just attempts to parse the given user expression with Clang with an attached code completion consumer. We filter and prepare the code completions provided by Clang and send them back to the completion API. The current completion is limited to variables that are in the current scope. This includes local variables and all types used by local variables. We however don't do any completion of symbols that are not used in the local scope (or in some other way already in the ASTContext). This is partly because there is not yet any code that manually searches for additiona information in the debug information. Another cause is that for some reason the existing code for loading these additional symbols when requested by Clang doesn't seem to work. This will be fixed in a future patch. Reviewers: jingham, teemperor Reviewed By: teemperor Subscribers: labath, aprantl, JDevlieghere, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48465 llvm-svn: 341086
* Fix broken builtin functions in the expression commandRaphael Isemann2018-08-231-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Calling any non-libc builtin function in the expression command currently just causes Clang to state that the function is not known. The reason for this is that we actually never initialize the list of builtin functions in the Builtin::Context. This patch just calls the initializer for the builtins in the preprocessor. Also adds some tests for the new builtins. It also gets rid of the extra list of builtins in the ClangExpressionParser, as we can just reuse the existing list in the Preprocessor for the ASTContext. Having just one list of builtins around is also closer to the standard Clang behavior. Reviewers: #lldb, vsk Reviewed By: vsk Subscribers: sgraenitz, clayborg, vsk, lldb-commits Differential Revision: https://reviews.llvm.org/D50481 llvm-svn: 340571
* Fix whitespace in the python test suite.Raphael Isemann2018-07-2710-12/+12
| | | | | | | | | | | | | Summary: The test suite has often unnecessary trailing whitespace, and sometimes unnecessary trailing lines or a missing final new line. This patch just strips trailing whitespace/lines and adds missing newlines at the end. Subscribers: ki.stfu, JDevlieghere, christof, lldb-commits Differential Revision: https://reviews.llvm.org/D49943 llvm-svn: 338171
* [IRInterpreter] Fix misevaluation of interpretation expressions with `urem`.Davide Italiano2018-07-123-0/+26
| | | | | | | | | | | | | | | | Scalar::MakeUnsigned was implemented incorrectly so it didn't really change the sign of the type (leaving signed types signed). This showed up as a misevaluation when IR-interpreting urem but it's likely to arise in other contexts. This commit fixes the definition, and adds a test to make sure this won't regress in future (hopefully). Fixes rdar://problem/42038760 and LLVM PR38076 Differential Revision: https://reviews.llvm.org/D49155 llvm-svn: 336872
* Don't take the address of an xvalue when printing an expr resultRaphael Isemann2018-07-093-0/+54
| | | | | | | | | | | | | | | | | | | | Summary: If we have an xvalue here, we will always hit the `err_typecheck_invalid_lvalue_addrof` error in 'Sema::CheckAddressOfOperand' when trying to take the address of the result. This patch uses the fallback code path where we store the result in a local variable instead when we hit this case. Fixes rdar://problem/40613277 Reviewers: jingham, vsk Reviewed By: vsk Subscribers: vsk, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48303 llvm-svn: 336582
* IRInterpreter: fix sign extension of small types (pr37840)Pavel Labath2018-06-201-0/+8
| | | | | | | | | | | | | Sign-extension of small types (e.g. short) was not handled correctly. The reason for that was that when we were assigning the a value to the Scalar object, we would accidentally promote the type to int (even though the assignment code in AssignTypeToMatch tried to cast the value to the appropriate type, it would still invoke the "int" version of operator=). Instead, I use the APInt version of operator=, where the bitwidth is specified explicitly. Among other things, this allows us to fold the individual size cases into one. llvm-svn: 335114
OpenPOWER on IntegriCloud