1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Complex Go Variable Verification Test
# Tests local variable inspection, stepping into functions, and expression evaluation
#
# NOTE: Delve uses TCP-based DAP connections rather than stdin/stdout.
# This test requires TCP-based DAP adapter support to be implemented.
# Currently expected to fail until that feature is added.
name: "Go Complex Variable Verification"
description: "Verifies Go debugging with Delve: variables, types, stepping, and expressions"
# Compile the test program with debug info (disable optimizations and inlining)
setup:
- shell: "go build -gcflags='all=-N -l' -o tests/fixtures/test_simple_go tests/fixtures/simple.go"
# Debug target configuration
target:
program: "../fixtures/test_simple_go"
args:
adapter: "go"
stop_on_entry: true
# Test steps
steps:
# 1. Set a breakpoint at main.main
- action: command
command: "break main.main"
expect:
success: true
# 2. Set a breakpoint in the add function
- action: command
command: "break main.add"
expect:
success: true
# 3. Continue to main
- action: command
command: "continue"
- action: await
timeout: 10
expect:
reason: "breakpoint"
file: "simple.go"
# 4. Step to initialize x
- action: command
command: "next"
- action: await
timeout: 10
expect:
reason: "step"
# 5. Step to initialize y
- action: command
command: "next"
- action: await
timeout: 10
expect:
reason: "step"
# 6. Step past y initialization to make it visible
- action: command
command: "next"
- action: await
timeout: 10
expect:
reason: "step"
# 7. Check local variables x and y
- action: inspect_locals
asserts:
- name: "x"
value_contains: "10"
- name: "y"
value_contains: "20"
# 8. Continue to add function breakpoint
- action: command
command: "continue"
- action: await
timeout: 10
expect:
reason: "breakpoint"
# 9. Check function arguments in add
- action: inspect_locals
asserts:
- name: "a"
value_contains: "10"
- name: "b"
value_contains: "20"
# 10. Check the stack trace
- action: inspect_stack
asserts:
- index: 0
function: "main.add"
- index: 1
function: "main.main"
# 11. Step to compute result
- action: command
command: "next"
- action: await
timeout: 10
expect:
reason: "step"
# 12. Step past result assignment to make it visible
- action: command
command: "next"
- action: await
timeout: 10
expect:
reason: "step"
# 13. Verify result variable
- action: inspect_locals
asserts:
- name: "result"
value_contains: "30"
# 14. Evaluate an expression
- action: evaluate
expression: "a * b"
expect:
result_contains: "200"
# 15. Continue to exit (Delve sends "terminated" event)
- action: command
command: "continue"
- action: await
timeout: 15
expect:
reason: "terminated"