Skip to content

Commit 94b0d83

Browse files
committed
Fix reporting the lack of global variables in "target var".
There was a little thinko which meant when stopped in a frame with debug information but whose CU didn't have any global variables we report: no debug info for frame <N> This patch fixes that error message to say the intended: no global variables in current compile unit <rdar://problem/69086361>
1 parent 8fdac7c commit 94b0d83

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

lldb/source/Commands/CommandObjectTarget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ class CommandObjectTargetVariable : public CommandObjectParsed {
907907
CompileUnit *comp_unit = nullptr;
908908
if (frame) {
909909
SymbolContext sc = frame->GetSymbolContext(eSymbolContextCompUnit);
910+
comp_unit = sc.comp_unit;
910911
if (sc.comp_unit) {
911912
const bool can_create = true;
912913
VariableListSP comp_unit_varlist_sp(
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
C_SOURCES := main.c
2+
3+
include Makefile.rules
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Test that target var with no variables returns a correct error
3+
"""
4+
5+
import lldb
6+
from lldbsuite.test.decorators import *
7+
from lldbsuite.test.lldbtest import *
8+
from lldbsuite.test import lldbutil
9+
10+
11+
class TestTargetVarNoVars(TestBase):
12+
13+
mydir = TestBase.compute_mydir(__file__)
14+
15+
NO_DEBUG_INFO_TESTCASE = True
16+
17+
def test_target_var_no_vars(self):
18+
self.build()
19+
lldbutil.run_to_name_breakpoint(self, 'main')
20+
self.expect("target variable", substrs=['no global variables in current compile unit', 'main.c'], error=True)
21+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int
2+
main(int argc, char **argv)
3+
{
4+
return argc;
5+
}

0 commit comments

Comments
 (0)