-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier #111859
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
Changes from 1 commit
4c394ec
8f7c944
e34cd8f
86390ef
dd67524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| CXX_SOURCES := main.cpp | ||
| CXXFLAGS_EXTRAS := -gdwarf-4 | ||
|
|
||
| include Makefile.rules |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """ | ||
| Test SBTarget::FindGlobalVariables API. | ||
| """ | ||
|
||
|
|
||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
|
|
||
|
|
||
| class TargetAPITestCase(TestBase): | ||
| mydir = TestBase.compute_mydir(__file__) | ||
|
|
||
| @add_test_categories(["pyapi"]) | ||
| def test_find_global_variables(self): | ||
| """Exercise SBTarget.FindGlobalVariables() API.""" | ||
| self.build() | ||
|
|
||
| # Don't need to launch a process, since we're only interested in | ||
| # looking up global variables. | ||
| target = self.dbg.CreateTarget(self.getBuildArtifact()) | ||
|
|
||
| def test_global_var(query, name, type_name, value): | ||
| value_list = target.FindGlobalVariables(query, 1) | ||
| self.assertEqual(value_list.GetSize(), 1) | ||
| var = value_list.GetValueAtIndex(0) | ||
| self.DebugSBValue(var) | ||
| self.assertTrue(var) | ||
| self.assertEqual(var.GetName(), name) | ||
| self.assertEqual(var.GetTypeName(), type_name) | ||
| self.assertEqual(var.GetValue(), value) | ||
|
|
||
| test_global_var("Vars::inline_static", "Vars::inline_static", "double", "1.5") | ||
| test_global_var( | ||
| "Vars::static_constexpr", "Vars::static_constexpr", "const int", "2" | ||
| ) | ||
| test_global_var( | ||
| "Vars::static_const_out_out_class", | ||
| "Vars::static_const_out_out_class", | ||
| "const int", | ||
| "3", | ||
| ) | ||
| test_global_var( | ||
| "global_var_of_char_type", "::global_var_of_char_type", "char", "'X'" | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| class Vars { | ||
|
||
| public: | ||
| inline static double inline_static = 1.5; | ||
| static constexpr int static_constexpr = 2; | ||
| static const int static_const_out_out_class; | ||
| }; | ||
|
|
||
| const int Vars::static_const_out_out_class = 3; | ||
|
|
||
| char global_var_of_char_type = 'X'; | ||
|
|
||
| int main() {} | ||
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.
Unused