Skip to content

Commit 627df6f

Browse files
committed
[lldb] Test global variable support of dwim-print (NFC)
DIL has made frame variable support global variables, which in turn means dwim-print inherits support for global variables.
1 parent 33c9236 commit 627df6f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lldb/test/API/commands/dwim-print/TestDWIMPrint.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def _run_cmd(self, cmd: str) -> str:
1616
self.ci.HandleCommand(cmd, result)
1717
return result.GetOutput().rstrip()
1818

19-
VAR_IDENT = re.compile(r"(?:\$\d+|[\w.]+) = ")
19+
VAR_IDENT = re.compile(r"(?:\$\d+|(?:::)?[\w.]+) = ")
2020

2121
def _strip_result_var(self, string: str) -> str:
2222
"""
@@ -185,3 +185,11 @@ def test_direct_child_access(self):
185185
self, "break inside", lldb.SBFileSpec("main.cpp")
186186
)
187187
self._expect_cmd("dwim-print number", "frame variable")
188+
189+
def test_global_variables(self):
190+
"""Test dwim-print supports global variables."""
191+
self.build()
192+
lldbutil.run_to_source_breakpoint(
193+
self, "break here", lldb.SBFileSpec("main.cpp")
194+
)
195+
self._expect_cmd("dwim-print gGlobal", "frame variable")

lldb/test/API/commands/dwim-print/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
extern "C" int puts(const char *s);
22

3+
extern int gGlobal;
4+
int gGlobal = 23;
5+
36
struct Structure {
47
int number = 30;
58
void f() { puts("break inside"); }

0 commit comments

Comments
 (0)