-
Notifications
You must be signed in to change notification settings - Fork 15k
[lldb][ObjC] Consult Objective-C runtime decl vendor when completing type #164011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+139
−11
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| OBJC_SOURCES := main.m lib.m | ||
| LD_EXTRAS = -framework Foundation | ||
|
|
||
| include Makefile.rules | ||
|
|
||
| lib.o: CFLAGS = $(CFLAGS_NO_DEBUG) |
39 changes: 39 additions & 0 deletions
39
lldb/test/API/lang/objc/ivar-in-framework-base/TestIvarInFrameworkBase.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import lldb | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test import lldbutil | ||
|
|
||
|
|
||
| class TestIvarInFrameworkBase(TestBase): | ||
| """ | ||
| Tests whether LLDB's data inspection commands can correctly retrieve | ||
| information about ivars from the Objective-C runtime. | ||
| In this test-case we have a base class type for which we don't have access | ||
| to the debug-info of the implementation (mimicking the scenario of subclassing | ||
| a type from a system framework). LLDB won't be able to see the backing ivar for | ||
| 'fooProp' from just debug-info, but it will fall back on the runtime to get the | ||
| necessary information. | ||
| """ | ||
|
|
||
| def test_frame_var(self): | ||
| self.build() | ||
| lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) | ||
| self.expect("frame variable *bar", substrs=["_fooProp = 10", "_barProp = 15"]) | ||
|
|
||
| def test_expr(self): | ||
| self.build() | ||
| lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) | ||
| self.expect_expr( | ||
| "*bar", | ||
| result_type="Bar", | ||
| result_children=[ | ||
| ValueCheck( | ||
| name="Foo", | ||
| children=[ | ||
| ValueCheck(name="NSObject"), | ||
| ValueCheck(name="_fooProp", value="10"), | ||
| ], | ||
| ), | ||
| ValueCheck(name="_barProp", value="15"), | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @interface Foo : NSObject | ||
| @property int fooProp; | ||
| - (id)init; | ||
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #import "lib.h" | ||
|
|
||
| @implementation Foo | ||
| - (id)init { | ||
| self.fooProp = 10; | ||
| return self; | ||
| } | ||
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #import "lib.h" | ||
| #include <stdio.h> | ||
|
|
||
| @interface Bar : Foo | ||
| @property int barProp; | ||
| - (id)init; | ||
| @end | ||
|
|
||
| @implementation Bar | ||
|
|
||
| - (id)init { | ||
| self = [super init]; | ||
| self.barProp = 15; | ||
| return self; | ||
| } | ||
| @end | ||
|
|
||
| int main() { | ||
| Bar *bar = [Bar new]; | ||
| puts("break here"); | ||
| return 0; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why search for UINT32_MAX types if we only return the first one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now just wanted to upstream the version we had. But yea I agree using a
UINT32_MAXis not ideal. Can change it in a follow-upThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's the search for UINT32_MAX types that is the problem, but rather the not handling the case where you got more than one type back. If there's more than one, how do you know the first one is the right one?
It's fine to do this as a followup, since this code has been working on the swift fork for a while now. But that's the thing I'd fix, not preemptively ignoring multiple definitions.