Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to see when a type in incomplete.
-flimit-debug-info and other compiler options might end up removing debug info that is needed for debugging. LLDB marks these types as being forcefully completed in the metadata in the TypeSystem. These types should have been complete in the debug info but were not because the compiler omitted them to save space. When we can't find a suitable replacement for the type, we should let the user know that these types are incomplete to indicate there was an issue instead of just showing nothing for a type. The solution is to display presented in this patch is to display "<incomplete type>" as the summary for any incomplete types. If there is a summary string or function that is provided for a type, but the type is currently forcefully completed, the installed summary will be ignored and we will display "<incomplete type>". This patch also exposes the ability to ask a SBType if it was forcefully completed with: bool SBType::IsTypeForcefullyCompleted(); This will allow the user interface for a debugger to also detect this issue and possibly mark the variable display up on some way to indicate to the user the type is incomplete. To show how this is diplayed, we can look at the existing output first for the example source file from the file: lldb/test/API/functionalities/limit-debug-info/main.cpp (lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one (InheritsFromOne) ::inherits_from_one = (member = 47) (InheritsFromTwo) ::inherits_from_two = (member = 47) (OneAsMember) ::one_as_member = (one = member::One @ 0x0000000100008028, member = 47) (TwoAsMember) ::two_as_member = (two = member::Two @ 0x0000000100008040, member = 47) (array::One [3]) ::array_of_one = ([0] = array::One @ 0x0000000100008068, [1] = array::One @ 0x0000000100008069, [2] = array::One @ 0x000000010000806a) (array::Two [3]) ::array_of_two = ([0] = array::Two @ 0x0000000100008098, [1] = array::Two @ 0x0000000100008099, [2] = array::Two @ 0x000000010000809a) (ShadowedOne) ::shadowed_one = (member = 47) (lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one (InheritsFromOne) ::inherits_from_one = { (int) member = 47 } (InheritsFromTwo) ::inherits_from_two = { (int) member = 47 } (OneAsMember) ::one_as_member = { (member::One) one = {} (int) member = 47 } (TwoAsMember) ::two_as_member = { (member::Two) two = {} (int) member = 47 } (array::One [3]) ::array_of_one = { (array::One) [0] = {} (array::One) [1] = {} (array::One) [2] = {} } (array::Two [3]) ::array_of_two = { (array::Two) [0] = {} (array::Two) [1] = {} (array::Two) [2] = {} } (ShadowedOne) ::shadowed_one = { (int) member = 47 } With this patch in place we can now see any classes that were forcefully completed to let us know that we are missing information: (lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one (InheritsFromOne) ::inherits_from_one = (One = <incomplete type>, member = 47) (InheritsFromTwo) ::inherits_from_two = (Two = <incomplete type>, member = 47) (OneAsMember) ::one_as_member = (one = <incomplete type>, member = 47) (TwoAsMember) ::two_as_member = (two = <incomplete type>, member = 47) (array::One[3]) ::array_of_one = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>) (array::Two[3]) ::array_of_two = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>) (ShadowedOne) ::shadowed_one = (func_shadow::One = <incomplete type>, member = 47) (lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one (InheritsFromOne) ::inherits_from_one = { (One) One = <incomplete type> {} (int) member = 47 } (InheritsFromTwo) ::inherits_from_two = { (Two) Two = <incomplete type> {} (int) member = 47 } (OneAsMember) ::one_as_member = { (member::One) one = <incomplete type> {} (int) member = 47 } (TwoAsMember) ::two_as_member = { (member::Two) two = <incomplete type> {} (int) member = 47 } (array::One[3]) ::array_of_one = { (array::One) [0] = <incomplete type> {} (array::One) [1] = <incomplete type> {} (array::One) [2] = <incomplete type> {} } (array::Two[3]) ::array_of_two = { (array::Two) [0] = <incomplete type> {} (array::Two) [1] = <incomplete type> {} (array::Two) [2] = <incomplete type> {} } (ShadowedOne) ::shadowed_one = { (func_shadow::One) func_shadow::One = <incomplete type> {} (int) member = 47 } Differential Revision: https://reviews.llvm.org/D138259
- Loading branch information
Showing
9 changed files
with
185 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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