summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/data-formatter/data-formatter-objc
AgeCommit message (Collapse)Author
2025-09-16[LLDB] [Tests] Downgrade -Wincompatible-pointer-types to a warning in some ↵Sirraide
tests (#158756) These no longer compile because the warning now defaults to an error after #157364, so downgrade the error to a warning for now; I’m not familiar enough with either LLDB or MacOS to fix these warnings properly (assuming they’re unintended).
2025-05-28[lldb][objc] NSError data formatter test is failingJason Molenda
after PR 138209 stopped applying data formatters for T** by default, and this test expects that to work. We'll need to figure out if we want to drop this test, or adapt NSError/other objc formatters to descend an extra level or two of depth.
2025-03-17[lldb] Support ordered patterns in lldbtest.expect (#131475)Dave Lee
Change `lldbtest.expect` to require the regexes in `patterns` be found in order – when the `ordered` parameter is true. This matches the behavior of `substrs`. The `ordered` parameter is true by default, so this change also fixes tests by either tweaking the patterns to work in order, or by setting `ordered=False`. I have often wanted to test with `patterns` and also verify the order. This change allows that.
2025-02-28[lldb] fix(lldb/**.py): fix invalid escape sequences (#94034)Eisuke Kawashima
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-01-13The _code field in an NSError is signed, not unsigned. (#119764)jimingham
The NSError summary provider was fetching and printing the `_code` field as an unsigned integer, but it's defined to be an NSInteger, which is signed.
2024-09-11[lldb][test] Toolchain detection rewrite in Python (#102185)Vladislav Dzhidzhoev
This fix is based on a problem with cxx_compiler and cxx_linker macros on Windows. There was an issue with compiler detection in paths containing "icc". In such case, Makefile.rules thought it was provided with icc compiler. To solve that, utilities detection has been rewritten in Python. The last element of compiler's path is separated, taking into account the platform path delimiter, and compiler type is extracted, with regard of possible cross-toolchain prefix. --------- Co-authored-by: Pavel Labath <pavel@labath.sk>
2024-01-21[lldb] Skip ObjC timezone tests on macOS >= 14 (NFC) (#78817)Dave Lee
Starting with macOS 14, the `NSTimeZone` and `CFTimeZone` types are backed by swift implementations. These tests won't pass on mainline lldb, since it doesn't have Swift support.
2023-10-20[lldb][test] Turn ObjC string literals to C-style literals (NFC) (#69793)Dave Lee
The underlying timezone classes are being reimplemented in Swift, and these strings will be Swift strings, without the ObjC `@` prefix. Leaving off the `@` makes these tests usable both before and after the reimplmentation of Foundation in Swift.
2023-05-25[NFC][Py Reformat] Reformat python files in lldbJonas Devlieghere
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
2022-08-22[lldb] Remove prefer-dynamic-value test overrideDave Lee
Remove the test override of `target.prefer-dynamic-value`. Previously, the lldb default was `no-dynamic-values`. In rG9aa7e8e9ffbe (in 2015), the default was changed to `no-run-target`, but at that time the tests were changed to be run with `no-dynamic-value`. I don't know the reasons for not changing the tests, perhaps to avoid determining which tests to change, and what about them to change. Because `no-run-target` is the lldb default, I think it makes sense to make it the test default too. It puts the test config closer to what's used in practice. This change removes the `target.prefer-dynamic-value` override, and for those tests that failed, they have been updated to explicitly use `no-dynamic-values`. Future changes could update these tests to use dynamic values too, or they can be left as is to exercise non-dynamic typing. Differential Revision: https://reviews.llvm.org/D132382
2022-08-15[LLDB] Remove __future__ imports from testsDavid Spickett
Not needed now that we require python 3. Reviewed By: kastiglione, JDevlieghere Differential Revision: https://reviews.llvm.org/D131761
2022-06-17[lldb][tests] Automatically call compute_mydir (NFC)Dave Lee
Eliminate boilerplate of having each test manually assign to `mydir` by calling `compute_mydir` in lldbtest.py. Differential Revision: https://reviews.llvm.org/D128077
2022-04-12[lldb] Re-enable fixed on-device testsJonas Devlieghere
These tests were fixed by 833882b32701.
2022-04-08Adapt the ObjC stepping algorithm to deal with "selector-stubs" in clang.Jim Ingham
Clang is adding a feature to ObjC code generation, where instead of calling objc_msgSend directly with an object & selector, it generates a stub that gets passed only the object and the stub figures out the selector. This patch adds support for following that dispatch method into the implementation function.
2022-04-08[lldb] XFAIL tests that aren't passing remotelyJonas Devlieghere
XFAIL a series of tests that are failing remotely.
2021-08-06Re-land "[lldb] Upstream support for Foundation constant classes"Jonas Devlieghere
Upstream support for NSConstantArray, NSConstantIntegerNumber, NSConstant{Float,Double}Number and NSConstantDictionary. We would've upstreamed this earlier but testing it requires -fno-constant-nsnumber-literals, -fno-constant-nsarray-literals and -fno-constant-nsdictionary-literals which haven't been upstreamed yet. As a temporary workaround use the system compiler (xcrun clang) for the constant variant of the tests. I'm just upstreaming this. The patch and the tests were all authored by Fred Riss. Differential revision: https://reviews.llvm.org/D107660
2021-08-06Revert "[lldb] Upstream support for Foundation constant classes"Sterling Augustine
This reverts commit 34d78b6a6755946e547afc47d38b59b6a2854457. This breaks build bots witha missing file: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp:10:10: fatal error: 'objc/runtime.h' file not found
2021-08-06[lldb] Upstream support for Foundation constant classesJonas Devlieghere
Upstream support for NSConstantArray, NSConstantIntegerNumber, NSConstant{Float,Double}Number and NSConstantDictionary. We would've upstreamed this earlier but testing it requires -fno-constant-nsnumber-literals, -fno-constant-nsarray-literals and -fno-constant-nsdictionary-literals which haven't been upstreamed yet. As a temporary workaround use the system compiler (xcrun clang) for the constant variant of the tests. I'm just upstreaming this. The patch and the tests were all authored by Fred Riss. Differential revision: https://reviews.llvm.org/D107660
2021-06-25Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"Jim Ingham
This was an oversight of the commit: bb93483c119b92c1ec2b7a58505e21b9dce6a333 that added support for the Frozen variants. Also added a test case for the way that currently produces one of these variants (a copy).
2021-04-05Revert "Revert "Add support for fetching signed values from tagged pointers.""Jim Ingham
This reverts commit 602ab188a7e18b97d9af95e17271e8fbee129081. The patch replicated an lldbassert for a certain type of NSNumber for tagged pointers. This really shouldn't be an assert since we don't do anything wrong with these numbers, we just don't print a summary. So this patch changed the lldbassert to a log message in reverting the revert.
2021-04-04Revert "Add support for fetching signed values from tagged pointers."Jason Molenda
This reverts commit 4d9039c8dc2d1f0be1b5ee486d5a83b1614b038a. This is causing the greendragon bots to fail most of the time when running TestNSDictionarySynthetic.py. Reverting until Jim has a chance to look at this on Monday. Running the commands from that test from the command line, it fails 10-13% of the time on my desktop. This is a revert of Jim's changes in https://reviews.llvm.org/D99694
2021-04-01Add support for fetching signed values from tagged pointers.Jim Ingham
The ObjC runtime offers both signed & unsigned tagged pointer value accessors to tagged pointer providers, but lldb's tagged pointer code only implemented the unsigned one. This patch adds an emulation of the signed one. The motivation for doing this is that NSNumbers use the signed accessor (they are always signed) and we need to follow that in our summary provider or we will get incorrect values for negative NSNumbers. The data-formatter-objc test file had NSNumber examples (along with lots of other goodies) but the NSNumber values weren't tested. So I also added checks for those values to the test. I also did a quick audit of the other types in that main.m file, and it looks like pretty much all the other values are either intermediates or are tested. Differential Revision: https://reviews.llvm.org/D99694
2020-11-10[lldb] [test] Rename '.categories' to 'categories'Michał Górny
Make category-specifying files visible. There is really no good reason to keep them hidden, and having them visible increases the chances that someone will actually spot them. Differential Revision: https://reviews.llvm.org/D91065
2020-11-10[lldb] [test] Skip ObjC-based tests via 'objc' categoryMichał Górny
Replace the plethora of ObjC-implied 'skipUnlessDarwin' decorators with marking tests as 'objc' category (whenever missing), and skip all ObjC tests on non-Darwin platforms. I have used '.categories' file wherever it was present already or all (>1) tests were relying on ObjC, and explicit add_test_categories() where there was only one test. Differential Revision: https://reviews.llvm.org/D91056
2020-10-05[lldb/test] Catch invalid calls to expect()Dave Lee
Add preconditions to `TestBase.expect()` that catch semantically invalid calls that happen to succeed anyway. This also fixes the broken callsites caught by these checks. This prevents the following incorrect calls: 1. `self.expect("lldb command", "some substr")` 2. `self.expect("lldb command", "assert message", "some substr")` Differential Revision: https://reviews.llvm.org/D88792
2020-09-11[lldb] Add test for CFMutableDictionaryRefJonas Devlieghere
While writing a test for a change in Foundation I noticed we didn't yet test CFMutableDictionaryRef.
2020-07-15[lldb][formatters] Add support for printing NSConstantDate and fix ↵Raphael Isemann
distantPast value Summary: Certain `NSDate` constructors return a special `NSConstantDate` class which currently ends up being unformatted as it's not in the list of supported classes for the NSDate formatter. This patch adds that class to the supported class list so LLDB produces a summary for it. One of these special constructors is `[NSDate distantPast]` which returns the date for `0001-01-01 00:00:00 UTC`. LLDB has a special case for formatting this date but for some reason we did hardcode the wrong summary string in that special case. Maybe the summary string was correct back when the code was written but it isn't correct anymore (`distantPast` isn't actually defined to be a special date but just some 'a guaranteed temporal boundary.' so maybe someone changed the value in the last 10 years). If someone else is wondering why we even have this special case for `distantPast` but not for the future. The reason seems to be that our date formatting for really old dates is off by 24 hours. So for example, adding one second to `distantPast` will cause LLDB to print `0000-12-30 00:00:01 UTC` (which is 24 hours behind the expected result). So to make our code appear to be correct it seems we just hardcoded the most common NSDate result from that time span. I'll replace that logic with a generic solution in a probably more invasive follow up patch. I also took the freedom to replace the magic value `-63114076800` with some constant + documentation. I heard there are some people that don't know from the top of their head that there are 63114076800 seconds between 1. Jan 0001 and 1. January 2001 in whatever calendar system NSDate is using. Reviewers: mib, davide Reviewed By: mib Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D83217
2020-07-06[lldb] Always round down in NSDate's formatter to match NSDate's builtin formatRaphael Isemann
Summary: When printing an NSDate (for example with `NSLog` or `po`) the seconds value is always rounded down. LLDB's own formatter however isn't following that behaviour which leads to situations where the formatted result is sometimes one second off. For example: ``` (lldb) p [NSDate dateWithTimeIntervalSince1970:0.1] (__NSTaggedDate *) $1 = [...] 1970-01-01 00:00:01 UTC (lldb) po [NSDate dateWithTimeIntervalSince1970:0.1] 1970-01-01 00:00:00 +0000 (lldb) p [NSDate dateWithTimeIntervalSince1970:0.6] (__NSTaggedDate *) $4 =[...] 1970-01-01 00:00:01 UTC (lldb) po [NSDate dateWithTimeIntervalSince1970:0.6] 1970-01-01 00:00:00 +0000 ``` This patch just always rounds down the seconds value we get from the NSDate object. Fixes rdar://65084800 Reviewers: mib, davide Reviewed By: mib Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D83221
2020-05-15[lldb/Dataformatter] Add support to CF{Dictionary,Set}Ref typesMed Ismail Bennani
This patch improves data formatting for CFDictionaryRef and CFSetRef. It uses the same data-formatter as NSCFDictionaries and NSCFSets introduced previously but did require some adjustments in Core::ValueObject. Since the "Ref" types are opaque pointers to the actual CF containers, if the value object has a synthetic value, lldb will use the opaque pointer's pointee type to create the new ValueObjectChild needed to dereference the ValueObject. This allows the "Ref" types to behaves the same as CF containers when used with the `frame variable` command, the SBAPI or in Xcode's variable inspector. This patch also adds support for incomplete types in ValueObject. rdar://53104287 Differential Revision: https://reviews.llvm.org/D79554 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-05-07[lldb/test] Reformat Objective-C data-formatter source file (NFC)Med Ismail Bennani
The source file used to test Objective-C data-formatters didn't respected any formatting (mixed tab and spaces, lines exceed column 80, etc...). This patch reformats the file using clang-format to make it easier to work with. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-04-27[lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets.Med Ismail Bennani
This patch improves data formatting for CoreFoundation containers: CFDictionary and CFSet. These data formatters make the containers and their children appear in Xcode's variables view (and on the command line) without having to expand the data structure. Previous implementation only supported showing the container's element count. ``` (lldb) frame var dict (__NSCFDictionary *) dict = 0x00000001004062b0 2 key/value pairs (lldb) frame var set (__NSCFSet *) set = 0x0000000100406330 2 elements ``` Now the variable can be dereferenced to dispaly the container's children: ``` (lldb) frame var *dict (__NSCFDictionary) *dict = { [0] = { key = 0x0000000100004050 @"123" value = 0x0000000100004090 @"456" } [1] = { key = 0x0000000100004030 @"abc" value = 0x0000000100004070 @"def" } } (lldb) frame var *set (__NSCFSet) *set = { [0] = 0x0000000100004050 @"123" [1] = 0x0000000100004030 @"abc" } ``` rdar://39882287 Differential Revision: https://reviews.llvm.org/D78396 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-03-19Reland [lldb] Fix string summary of an empty NSPathStore2Raphael Isemann
(This is D68010 but I also set the new parameter in LibStdcpp.cpp to fix the Debian tests). Summary: Printing a summary for an empty NSPathStore2 string currently prints random bytes behind the empty string pointer from memory (rdar://55575888). It seems the reason for this is that the SourceSize parameter in the `ReadStringAndDumpToStreamOptions` - which is supposed to contain the string length - actually uses the length 0 as a magic value for saying "read as much as possible from the buffer" which is clearly wrong for empty strings. This patch adds another flag that indicates if we have know the string length or not and makes this behaviour dependent on that (which seemingly was the original purpose of this magic value). Reviewers: aprantl, JDevlieghere, shafik Reviewed By: aprantl Subscribers: christof, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68010
2020-03-19Revert "[lldb] Fix string summary of an empty NSPathStore2"Raphael Isemann
This reverts commit 939ca455e72e822450013eff37c9ea7746850350. This failed on the debian bot for some reason: File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py", line 67, in test_with_run_command "s summary wrong") AssertionError: 'L"hello world! מזל טוב!\\0!\\0!!!!\\0\\0A\\0\\U0000fffd\\U0000fffd\\U0000fffd\\ [truncated]... != 'L"hello world! מזל טוב!"' Diff is 2156 characters long. Set self.maxDiff to None to see it. : s summary wrong
2020-03-19[lldb] Fix string summary of an empty NSPathStore2Raphael Isemann
Summary: Printing a summary for an empty NSPathStore2 string currently prints random bytes behind the empty string pointer from memory (rdar://55575888). It seems the reason for this is that the SourceSize parameter in the `ReadStringAndDumpToStreamOptions` - which is supposed to contain the string length - actually uses the length 0 as a magic value for saying "read as much as possible from the buffer" which is clearly wrong for empty strings. This patch adds another flag that indicates if we have know the string length or not and makes this behaviour dependent on that (which seemingly was the original purpose of this magic value). Reviewers: aprantl, JDevlieghere, shafik Reviewed By: aprantl Subscribers: christof, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68010
2020-02-20[lldb] Remove license headers from all test source filesRaphael Isemann
Summary: Around a third of our test sources have LLVM license headers. This patch removes those headers from all test sources and also fixes any tests that depended on the length of the license header. The reasons for this are: * A few tests verify line numbers and will start failing if the number of lines in the LLVM license header changes. Once I landed my patch for valid SourceLocations in debug info we will probably have even more tests that verify line numbers. * No other LLVM project is putting license headers in its test files to my knowledge. * They make the test sources much more verbose than they have to be. Several tests have longer license headers than the actual test source. For the record, the following tests had their line numbers changed to pass with the removal of the license header: lldb-api :: functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py lldb-shell :: Reproducer/TestGDBRemoteRepro.test lldb-shell :: Reproducer/TestMultipleTargets.test lldb-shell :: Reproducer/TestReuseDirectory.test lldb-shell :: ExecControl/StopHook/stop-hook-threads.test lldb-shell :: ExecControl/StopHook/stop-hook.test lldb-api :: lang/objc/exceptions/TestObjCExceptions.py Reviewers: #lldb, espindola, JDevlieghere Reviewed By: #lldb, JDevlieghere Subscribers: emaste, aprantl, arphaman, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D74839
2020-02-11[lldb][test] Remove symlink for API tests.Jordan Rupprecht
Summary: Moves lldbsuite tests to lldb/test/API. This is a largely mechanical change, moved with the following steps: ``` rm lldb/test/API/testcases mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}} mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done ``` lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure. Reviewers: labath, JDevlieghere Tags: #lldb Differential Revision: https://reviews.llvm.org/D71151