Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lldb/test/API/commands/dwim-print/TestDWIMPrint.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _run_cmd(self, cmd: str) -> str:
self.ci.HandleCommand(cmd, result)
return result.GetOutput().rstrip()

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

def _strip_result_var(self, string: str) -> str:
"""
Expand Down Expand Up @@ -185,3 +185,11 @@ def test_direct_child_access(self):
self, "break inside", lldb.SBFileSpec("main.cpp")
)
self._expect_cmd("dwim-print number", "frame variable")

def test_global_variables(self):
"""Test dwim-print supports global variables."""
self.build()
lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.cpp")
)
self._expect_cmd("dwim-print gGlobal", "frame variable")
3 changes: 3 additions & 0 deletions lldb/test/API/commands/dwim-print/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
extern "C" int puts(const char *s);

extern int gGlobal;
int gGlobal = 23;

struct Structure {
int number = 30;
void f() { puts("break inside"); }
Expand Down
Loading