-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lldb][SymbolFileDWARF] Share GetDIEToType between SymbolFiles of a SymbolFileDWARFDebugMap #120569
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
Michael137
merged 7 commits into
llvm:main
from
Michael137:bugfix/lldb-typedef-to-outer
Dec 23, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9aa49ef
[lldb][SymbolFileDWARF] CompleteType: Lookup type in the declaration …
Michael137 be4c4c1
fixup! clang-format
Michael137 52ca089
fixup! python format
Michael137 918efaa
fixup! share DIEToType map between debug-map SymbolFiles
Michael137 ca0c533
fixup! make test bi-directional
Michael137 be004c1
Merge branch 'main' into bugfix/lldb-typedef-to-outer
Michael137 d87abe7
fixup! merge test cases; fix comment
Michael137 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
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
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,3 @@ | ||
| CXX_SOURCES := lib.cpp main.cpp | ||
|
|
||
| include Makefile.rules |
38 changes: 38 additions & 0 deletions
38
lldb/test/API/lang/cpp/typedef-to-outer-fwd/TestTypedefToOuterFwd.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,38 @@ | ||
| import lldb | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test import lldbutil | ||
|
|
||
|
|
||
| class TestCaseTypedefToOuterFwd(TestBase): | ||
| """ | ||
| We find a global variable whose type is forward declared | ||
| (whose definition is in either main.o or lib.o). We then | ||
| try to get the 'Ref' typedef nested within that forward | ||
| declared type. This test makes sure we correctly resolve | ||
| this typedef. | ||
|
|
||
| We test this for two cases, where the definition lives | ||
| in main.o or lib.o. | ||
| """ | ||
|
|
||
| def check_global_var(self, target, name: str): | ||
| var = target.FindFirstGlobalVariable(name) | ||
| self.assertSuccess(var.GetError(), f"Found {name}") | ||
|
|
||
| var_type = var.GetType() | ||
| self.assertTrue(var_type) | ||
|
|
||
| impl = var_type.GetPointeeType() | ||
| self.assertTrue(impl) | ||
|
|
||
| ref = impl.FindDirectNestedType("Ref") | ||
| self.assertTrue(ref) | ||
|
|
||
| self.assertEqual(ref.GetCanonicalType(), var_type) | ||
|
|
||
| def test(self): | ||
| self.build() | ||
| target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) | ||
| self.check_global_var(target, "gLibExternalDef") | ||
| self.check_global_var(target, "gMainExternalDef") |
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,10 @@ | ||
| #include "lib.h" | ||
|
|
||
| template <typename T> struct FooImpl { | ||
| using Ref = FooImpl<T> *; | ||
|
|
||
| Ref Create() { return new FooImpl<T>(); } | ||
| }; | ||
|
|
||
| FooImpl<char> gLibLocalDef; | ||
| BarImpl<char> *gLibExternalDef = nullptr; |
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,7 @@ | ||
| #ifndef LIB_H_IN | ||
| #define LIB_H_IN | ||
|
|
||
| template <typename T> struct FooImpl; | ||
| template <typename T> struct BarImpl; | ||
|
|
||
| #endif // LIB_H_IN |
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,12 @@ | ||
| #include "lib.h" | ||
|
|
||
| template <typename T> struct BarImpl { | ||
| using Ref = BarImpl<T> *; | ||
|
|
||
| Ref Create() { return new BarImpl<T>(); } | ||
| }; | ||
|
|
||
| BarImpl<char> gMainLocalDef; | ||
| FooImpl<char> *gMainExternalDef = nullptr; | ||
|
|
||
| int main() { 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.
Uh oh!
There was an error while loading. Please reload this page.