summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add expect_expr function for testing expression evaluation in dotests.Raphael Isemann2020-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a new function to lldbtest: `expect_expr`. This function is supposed to replace the current approach of calling `expect`/`runCmd` with `expr`, `p` etc. `expect_expr` allows evaluating expressions and matching their value/summary/type/error message without having to do any string matching that might allow unintended passes (e.g., `self.expect("expr 3+4", substrs=["7"])` can unexpectedly pass for results like `(Class7) $0 = 7`, `(int) $7 = 22`, `(int) $0 = 77` and so on). This only uses the function in a few places to test and demonstrate it. I'll migrate the tests in follow up commits. Reviewers: JDevlieghere, shafik, labath Reviewed By: labath Subscribers: christof, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70314
* [lldb/test] Add test for CMTime data formatterJonas Devlieghere2020-01-143-0/+67
| | | | | Add a test for the CMTime data formatter. The coverage report showed that this code path was untested.
* [lldb][tests] Cleanup '.categories'Tatyana Krasnukha2020-01-101-1/+1
|
* Data formatters: Look through array element typedefsJaroslav Sevcik2020-01-103-0/+25
| | | | | | | | | | | | | | | | | 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
* Add prototype for a function we call.Jason Molenda2019-12-181-0/+2
|
* LanguageRuntime: Simplify NSException::GetSummary() outputMed Ismail Bennani2019-12-132-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Right now, NSException::GetSummary() has the following output: "name: $exception_name - reason: $exception_reason" It would be better to simplify the output by removing the name and only showing the exception's reason. This way, annotations would look nicer in the editor, and would be a shorter summary in the Variables Inspector. Accessing the exception's name can still be done by expanding the NSException object in the Variables Inspector. rdar://54770115 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com> Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71311 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb][NFC] Remove all `setUp` overrides that only call the parent ↵Raphael Isemann2019-12-132-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | implementation Summary: A lot of our tests copied the setUp code from our TestSampleTest.py: ``` def setUp(self): # Call super's setUp(). TestBase.setUp(self) ``` This code does nothing unless we actually do any setUp work in there, so let's remove all these method definitions. Reviewers: labath, JDevlieghere Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71454
* [lldb][NFC] Remove 'from __future__ import print_function' from all tests ↵Raphael Isemann2019-12-1379-83/+0
| | | | | | | | | | | | | | | | | | | | | that don't actually call 'print()' Summary: A lot of tests do this trick but the vast majority of them don't even call `print()`. Most of this patch was generated by a script that just looks at all the files and deletes the line if there is no `print (` or `print(` anywhere else in the file. I checked the remaining tests manually and deleted the import if we never call print (but instead do stuff like `expr print(...)` and similar false-positives). I also corrected the additional empty lines after the import in the files that I manually edited. Reviewers: JDevlieghere, labath, jfb Reviewed By: labath Subscribers: dexonsmith, wuzish, nemanjai, kbarton, christof, arphaman, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71452
* Do not cache hardcoded formats in FormatManagerAdrian Prantl2019-12-104-0/+45
| | | | | | | | | | | | | | The cache in FormatCache uses only a type name as key. The hardcoded formats, synthetic children, etc inspect an entire ValueObject to determine their eligibility, which isn't modelled in the cache. This leads to bugs such as the one in this patch (where two similarly named types in different files have different hardcoded summary providers). The problem is exaggerated in the Swift language plugin due to the language's dynamic nature. rdar://problem/57756763 Differential Revision: https://reviews.llvm.org/D71233
* [lldb][DataFormatters] Support pretty printing std::string when built with ↵Jordan Rupprecht2019-11-224-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -funsigned-char. Summary: When built w/ `-funsigned-char`, `std::string` becomes equivalent to `std::basic_string<unsigned char>`, causing these formatters to not match. This patch adds overloads for both libstdc++ and libc++ string formatters that accepts unsigned char. Motivated by the following example: ``` $ cat pretty_print.cc template <typename T> void print_val(T s) { std::cerr << s << '\n'; // Set a breakpoint here! } int main() { std::string val = "hello"; print_val(val); return 0; } $ clang++ -stdlib=libc++ -funsigned-char -fstandalone-debug -g pretty_print.cc $ lldb ./a.out -b -o 'b pretty_print.cc:6' -o r -o 'fr v' ... (lldb) fr v (std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >) s = { __r_ = { std::__1::__compressed_pair_elem<std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::__rep, 0, false> = { __value_ = { = { __l = (__cap_ = 122511465736202, __size_ = 0, __data_ = 0x0000000000000000) __s = { = (__size_ = '\n', __lx = '\n') __data_ = { [0] = 'h' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' [5] = '\0' ... ``` Reviewers: labath, JDevlieghere, shafik Subscribers: christof, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70517
* [LLDB][Formatters] Re-enable std::function formatter with fixes to improve ↵shafik2019-11-121-9/+9
| | | | | | | | | non-cached lookup performance Performance issues lead to the libc++ std::function formatter to be disabled. We addressed some of those performance issues by adding caching see D67111 This PR fixes the first lookup performance by not using FindSymbolsMatchingRegExAndType(...) and instead finding the compilation unit the std::function wrapped callable should be in and then searching for the callable directly in the CU. Differential Revision: https://reviews.llvm.org/D69913
* [LLDB] Adding caching to libc++ std::function formatter for lookups that ↵shafik2019-11-062-13/+49
| | | | | | | | | | require scanning symbols Performance issues lead to the libc++ std::function formatter to be disabled. This change is the first of two changes that should address the performance issues and allow us to enable the formatter again. In some cases we end up scanning the symbol table for the callable wrapped by std::function for those cases we will now cache the results and used the cache in subsequent look-ups. This still leaves a large cost for the initial lookup which will be addressed in the next change. Differential Revision: https://reviews.llvm.org/D67111
* Add arm64_32 support to lldb, an ILP32 codegen Jason Molenda2019-10-161-1/+1
| | | | | | | | | | that runs on arm64 ISA targets, specifically Apple watches. Differential Revision: https://reviews.llvm.org/D68858 llvm-svn: 375032
* Disable the empty string check in TestDataFormatterStdStringPavel Labath2019-09-271-1/+2
| | | | | | | This check was failing since it was added in r372837. It should be possible to re-enable it once D68010 lands. llvm-svn: 373071
* [lldb] Test data formatters for empty stringsRaphael Isemann2019-09-254-1/+18
| | | | llvm-svn: 372837
* Canonicalize variable usage in testsuite MakefilesAdrian Prantl2019-09-2534-60/+80
| | | | | | | | | | | | This test streamlines our use of variables that are expected by Makefile.rules throughout the test suite. Mostly it replaced potentially dangerous overrides and updates of variables like CFLAGS with safe assignments to variables reserved for this purpose like CFLAGS_EXTRAS. Differential Revision: https://reviews.llvm.org/D67984 llvm-svn: 372795
* [lldb] Fix that importing decls in a TagDecl end up in wrong declaration ↵Raphael Isemann2019-09-231-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | context (partly reverts D61333) Summary: In D61333 we dropped some code from ClangASTSource that checks if imported declarations ended up in the right DeclContext. While this code wasn't tested by the test suite (or better, it was hit by the test suite but we didn't have any checks that were affected) and the code seems pointless (as usually Decls should end up in the right DeclContext), it actually broke the data formatters in LLDB and causes a bunch of obscure bugs where structs suddenly miss all their members. The first report we got about this was that printing a std::map doesn't work anymore when simply doing "expr m" (m is the std::map). This patch reverts D61333 partly and reintroduces the check in a more stricter way (we actually check now that we *move* the Decl and it is in a single DeclContext). This should fix all the problems we currently have until we figure out how to properly fix the underlying issues. I changed the order of some std::map formatter tests which is currently the most reliable way to test this problem (it's a tricky setup, see description below). Fixes rdar://55502701 and rdar://55129537 -------------------------------------- Some more explanation what is actually going on and what is going wrong: The situation we have is that if we have a `std::map m` and do a `expr m`, we end up seeing an empty map (even if `m` has elements). The reason for this is that our data formatter sees that std::pair<int, int> has no members. However, `frame var m` works just fine (and fixes all following `expr m` calls). The reason for why `expr` breaks std::map is that we actually copy the std::map nodes in two steps in the three ASTContexts that are involved: The debug information ASTContext (D-AST), the expression ASTContext we created for the current expression (E-AST) and the persistent ASTContext we use for our $variables (P-AST). When doing `expr m` we do a minimal import of `std::map` from D-AST to E-AST just do the type checking/codegen. This copies std::map itself and does a minimal.import of `std::pair<int, int>` (that is, we don't actually import the `first` and `second` members as we don't need them for anything). After the expression is done, we take the expression result and copy it from E-AST to P-AST. This imports the E-AST's `std::pair` into P-AST which still has no `first` and `second` as they are still undeserialized. Once we are in P-AST, the data formatter tries to inspect `std::map` (and also `std::pair` as that's what the elements are) and it asks for the `std::pair` members. We see that `std::pair` has undeserialized members and go to the ExternalASTSource to ask for them. However, P-ASTs ExternalASTSource points to D-AST (and not E-AST, which `std::pair` came from). It can't point to E-AST as that is only temporary and already gone (and also doesn't actually contain all decls we have in P-AST). So we go to D-AST to get the `std::pair` members. The ASTImporter is asked to copy over `std::pair` members and first checks if `std::pair` is already in P-AST. However, it only finds the std::pair we got from E-AST, so it can't use it's map of already imported declarations and does a comparison between the `std::pair` decls we have Because the ASTImporter thinks they are different declarations, it creates a second `std::pair` and fills in the members `first` and `second` into the second `std::pair`. However, the data formatter is looking at the first `std::pair` which still has no members as they are in the other decl. Now we pretend we have no declarations and just print an empty map as a fallback. The hack we had before fixed this issue by moving `first` and `second` to the first declaration which makes the formatters happy as they can now see the members in the DeclContext they are querying. Obviously this is a temporary patch until we get a real fix but I'm not sure what's the best way to fix this. Implementing that the ClassTemplateSpecializationDecl actually understands that the two std::pair's are the same decl fixes the issue, but this doesn't fix the bug for all declarations. My preferred solution would be to complete all declarations in E-AST before they get moved to P-AST (as we anyway have to do this from what I can tell), but that might have unintended side-effects and not sure what's the best way to implement this. Reviewers: friss, martong Reviewed By: martong Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits, shafik Tags: #lldb Differential Revision: https://reviews.llvm.org/D67803 llvm-svn: 372549
* [lldb] Process formatters in reverse-chronological orderJan Kratochvil2019-09-201-0/+7
| | | | | | | | | | | | If one reverts D66398 then the TestDataFormatterStdList does fail - as the C++ formatters are initialized in the opposite order. But the current state of trunk does not mind the order for C++ formatters. It is using now a single std::vector as suggested by Pavel Labath. Differential Revision: https://reviews.llvm.org/D66654 llvm-svn: 372424
* [dotest] Delete trivial inline test makefilesPavel Labath2019-09-054-14/+0
| | | | | | inline tests are able to generate these automatically llvm-svn: 371015
* [dotest] Avoid the need for LEVEL= makefile boilerplatePavel Labath2019-09-0475-218/+75
| | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of each test case knowing its depth relative to the test root, we can just have dotest add the folder containing Makefile.rules to the include path. This was motivated by r370616, though I have been wanting to do this ever since we moved to building tests out-of-tree. The only manually modified files in this patch are lldbinline.py and plugins/builder_base.py. The rest of the patch has been produced by this shell command: find . \( -name Makefile -o -name '*.mk' \) -exec sed --in-place -e '/LEVEL *:\?=/d' -e '1,2{/^$/d}' -e 's,\$(LEVEL)/,,' {} + Reviewers: teemperor, aprantl, espindola, jfb Subscribers: emaste, javed.absar, arichardson, christof, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D67083 llvm-svn: 370845
* [Formatters] Temporarily disable libc++ std::function formatter due to ↵Shafik Yaghmour2019-08-021-0/+3
| | | | | | | | | | performance issue Summary: We have been seeing increased reports of performance issue around large project and formatting std::function variables especially in functions signatures in back traces. There are some possible fixes but exploring those fixes may take time and it is better to temporarily disable the formatter due to its impact and re-enable it once we have a fix. Differential Revision: https://reviews.llvm.org/D65666 llvm-svn: 367701
* [lldb][NFC] Remove unused imports in python testsRaphael Isemann2019-08-0267-148/+0
| | | | llvm-svn: 367663
* [DataFormatters] Adjusting libc++ std::list formatter to act better with ↵Shafik Yaghmour2019-04-242-1/+6
| | | | | | | | | | | | | pointers and references and adding a test to cover a previous related fix Summary: This previous fix https://github.com/llvm-mirror/lldb/commit/5469bda296c183d1b6bf74597c88c9ed667b3145 did not have a test since we did not have a reproducer. This is related to how formatters deal with pointers and references. The added tests both the new behavior and covers the previous bug fix as well. Differential Revision: https://reviews.llvm.org/D60588 llvm-svn: 359118
* [Test] Remove no_debug_info_test decorator from Obj-C data formatters.Jonas Devlieghere2019-04-0511-11/+0
| | | | | | As discussed in https://reviews.llvm.org/D60300. llvm-svn: 357813
* [testsuite] Split Objective-C data formatterJonas Devlieghere2019-04-0514-530/+584
| | | | | | | | | | | | | The testcase for objective-c data formatters is very big as it checks a bunch of stuff. This is annoying when using the lit test driver, because it prevents us from running the different cases in parallel. As a result, it's always one of the last few tests that complete. This patch splits the test into multiple files that share a common base class. This way lit can run the different tests in parallel. Differential revision: https://reviews.llvm.org/D60300 llvm-svn: 357786
* Fix a double-overrelease in the TestDataFormatterObjC test program.Adrian Prantl2019-03-141-4/+5
| | | | llvm-svn: 356160
* [Python] Fix TestDataFormatterSmartArray to work across python versions.Davide Italiano2019-03-131-4/+4
| | | | | | | | | | | Python 3 default encoding is utf-8, so taking random bytes and interpreting them as a string might result in invalid unicode sequences. As the only thing we care about here is that the formatter shows the elements of the underyling array, relax the string matching (this is good enough as all the elements are distinct so they resolve to different strings). llvm-svn: 356096
* [lldbsuite] Un-xfail TestPyObjSynthProvider on WindowsStella Stamenova2019-03-131-1/+0
| | | | | | One of Davide's changes yesterday fixed the behavior on Windows, so the test is now passing. llvm-svn: 356065
* Re-enable this test, the underlying bug was fixed and the test now passes.Jim Ingham2019-03-121-1/+0
| | | | llvm-svn: 355956
* [lldb] [test] Mark a few tests flakey on NetBSDMichal Gorny2019-03-111-0/+1
| | | | llvm-svn: 355830
* [lldb] [test] Mark failing tests XFAIL on NetBSDMichal Gorny2019-03-041-1/+2
| | | | | | | | | | | | | | | | 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
* Fix TestDataFormatterLibcxxListLoop.py testRaphael Isemann2019-02-161-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The compilation of the TestDataFormatterLibcxxListLoop.py currently fails with this error: ``` functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/main.cpp:19:24: error: no member named '__value_' in 'std::__1::__list_node_base<int, void *>' assert(third_elem->__value_ == 3); ~~~~~~~~~~ ^ ``` It seems the internal structure of list has changed with the 3.8 release. This patch makes the test compile with the current libc++ and with the previous libc++. Reviewers: shafik, zturner, labath Reviewed By: labath Subscribers: christof, jdoerfert, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D58273 llvm-svn: 354202
* [Test] Fix up tests affected by the new LLVM header.Jonas Devlieghere2019-01-221-3/+3
| | | | | | | | | The new LLVM header is one line shorter than the old one, which lead to some test failures. Ideally tests should rely on line numbers for breakpoints or output, but that's a different discussion. Hopefully this turns the bots green again. llvm-svn: 351779
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1938-152/+114
| | | | | | | | | | | | | | | | | 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
* [lldbsuite] Un-xfail TestDataFormatterSynthVal on WindowsStella Stamenova2018-12-201-3/+0
| | | | llvm-svn: 349721
* [lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)Stella Stamenova2018-12-202-6/+0
| | | | | | 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] 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 header grouping comments.Jonas Devlieghere2018-11-119-9/+9
| | | | | | | | 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
* [DataFormatters] Adding formatters for libc++ std::u16string and std::u32stringShafik Yaghmour2018-10-263-3/+9
| | | | | | | | rdar://problem/41302849 Differential Revision: https://reviews.llvm.org/D53656 llvm-svn: 345402
* Changing test names in TestDataFormatterLibcxxVariant.py and ↵Shafik Yaghmour2018-10-121-1/+1
| | | | | | TestStdFunctionStepIntoCallable.py to be unique, NFC llvm-svn: 344407
* Relax a data formatter testVedant Kumar2018-10-051-0/+1
| | | | | | | Before inspecting the contents of a list, make sure that we've stepped past the push_back() that inserts the element we're interested in. llvm-svn: 343899
* Adding skipIf to std::variant libc++ data-formatter test since get is not ↵Shafik Yaghmour2018-10-031-0/+2
| | | | | | | | available before macOS 10.14 Patch by Shafik Yaghmour llvm-svn: 343718
* Enable C++ tests to run in the -gmodules configuration on Darwin.Adrian Prantl2018-10-011-4/+0
| | | | | | | | This addresses PR36048 (http://llvm.org/bugs/show_bug.cgi?id=36048) rdar://problem/36776281 llvm-svn: 343545
* [DataFormatters] Add formatter for C++17 std::variantShafik Yaghmour2018-09-193-0/+148
| | | | | | | | | | rdar://problem/43691454 Patch by Shafik Yaghmour. Differential Revision: https://reviews.llvm.org/D51520 llvm-svn: 342563
* Allow use of self.filecheck in LLDB tests (c.f self.expect)Vedant Kumar2018-09-181-1/+6
| | | | | | | | | | | | | 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
* Revert "[DataFormatters] Add formatter for C++17 std::variant"Shafik Yaghmour2018-09-173-148/+0
| | | | | | | | This reverts commit r342421. Because it breaks build bot http://green.lab.llvm.org/green/job/lldb-cmake-clang-5.0.2//418/console llvm-svn: 342424
* [DataFormatters] Add formatter for C++17 std::variantShafik Yaghmour2018-09-173-0/+148
| | | | | | | | | | rdar://problem/43691454 Patch by Shafik Yaghmour. Differential Revision: https://reviews.llvm.org/D51520 llvm-svn: 342421
* Avoid using short identifiers in some testsPavel Labath2018-08-311-1/+1
| | | | | | | | | This applies the same workaround as r321271 to other tests. The root problem is that lldb finds an internal symbol with the same name in the debug info of system libraries, and then fails to disambiguate between the two. llvm-svn: 341235
* Disable exceptions for TestDataFormatterLibcxxOptional.pyFrederic Riss2018-08-251-1/+1
| | | | | | | | | | On macOS, some of the <optional> APIs used by the test are available only starting on macOS 10.14 when using exceptions. Build the test with -fno-exceptions so that the test builds on older systems too. rdar://problem/43700544 llvm-svn: 340676
* Add libc++ data formatter for std::functionAdrian Prantl2018-08-232-11/+30
| | | | | | | | | | | | - Added LibcxxFunctionSummaryProvider - Removed LibcxxFunctionFrontEnd - Modified data formatter tests to test new summary functionality Patch by Shafik Yaghmour! Differential Revision: https://reviews.llvm.org/D50864 llvm-svn: 340543
OpenPOWER on IntegriCloud