Skip to content

Commit f5c676d

Browse files
authored
[LLDB] Switch to using DIL as default implementation for 'frame var'. (#147887)
1 parent 3d68823 commit f5c676d

File tree

7 files changed

+50
-8
lines changed

7 files changed

+50
-8
lines changed

lldb/source/Target/TargetProperties.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ let Definition = "target_experimental" in {
55
Global, DefaultTrue,
66
Desc<"If true, inject local variables explicitly into the expression text. This will fix symbol resolution when there are name collisions between ivars and local variables. But it can make expressions run much more slowly.">;
77
def UseDIL : Property<"use-DIL", "Boolean">,
8-
Global, DefaultFalse,
9-
Desc<"If true, use the alternative DIL implementation for frame variable evaluation.">;
8+
Global, DefaultTrue,
9+
Desc<"If true, use the DIL implementation for frame variable evaluation.">;
1010
}
1111

1212
let Definition = "target" in {

lldb/source/ValueObject/DILEval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Interpreter::Visit(const MemberOfNode *node) {
303303
}
304304
}
305305

306-
if (field_obj && field_obj->GetName() == node->GetFieldName()) {
306+
if (field_obj) {
307307
if (m_use_dynamic != lldb::eNoDynamicValues) {
308308
lldb::ValueObjectSP dynamic_val_sp =
309309
field_obj->GetDynamicValue(m_use_dynamic);

lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,17 @@ def test_frame_var(self):
2929
self.expect_var_path("ns::i", value="1")
3030
self.expect_var_path("::ns::ns::i", value="2")
3131
self.expect_var_path("ns::ns::i", value="2")
32+
33+
self.expect_var_path("foo", value="1")
34+
self.expect_var_path("::(anonymous namespace)::foo", value="13")
35+
self.expect_var_path("(anonymous namespace)::foo", value="13")
36+
self.expect_var_path("ns1::(anonymous namespace)::foo", value="5")
37+
self.expect_var_path(
38+
"(anonymous namespace)::ns2::(anonymous namespace)::foo",
39+
value="7",
40+
)
41+
self.expect_var_path("::ns1::(anonymous namespace)::foo", value="5")
42+
self.expect_var_path(
43+
"::(anonymous namespace)::ns2::(anonymous namespace)::foo",
44+
value="7",
45+
)

lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,26 @@ int i = 2;
1010

1111
} // namespace ns
1212

13+
namespace {
14+
int foo = 13;
15+
}
16+
17+
namespace ns1 {
18+
namespace {
19+
int foo = 5;
20+
}
21+
} // namespace ns1
22+
23+
namespace {
24+
namespace ns2 {
25+
namespace {
26+
int foo = 7;
27+
}
28+
} // namespace ns2
29+
} // namespace
30+
1331
int main(int argc, char **argv) {
32+
int foo = 1;
1433

15-
return 0; // Set a breakpoint here
34+
return foo + ::foo + ns1::foo + ns2::foo; // Set a breakpoint here
1635
}

lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def run_test_evaluate_expressions(
131131
self.assertEvaluateFailure("a_function(1)")
132132
self.assertEvaluateFailure("var2 + struct1.foo")
133133
self.assertEvaluateFailure("foo_func")
134-
self.assertEvaluateFailure("foo_var")
134+
self.assertEvaluate("foo_var", "44")
135135

136136
# Expressions at breakpoint 2, which is an anonymous block
137137
self.continue_to_breakpoint(breakpoint_2)
@@ -169,7 +169,7 @@ def run_test_evaluate_expressions(
169169
self.assertEvaluateFailure("a_function(1)")
170170
self.assertEvaluateFailure("var2 + struct1.foo")
171171
self.assertEvaluateFailure("foo_func")
172-
self.assertEvaluateFailure("foo_var")
172+
self.assertEvaluate("foo_var", "44")
173173

174174
# Expressions at breakpoint 3, which is inside a_function
175175
self.continue_to_breakpoint(breakpoint_3)
@@ -195,7 +195,7 @@ def run_test_evaluate_expressions(
195195
self.assertEvaluateFailure("a_function(1)")
196196
self.assertEvaluateFailure("list + 1")
197197
self.assertEvaluateFailure("foo_func")
198-
self.assertEvaluateFailure("foo_var")
198+
self.assertEvaluate("foo_var", "44")
199199

200200
# Now we check that values are updated after stepping
201201
self.continue_to_breakpoint(breakpoint_4)

lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# RUN: %clang_host -fmodules -Xclang -fmodules-cache-path=%t/cache -I%t -g -gmodules %t/b.m -o %t/b.o -c
1616
# RUN: %clang_host %t/a.o %t/b.o -o %t/a.out
1717
# RUN: rm -rf %t/cache
18-
# RUN: %lldb %t/a.out -o "b main" -o run -o "p a" -o "p b" -o q 2>&1 | FileCheck %s
18+
# RUN: %lldb %t/a.out -o "b main" -o run -o "expr a" -o "expr b" -o q 2>&1 | FileCheck %s
1919
# CHECK: {{[ab]}}.o{{.*}}/cache/{{.*}}/C-{{.*}}.pcm' does not exist
2020
# CHECK-NOT: /cache/{{.*}}/C-{.*}.pcm' does not exist
2121
# CHECK: {{[ab]}}.o{{.*}}/cache/{{.*}}/C-{{.*}}.pcm' does not exist

llvm/docs/ReleaseNotes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,20 @@ Changes to LLDB
311311
stop reason = SIGSEGV: sent by tkill system call (sender pid=649752, uid=2667987)
312312
```
313313
* ELF Cores can now have their siginfo structures inspected using `thread siginfo`.
314+
* LLDB now uses
315+
[DIL](https://discourse.llvm.org/t/rfc-data-inspection-language/69893) as the
316+
default implementation for 'frame variable'. This should not change the
317+
behavior of 'frame variable' at all, at this time. To revert to using the
318+
old implementation use
319+
```
320+
settings set target.experimental.use-DIL false
321+
```
314322
* Disassembly of unknown instructions now produces `<unknown>` instead of
315323
nothing at all
316324
* Changed the format of opcode bytes to match llvm-objdump when disassembling
317325
RISC-V code with `disassemble`'s `--byte` option.
318326

327+
319328
### Changes to lldb-dap
320329

321330
* Breakpoints can now be set for specific columns within a line.

0 commit comments

Comments
 (0)