moai-adk 0.5.4__py3-none-any.whl → 0.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +1 -1
- moai_adk/cli/commands/init.py +4 -2
- moai_adk/cli/commands/status.py +4 -2
- moai_adk/cli/commands/update.py +4 -5
- moai_adk/core/project/initializer.py +13 -11
- moai_adk/core/project/phase_executor.py +7 -3
- moai_adk/core/template/processor.py +60 -1
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +8 -0
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +18 -0
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +18 -0
- moai_adk/templates/.claude/agents/alfred/git-manager.md +38 -2
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +18 -0
- moai_adk/templates/.claude/agents/alfred/project-manager.md +6 -0
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +6 -0
- moai_adk/templates/.claude/agents/alfred/skill-factory.md +8 -0
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +17 -0
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +7 -1
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +18 -0
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +6 -0
- moai_adk/templates/.claude/commands/alfred/0-project.md +5 -1
- moai_adk/templates/.claude/commands/alfred/1-plan.md +5 -1
- moai_adk/templates/.claude/commands/alfred/2-run.md +6 -2
- moai_adk/templates/.claude/commands/alfred/3-sync.md +5 -1
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +5 -1
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +5 -1
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +5 -1
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +5 -1
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +30 -273
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +487 -129
- moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +603 -70
- moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +22 -2
- moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +25 -5
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +152 -547
- moai_adk/templates/.claude/skills/moai-essentials-debug/examples.md +835 -878
- moai_adk/templates/.claude/skills/moai-essentials-debug/reference.md +665 -1151
- moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +138 -427
- moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +61 -53
- moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +99 -1181
- moai_adk/templates/.claude/skills/moai-spec-authoring/examples.md +541 -0
- moai_adk/templates/.claude/skills/moai-spec-authoring/reference.md +622 -0
- moai_adk/templates/.moai/config.json +5 -5
- moai_adk/templates/.moai/memory/CLAUDE-AGENTS-GUIDE.md +208 -0
- moai_adk/templates/.moai/memory/CLAUDE-PRACTICES.md +369 -0
- moai_adk/templates/.moai/memory/CLAUDE-RULES.md +539 -0
- moai_adk/templates/.moai/memory/{development-guide.md → DEVELOPMENT-GUIDE.md} +3 -3
- moai_adk/templates/.moai/memory/SKILLS-DESCRIPTION-POLICY.md +218 -0
- moai_adk/templates/.moai/memory/config-schema.md +444 -0
- moai_adk/templates/CLAUDE.md +149 -845
- {moai_adk-0.5.4.dist-info → moai_adk-0.5.6.dist-info}/METADATA +293 -335
- {moai_adk-0.5.4.dist-info → moai_adk-0.5.6.dist-info}/RECORD +61 -54
- /moai_adk/templates/.moai/memory/{gitflow-protection-policy.md → GITFLOW-PROTECTION-POLICY.md} +0 -0
- /moai_adk/templates/.moai/memory/{spec-metadata.md → SPEC-METADATA.md} +0 -0
- {moai_adk-0.5.4.dist-info → moai_adk-0.5.6.dist-info}/WHEEL +0 -0
- {moai_adk-0.5.4.dist-info → moai_adk-0.5.6.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.5.4.dist-info → moai_adk-0.5.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,61 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# moai-essentials-debug — 기술 레퍼런스
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
2. [JVM Ecosystem](#jvm-ecosystem)
|
|
6
|
-
3. [Scripting Languages](#scripting-languages)
|
|
7
|
-
4. [Web & Mobile](#web--mobile)
|
|
8
|
-
5. [Functional & Concurrency](#functional--concurrency)
|
|
9
|
-
6. [Enterprise & Data](#enterprise--data)
|
|
10
|
-
7. [Container & Distributed Systems](#container--distributed-systems)
|
|
3
|
+
> **Version**: 2.1.0
|
|
4
|
+
> **Last Updated**: 2025-10-27
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Systems Programming
|
|
6
|
+
이 문서는 moai-essentials-debug Skill의 상세한 기술 사양, 23개 언어별 디버거 설정, 컨테이너/분산 시스템 디버깅 가이드를 제공합니다.
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#### Installation
|
|
19
|
-
```bash
|
|
20
|
-
# Linux/macOS (usually pre-installed)
|
|
21
|
-
which gdb
|
|
8
|
+
---
|
|
22
9
|
|
|
23
|
-
|
|
24
|
-
brew install gdb
|
|
10
|
+
## 23개 언어별 디버거 매트릭스
|
|
25
11
|
|
|
26
|
-
|
|
27
|
-
sudo apt-get install gdb
|
|
12
|
+
### Systems Programming
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```
|
|
14
|
+
#### C/C++
|
|
15
|
+
**디버거**: GDB 14.x, LLDB 17.x, AddressSanitizer
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
**CLI 명령어**:
|
|
34
18
|
```bash
|
|
35
|
-
#
|
|
36
|
-
gdb ./
|
|
19
|
+
# GDB 기본 사용
|
|
20
|
+
gdb ./myapp
|
|
37
21
|
(gdb) break main
|
|
38
|
-
(gdb) run
|
|
39
|
-
(gdb)
|
|
40
|
-
(gdb)
|
|
41
|
-
(gdb)
|
|
42
|
-
(gdb) print var # Inspect variable
|
|
43
|
-
(gdb) backtrace # Stack trace
|
|
22
|
+
(gdb) run
|
|
23
|
+
(gdb) next
|
|
24
|
+
(gdb) print variable
|
|
25
|
+
(gdb) backtrace
|
|
44
26
|
|
|
45
|
-
#
|
|
46
|
-
|
|
27
|
+
# LLDB 사용
|
|
28
|
+
lldb ./myapp
|
|
29
|
+
(lldb) b main
|
|
30
|
+
(lldb) run
|
|
31
|
+
(lldb) n
|
|
32
|
+
(lldb) p variable
|
|
33
|
+
(lldb) bt
|
|
47
34
|
|
|
48
|
-
#
|
|
49
|
-
|
|
35
|
+
# AddressSanitizer (메모리 오류 감지)
|
|
36
|
+
gcc -fsanitize=address -g myapp.c -o myapp
|
|
37
|
+
./myapp
|
|
50
38
|
```
|
|
51
39
|
|
|
52
|
-
|
|
40
|
+
**VSCode launch.json**:
|
|
53
41
|
```json
|
|
54
42
|
{
|
|
55
43
|
"version": "0.2.0",
|
|
56
44
|
"configurations": [
|
|
57
45
|
{
|
|
58
|
-
"name": "C
|
|
46
|
+
"name": "C++ Debug",
|
|
59
47
|
"type": "cppdbg",
|
|
60
48
|
"request": "launch",
|
|
61
49
|
"program": "${workspaceFolder}/build/myapp",
|
|
@@ -77,232 +65,80 @@ gdb -p <pid>
|
|
|
77
65
|
}
|
|
78
66
|
```
|
|
79
67
|
|
|
80
|
-
####
|
|
81
|
-
|
|
82
|
-
# Watchpoints
|
|
83
|
-
watch variable_name # Break when variable changes
|
|
84
|
-
|
|
85
|
-
# Conditional breakpoints
|
|
86
|
-
break line_number if condition
|
|
87
|
-
|
|
88
|
-
# Memory inspection
|
|
89
|
-
x/10x address # Display 10 hex values at address
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
### C++
|
|
68
|
+
#### Rust
|
|
69
|
+
**디버거**: rust-lldb, rust-gdb, RUST_BACKTRACE
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
Same as C (gdb/lldb), plus sanitizers:
|
|
71
|
+
**CLI 명령어**:
|
|
98
72
|
```bash
|
|
99
|
-
#
|
|
100
|
-
g++ -fsanitize=address -g program.cpp -o program
|
|
101
|
-
|
|
102
|
-
# Valgrind for memory analysis
|
|
103
|
-
sudo apt-get install valgrind
|
|
104
|
-
brew install valgrind # macOS
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
#### CLI Usage
|
|
108
|
-
```bash
|
|
109
|
-
# GDB with C++ pretty-printers
|
|
110
|
-
gdb ./program
|
|
111
|
-
(gdb) set print pretty on
|
|
112
|
-
(gdb) set print object on
|
|
113
|
-
|
|
114
|
-
# LLDB
|
|
115
|
-
lldb ./program
|
|
116
|
-
(lldb) breakpoint set -n main
|
|
117
|
-
(lldb) process launch -- arg1 arg2
|
|
118
|
-
(lldb) thread backtrace
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
#### Valgrind Usage
|
|
122
|
-
```bash
|
|
123
|
-
# Memory leak detection
|
|
124
|
-
valgrind --leak-check=full --show-leak-kinds=all ./program
|
|
125
|
-
|
|
126
|
-
# Callgrind profiling
|
|
127
|
-
valgrind --tool=callgrind ./program
|
|
128
|
-
callgrind_annotate callgrind.out.<pid>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
#### VSCode Configuration
|
|
132
|
-
```json
|
|
133
|
-
{
|
|
134
|
-
"version": "0.2.0",
|
|
135
|
-
"configurations": [
|
|
136
|
-
{
|
|
137
|
-
"name": "C++: Debug",
|
|
138
|
-
"type": "cppdbg",
|
|
139
|
-
"request": "launch",
|
|
140
|
-
"program": "${workspaceFolder}/build/myapp",
|
|
141
|
-
"args": [],
|
|
142
|
-
"stopAtEntry": false,
|
|
143
|
-
"cwd": "${workspaceFolder}",
|
|
144
|
-
"environment": [],
|
|
145
|
-
"externalConsole": false,
|
|
146
|
-
"MIMode": "gdb",
|
|
147
|
-
"miDebuggerPath": "/usr/bin/gdb"
|
|
148
|
-
}
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
### Rust
|
|
156
|
-
|
|
157
|
-
#### Installation
|
|
158
|
-
```bash
|
|
159
|
-
# Installed with rustup (automatic)
|
|
160
|
-
rustup component add rust-src
|
|
161
|
-
rustup component add rust-analyzer
|
|
162
|
-
|
|
163
|
-
# VSCode extension
|
|
164
|
-
code --install-extension vadimcn.vscode-lldb
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### CLI Usage
|
|
168
|
-
```bash
|
|
169
|
-
# Run with backtrace
|
|
73
|
+
# 백트레이스 활성화
|
|
170
74
|
RUST_BACKTRACE=1 cargo run
|
|
171
|
-
RUST_BACKTRACE=full cargo run
|
|
75
|
+
RUST_BACKTRACE=full cargo run # 전체 백트레이스
|
|
172
76
|
|
|
173
|
-
#
|
|
174
|
-
cargo build
|
|
77
|
+
# rust-lldb 사용
|
|
175
78
|
rust-lldb target/debug/myapp
|
|
176
|
-
|
|
177
|
-
# In LLDB
|
|
178
79
|
(lldb) b main
|
|
179
|
-
(lldb)
|
|
180
|
-
|
|
80
|
+
(lldb) run
|
|
81
|
+
|
|
82
|
+
# rust-gdb 사용
|
|
83
|
+
rust-gdb target/debug/myapp
|
|
84
|
+
(gdb) break main
|
|
85
|
+
(gdb) run
|
|
181
86
|
```
|
|
182
87
|
|
|
183
|
-
|
|
88
|
+
**VSCode launch.json**:
|
|
184
89
|
```json
|
|
185
90
|
{
|
|
186
91
|
"version": "0.2.0",
|
|
187
92
|
"configurations": [
|
|
188
93
|
{
|
|
94
|
+
"name": "Rust Debug",
|
|
189
95
|
"type": "lldb",
|
|
190
96
|
"request": "launch",
|
|
191
|
-
"
|
|
192
|
-
"cargo": {
|
|
193
|
-
"args": [
|
|
194
|
-
"build",
|
|
195
|
-
"--bin=myapp",
|
|
196
|
-
"--package=myapp"
|
|
197
|
-
],
|
|
198
|
-
"filter": {
|
|
199
|
-
"name": "myapp",
|
|
200
|
-
"kind": "bin"
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
"args": [],
|
|
204
|
-
"cwd": "${workspaceFolder}"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"type": "lldb",
|
|
208
|
-
"request": "launch",
|
|
209
|
-
"name": "Debug unit tests",
|
|
210
|
-
"cargo": {
|
|
211
|
-
"args": [
|
|
212
|
-
"test",
|
|
213
|
-
"--no-run",
|
|
214
|
-
"--lib",
|
|
215
|
-
"--package=myapp"
|
|
216
|
-
],
|
|
217
|
-
"filter": {
|
|
218
|
-
"name": "myapp",
|
|
219
|
-
"kind": "lib"
|
|
220
|
-
}
|
|
221
|
-
},
|
|
97
|
+
"program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
|
|
222
98
|
"args": [],
|
|
223
|
-
"cwd": "${workspaceFolder}"
|
|
99
|
+
"cwd": "${workspaceFolder}",
|
|
100
|
+
"env": {
|
|
101
|
+
"RUST_BACKTRACE": "1"
|
|
102
|
+
}
|
|
224
103
|
}
|
|
225
104
|
]
|
|
226
105
|
}
|
|
227
106
|
```
|
|
228
107
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
### Go
|
|
108
|
+
#### Go
|
|
109
|
+
**디버거**: Delve 1.22.x
|
|
232
110
|
|
|
233
|
-
|
|
111
|
+
**CLI 명령어**:
|
|
234
112
|
```bash
|
|
235
|
-
#
|
|
236
|
-
go install github.com/go-delve/delve/cmd/dlv@latest
|
|
237
|
-
|
|
238
|
-
# Verify
|
|
239
|
-
dlv version
|
|
240
|
-
|
|
241
|
-
# VSCode extension
|
|
242
|
-
code --install-extension golang.go
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
#### CLI Usage
|
|
246
|
-
```bash
|
|
247
|
-
# Debug main package
|
|
113
|
+
# Delve 디버깅
|
|
248
114
|
dlv debug
|
|
115
|
+
(dlv) break main.main
|
|
116
|
+
(dlv) continue
|
|
117
|
+
(dlv) next
|
|
118
|
+
(dlv) print variable
|
|
119
|
+
(dlv) goroutines # 고루틴 목록
|
|
120
|
+
(dlv) goroutine 1 # 특정 고루틴 전환
|
|
249
121
|
|
|
250
|
-
#
|
|
251
|
-
dlv debug -- --config=dev.json
|
|
252
|
-
|
|
253
|
-
# Debug tests
|
|
254
|
-
dlv test
|
|
255
|
-
|
|
256
|
-
# Attach to running process
|
|
122
|
+
# 실행 중인 프로세스에 연결
|
|
257
123
|
dlv attach <pid>
|
|
258
124
|
|
|
259
|
-
#
|
|
260
|
-
dlv
|
|
261
|
-
|
|
262
|
-
# In Delve
|
|
263
|
-
(dlv) break main.main
|
|
264
|
-
(dlv) continue
|
|
265
|
-
(dlv) print myVar
|
|
266
|
-
(dlv) goroutines # List all goroutines
|
|
267
|
-
(dlv) goroutine 5 bt # Stack trace for goroutine 5
|
|
125
|
+
# 테스트 디버깅
|
|
126
|
+
dlv test -- -test.run TestName
|
|
268
127
|
```
|
|
269
128
|
|
|
270
|
-
|
|
129
|
+
**VSCode launch.json**:
|
|
271
130
|
```json
|
|
272
131
|
{
|
|
273
132
|
"version": "0.2.0",
|
|
274
133
|
"configurations": [
|
|
275
134
|
{
|
|
276
|
-
"name": "
|
|
135
|
+
"name": "Go Debug",
|
|
277
136
|
"type": "go",
|
|
278
137
|
"request": "launch",
|
|
279
|
-
"mode": "
|
|
138
|
+
"mode": "debug",
|
|
280
139
|
"program": "${workspaceFolder}",
|
|
281
140
|
"env": {},
|
|
282
141
|
"args": []
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
"name": "Launch File",
|
|
286
|
-
"type": "go",
|
|
287
|
-
"request": "launch",
|
|
288
|
-
"mode": "debug",
|
|
289
|
-
"program": "${file}"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"name": "Attach to Process",
|
|
293
|
-
"type": "go",
|
|
294
|
-
"request": "attach",
|
|
295
|
-
"mode": "local",
|
|
296
|
-
"processId": "${command:pickProcess}"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"name": "Connect to Remote",
|
|
300
|
-
"type": "go",
|
|
301
|
-
"request": "attach",
|
|
302
|
-
"mode": "remote",
|
|
303
|
-
"remotePath": "/app",
|
|
304
|
-
"port": 2345,
|
|
305
|
-
"host": "localhost"
|
|
306
142
|
}
|
|
307
143
|
]
|
|
308
144
|
}
|
|
@@ -310,1224 +146,902 @@ dlv debug --headless --listen=:2345 --api-version=2
|
|
|
310
146
|
|
|
311
147
|
---
|
|
312
148
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
### Java
|
|
149
|
+
### JVM Ecosystem
|
|
316
150
|
|
|
317
|
-
####
|
|
318
|
-
|
|
319
|
-
# JDB comes with JDK
|
|
320
|
-
java -version
|
|
321
|
-
jdb -version
|
|
322
|
-
|
|
323
|
-
# IntelliJ IDEA (recommended for GUI debugging)
|
|
324
|
-
# Download from jetbrains.com
|
|
325
|
-
```
|
|
151
|
+
#### Java
|
|
152
|
+
**디버거**: jdb, IntelliJ IDEA, Remote JDWP
|
|
326
153
|
|
|
327
|
-
|
|
154
|
+
**CLI 명령어**:
|
|
328
155
|
```bash
|
|
329
|
-
#
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
# Connect with JDB
|
|
333
|
-
jdb -attach localhost:5005
|
|
334
|
-
|
|
335
|
-
# JDB commands
|
|
336
|
-
> stop at ClassName:lineNumber
|
|
156
|
+
# jdb 사용
|
|
157
|
+
jdb -classpath . MyApp
|
|
158
|
+
> stop at MyClass:42
|
|
337
159
|
> run
|
|
338
160
|
> step
|
|
339
|
-
> next
|
|
340
161
|
> print variable
|
|
341
|
-
> locals
|
|
342
|
-
> where # Stack trace
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
#### Remote Debugging Setup
|
|
346
|
-
```bash
|
|
347
|
-
# Server side
|
|
348
|
-
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005 -jar app.jar
|
|
349
|
-
|
|
350
|
-
# Or with modern syntax
|
|
351
|
-
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar app.jar
|
|
352
|
-
```
|
|
353
162
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
{
|
|
357
|
-
"version": "0.2.0",
|
|
358
|
-
"configurations": [
|
|
359
|
-
{
|
|
360
|
-
"type": "java",
|
|
361
|
-
"name": "Debug (Launch)",
|
|
362
|
-
"request": "launch",
|
|
363
|
-
"mainClass": "com.example.Main",
|
|
364
|
-
"projectName": "myapp"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"type": "java",
|
|
368
|
-
"name": "Debug (Attach)",
|
|
369
|
-
"request": "attach",
|
|
370
|
-
"hostName": "localhost",
|
|
371
|
-
"port": 5005
|
|
372
|
-
}
|
|
373
|
-
]
|
|
374
|
-
}
|
|
163
|
+
# 원격 디버깅 활성화
|
|
164
|
+
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 MyApp
|
|
375
165
|
```
|
|
376
166
|
|
|
377
|
-
|
|
378
|
-
1. Run → Edit Configurations
|
|
379
|
-
2. Add New Configuration → Remote JVM Debug
|
|
380
|
-
3. Set host and port
|
|
381
|
-
4. Set breakpoints and click Debug
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
### Kotlin
|
|
386
|
-
|
|
387
|
-
#### Installation
|
|
388
|
-
Same as Java (uses JVM debug infrastructure)
|
|
389
|
-
|
|
390
|
-
#### CLI Usage
|
|
167
|
+
**원격 디버깅 설정**:
|
|
391
168
|
```bash
|
|
392
|
-
#
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
# Maven with debug
|
|
396
|
-
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005"
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
#### Coroutine Debugging
|
|
400
|
-
```kotlin
|
|
401
|
-
// Enable coroutine debugging
|
|
402
|
-
System.setProperty("kotlinx.coroutines.debug", "on")
|
|
403
|
-
|
|
404
|
-
// In IntelliJ IDEA:
|
|
405
|
-
// Run → Edit Configurations → VM Options:
|
|
406
|
-
-Dkotlinx.coroutines.debug
|
|
169
|
+
# IntelliJ/VSCode 원격 디버거 연결
|
|
170
|
+
Host: localhost
|
|
171
|
+
Port: 5005
|
|
407
172
|
```
|
|
408
173
|
|
|
409
|
-
####
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
### Scala
|
|
415
|
-
|
|
416
|
-
#### Installation
|
|
417
|
-
```bash
|
|
418
|
-
# sbt with debug support
|
|
419
|
-
sbt
|
|
420
|
-
|
|
421
|
-
# Metals language server (VSCode)
|
|
422
|
-
code --install-extension scalameta.metals
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
#### CLI Usage
|
|
426
|
-
```bash
|
|
427
|
-
# sbt with debug port
|
|
428
|
-
sbt -jvm-debug 5005
|
|
174
|
+
#### Kotlin
|
|
175
|
+
**디버거**: IntelliJ Kotlin Debugger, Coroutines Debugger
|
|
429
176
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
```json
|
|
436
|
-
{
|
|
437
|
-
"version": "0.2.0",
|
|
438
|
-
"configurations": [
|
|
439
|
-
{
|
|
440
|
-
"type": "scala",
|
|
441
|
-
"request": "launch",
|
|
442
|
-
"name": "Launch Scala App",
|
|
443
|
-
"mainClass": "com.example.Main",
|
|
444
|
-
"args": [],
|
|
445
|
-
"jvmOptions": []
|
|
446
|
-
}
|
|
447
|
-
]
|
|
177
|
+
**코루틴 디버깅**:
|
|
178
|
+
```kotlin
|
|
179
|
+
// 코루틴 디버그 정보 활성화
|
|
180
|
+
kotlinOptions {
|
|
181
|
+
freeCompilerArgs += ["-Xdebug"]
|
|
448
182
|
}
|
|
449
183
|
```
|
|
450
184
|
|
|
451
|
-
|
|
185
|
+
**IntelliJ 코루틴 뷰어**: View → Tool Windows → Kotlin Coroutines
|
|
452
186
|
|
|
453
|
-
|
|
187
|
+
#### Scala
|
|
188
|
+
**디버거**: IntelliJ Scala Plugin, sbt debug mode
|
|
454
189
|
|
|
455
|
-
|
|
190
|
+
**sbt 디버그 모드**:
|
|
456
191
|
```bash
|
|
457
|
-
#
|
|
458
|
-
|
|
459
|
-
# Ubuntu: see leiningen.org
|
|
460
|
-
|
|
461
|
-
# CIDER (Emacs)
|
|
462
|
-
# Add to ~/.emacs: (require 'cider)
|
|
463
|
-
|
|
464
|
-
# Cursive (IntelliJ)
|
|
465
|
-
# Install from JetBrains Marketplace
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
#### REPL-Based Debugging
|
|
469
|
-
```clojure
|
|
470
|
-
; Load file in REPL
|
|
471
|
-
(load-file "src/myapp/core.clj")
|
|
472
|
-
|
|
473
|
-
; Add breakpoints
|
|
474
|
-
(require '[clojure.tools.trace :as trace])
|
|
475
|
-
(trace/trace-ns 'myapp.core)
|
|
476
|
-
|
|
477
|
-
; Call function to see trace
|
|
478
|
-
(myapp.core/my-function arg1 arg2)
|
|
479
|
-
|
|
480
|
-
; Inspect vars
|
|
481
|
-
(def result (my-function arg1))
|
|
482
|
-
(println result)
|
|
192
|
+
# sbt 디버그 모드 실행
|
|
193
|
+
sbt -jvm-debug 5005 run
|
|
483
194
|
```
|
|
484
195
|
|
|
485
|
-
####
|
|
486
|
-
|
|
487
|
-
# project.clj
|
|
488
|
-
:plugins [[cider/cider-nrepl "0.30.0"]]
|
|
489
|
-
|
|
490
|
-
# Start REPL with debug
|
|
491
|
-
lein repl
|
|
196
|
+
#### Clojure
|
|
197
|
+
**디버거**: CIDER, Cursive, REPL-based debugging
|
|
492
198
|
|
|
493
|
-
|
|
494
|
-
|
|
199
|
+
**CIDER 디버깅**:
|
|
200
|
+
```clojure
|
|
201
|
+
;; 브레이크포인트 설정
|
|
202
|
+
#break
|
|
203
|
+
(defn my-function [x]
|
|
204
|
+
#break ; 여기서 중단
|
|
205
|
+
(+ x 1))
|
|
495
206
|
```
|
|
496
207
|
|
|
497
208
|
---
|
|
498
209
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
### Python
|
|
502
|
-
|
|
503
|
-
#### Installation
|
|
504
|
-
```bash
|
|
505
|
-
# pdb (built-in, no installation needed)
|
|
506
|
-
python3 -m pdb
|
|
507
|
-
|
|
508
|
-
# Enhanced debuggers
|
|
509
|
-
pip install pudb ipdb debugpy
|
|
210
|
+
### Scripting Languages
|
|
510
211
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
```
|
|
212
|
+
#### Python
|
|
213
|
+
**디버거**: pdb, debugpy 1.8.0, pudb (TUI)
|
|
514
214
|
|
|
515
|
-
|
|
215
|
+
**CLI 명령어**:
|
|
516
216
|
```bash
|
|
517
|
-
# pdb
|
|
217
|
+
# pdb 사용
|
|
518
218
|
python -m pdb script.py
|
|
519
|
-
(Pdb) break
|
|
219
|
+
(Pdb) break module.py:42
|
|
520
220
|
(Pdb) continue
|
|
521
|
-
(Pdb) step
|
|
522
221
|
(Pdb) next
|
|
523
|
-
(Pdb) print
|
|
524
|
-
(Pdb)
|
|
525
|
-
(Pdb) where # Stack trace
|
|
222
|
+
(Pdb) print(variable)
|
|
223
|
+
(Pdb) where # 스택 트레이스
|
|
526
224
|
|
|
527
|
-
# pudb
|
|
528
|
-
pudb script.py
|
|
225
|
+
# pudb TUI 디버거
|
|
226
|
+
python -m pudb script.py
|
|
529
227
|
|
|
530
|
-
#
|
|
531
|
-
|
|
228
|
+
# debugpy 원격 디버깅
|
|
229
|
+
python -m debugpy --listen 5678 script.py
|
|
532
230
|
```
|
|
533
231
|
|
|
534
|
-
|
|
232
|
+
**코드 내 브레이크포인트**:
|
|
535
233
|
```python
|
|
536
|
-
#
|
|
234
|
+
# 코드에서 pdb 시작
|
|
537
235
|
import pdb; pdb.set_trace()
|
|
538
236
|
|
|
539
|
-
# Python 3.7+
|
|
237
|
+
# Python 3.7+ breakpoint()
|
|
540
238
|
breakpoint()
|
|
541
|
-
|
|
542
|
-
# Remote debugging with debugpy
|
|
543
|
-
import debugpy
|
|
544
|
-
debugpy.listen(5678)
|
|
545
|
-
print("Waiting for debugger attach...")
|
|
546
|
-
debugpy.wait_for_client()
|
|
547
239
|
```
|
|
548
240
|
|
|
549
|
-
|
|
241
|
+
**VSCode launch.json**:
|
|
550
242
|
```json
|
|
551
243
|
{
|
|
552
244
|
"version": "0.2.0",
|
|
553
245
|
"configurations": [
|
|
554
246
|
{
|
|
555
|
-
"name": "Python
|
|
247
|
+
"name": "Python Debug",
|
|
556
248
|
"type": "debugpy",
|
|
557
249
|
"request": "launch",
|
|
558
250
|
"program": "${file}",
|
|
559
251
|
"console": "integratedTerminal",
|
|
560
252
|
"justMyCode": false
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
"name": "Python: Remote Attach",
|
|
564
|
-
"type": "debugpy",
|
|
565
|
-
"request": "attach",
|
|
566
|
-
"connect": {
|
|
567
|
-
"host": "localhost",
|
|
568
|
-
"port": 5678
|
|
569
|
-
},
|
|
570
|
-
"pathMappings": [
|
|
571
|
-
{
|
|
572
|
-
"localRoot": "${workspaceFolder}",
|
|
573
|
-
"remoteRoot": "/app"
|
|
574
|
-
}
|
|
575
|
-
]
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
"name": "Python: Django",
|
|
579
|
-
"type": "debugpy",
|
|
580
|
-
"request": "launch",
|
|
581
|
-
"program": "${workspaceFolder}/manage.py",
|
|
582
|
-
"args": ["runserver", "--noreload"],
|
|
583
|
-
"django": true
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
"name": "Python: Flask",
|
|
587
|
-
"type": "debugpy",
|
|
588
|
-
"request": "launch",
|
|
589
|
-
"module": "flask",
|
|
590
|
-
"env": {
|
|
591
|
-
"FLASK_APP": "app.py",
|
|
592
|
-
"FLASK_DEBUG": "1"
|
|
593
|
-
},
|
|
594
|
-
"args": ["run", "--no-debugger"],
|
|
595
|
-
"jinja": true
|
|
596
253
|
}
|
|
597
254
|
]
|
|
598
255
|
}
|
|
599
256
|
```
|
|
600
257
|
|
|
601
|
-
####
|
|
602
|
-
|
|
603
|
-
import asyncio
|
|
604
|
-
import pdb
|
|
605
|
-
|
|
606
|
-
async def debug_async():
|
|
607
|
-
await asyncio.sleep(1)
|
|
608
|
-
breakpoint() # Works in async context
|
|
609
|
-
await asyncio.sleep(1)
|
|
610
|
-
|
|
611
|
-
asyncio.run(debug_async())
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
---
|
|
615
|
-
|
|
616
|
-
### Ruby
|
|
617
|
-
|
|
618
|
-
#### Installation
|
|
619
|
-
```bash
|
|
620
|
-
# Ruby 3.2+ (built-in debug gem)
|
|
621
|
-
ruby -v
|
|
622
|
-
|
|
623
|
-
# For older versions
|
|
624
|
-
gem install debug
|
|
625
|
-
|
|
626
|
-
# Alternative debuggers
|
|
627
|
-
gem install byebug
|
|
628
|
-
gem install pry-byebug
|
|
629
|
-
|
|
630
|
-
# VSCode extension
|
|
631
|
-
code --install-extension Shopify.ruby-lsp
|
|
632
|
-
```
|
|
258
|
+
#### Ruby
|
|
259
|
+
**디버거**: debug gem (built-in), byebug, pry-byebug
|
|
633
260
|
|
|
634
|
-
|
|
261
|
+
**CLI 명령어**:
|
|
635
262
|
```bash
|
|
636
|
-
#
|
|
263
|
+
# Ruby 3.1+ 내장 디버거
|
|
637
264
|
ruby -r debug script.rb
|
|
265
|
+
debugger # 코드 내
|
|
638
266
|
|
|
639
|
-
#
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
byebug script.rb
|
|
645
|
-
|
|
646
|
-
# Commands
|
|
647
|
-
(rdbg) break script.rb:42
|
|
648
|
-
(rdbg) continue
|
|
649
|
-
(rdbg) step
|
|
650
|
-
(rdbg) next
|
|
651
|
-
(rdbg) display variable
|
|
652
|
-
(rdbg) backtrace
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
#### Rails Debugging
|
|
656
|
-
```ruby
|
|
657
|
-
# In controller/view
|
|
658
|
-
binding.break # Ruby 3.2+
|
|
659
|
-
byebug # Older versions
|
|
660
|
-
|
|
661
|
-
# Start Rails with debugger
|
|
662
|
-
rails server
|
|
663
|
-
# Trigger breakpoint, debugger opens in terminal
|
|
664
|
-
```
|
|
267
|
+
# byebug 사용
|
|
268
|
+
gem install byebug
|
|
269
|
+
# 코드 내에서
|
|
270
|
+
require 'byebug'
|
|
271
|
+
byebug
|
|
665
272
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
{
|
|
672
|
-
"name": "Debug Ruby",
|
|
673
|
-
"type": "rdbg",
|
|
674
|
-
"request": "launch",
|
|
675
|
-
"script": "${file}",
|
|
676
|
-
"args": [],
|
|
677
|
-
"useBundler": true
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
"name": "Debug Rails",
|
|
681
|
-
"type": "rdbg",
|
|
682
|
-
"request": "launch",
|
|
683
|
-
"command": "rails",
|
|
684
|
-
"script": "server",
|
|
685
|
-
"args": [],
|
|
686
|
-
"useBundler": true
|
|
687
|
-
}
|
|
688
|
-
]
|
|
689
|
-
}
|
|
273
|
+
# pry-byebug 사용
|
|
274
|
+
gem install pry-byebug
|
|
275
|
+
# 코드 내에서
|
|
276
|
+
require 'pry-byebug'
|
|
277
|
+
binding.pry
|
|
690
278
|
```
|
|
691
279
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
### PHP
|
|
695
|
-
|
|
696
|
-
#### Installation
|
|
697
|
-
```bash
|
|
698
|
-
# Xdebug (most common)
|
|
699
|
-
# Ubuntu/Debian
|
|
700
|
-
sudo apt-get install php-xdebug
|
|
701
|
-
|
|
702
|
-
# macOS with Homebrew
|
|
703
|
-
brew install php
|
|
704
|
-
pecl install xdebug
|
|
280
|
+
#### PHP
|
|
281
|
+
**디버거**: Xdebug 3.3.x, phpdbg
|
|
705
282
|
|
|
706
|
-
|
|
707
|
-
|
|
283
|
+
**Xdebug 설정** (php.ini):
|
|
284
|
+
```ini
|
|
285
|
+
[xdebug]
|
|
286
|
+
zend_extension=xdebug
|
|
708
287
|
xdebug.mode=debug
|
|
709
288
|
xdebug.start_with_request=yes
|
|
710
289
|
xdebug.client_port=9003
|
|
711
|
-
|
|
712
|
-
# VSCode extension
|
|
713
|
-
code --install-extension xdebug.php-debug
|
|
714
290
|
```
|
|
715
291
|
|
|
716
|
-
|
|
292
|
+
**phpdbg 사용**:
|
|
717
293
|
```bash
|
|
718
|
-
|
|
719
|
-
phpdbg
|
|
720
|
-
|
|
721
|
-
# phpdbg commands
|
|
722
|
-
phpdbg> break file.php:42
|
|
294
|
+
phpdbg -e script.php
|
|
295
|
+
phpdbg> break script.php:42
|
|
723
296
|
phpdbg> run
|
|
724
|
-
phpdbg> step
|
|
725
|
-
phpdbg> print $variable
|
|
726
|
-
|
|
727
|
-
# Xdebug from command line
|
|
728
|
-
php -dxdebug.mode=debug -dxdebug.start_with_request=yes script.php
|
|
729
297
|
```
|
|
730
298
|
|
|
731
|
-
####
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
"request": "launch",
|
|
740
|
-
"port": 9003,
|
|
741
|
-
"pathMappings": {
|
|
742
|
-
"/var/www/html": "${workspaceFolder}"
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
"name": "Launch current script",
|
|
747
|
-
"type": "php",
|
|
748
|
-
"request": "launch",
|
|
749
|
-
"program": "${file}",
|
|
750
|
-
"cwd": "${workspaceFolder}",
|
|
751
|
-
"port": 9003
|
|
752
|
-
}
|
|
753
|
-
]
|
|
754
|
-
}
|
|
299
|
+
#### Lua
|
|
300
|
+
**디버거**: ZeroBrane Studio, MobDebug
|
|
301
|
+
|
|
302
|
+
**MobDebug 사용**:
|
|
303
|
+
```lua
|
|
304
|
+
require("mobdebug").start()
|
|
305
|
+
-- 브레이크포인트
|
|
306
|
+
require("mobdebug").pause()
|
|
755
307
|
```
|
|
756
308
|
|
|
757
|
-
####
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
309
|
+
#### Shell (Bash)
|
|
310
|
+
**디버깅 모드**:
|
|
311
|
+
```bash
|
|
312
|
+
# 디버그 모드 실행
|
|
313
|
+
bash -x script.sh
|
|
761
314
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
315
|
+
# 스크립트 내 토글
|
|
316
|
+
set -x # 디버그 모드 활성화
|
|
317
|
+
# ... 코드 ...
|
|
318
|
+
set +x # 디버그 모드 비활성화
|
|
765
319
|
```
|
|
766
320
|
|
|
767
321
|
---
|
|
768
322
|
|
|
769
|
-
###
|
|
323
|
+
### Web & Mobile
|
|
324
|
+
|
|
325
|
+
#### JavaScript
|
|
326
|
+
**디버거**: Chrome DevTools, node --inspect
|
|
770
327
|
|
|
771
|
-
|
|
328
|
+
**Node.js 디버깅**:
|
|
772
329
|
```bash
|
|
773
|
-
#
|
|
774
|
-
|
|
330
|
+
# 디버그 모드 실행
|
|
331
|
+
node --inspect script.js
|
|
332
|
+
# 또는 첫 줄에서 중단
|
|
333
|
+
node --inspect-brk script.js
|
|
775
334
|
|
|
776
|
-
#
|
|
777
|
-
|
|
335
|
+
# Chrome DevTools 연결
|
|
336
|
+
chrome://inspect
|
|
337
|
+
```
|
|
778
338
|
|
|
779
|
-
|
|
780
|
-
|
|
339
|
+
**코드 내 브레이크포인트**:
|
|
340
|
+
```javascript
|
|
341
|
+
debugger; // 여기서 중단
|
|
781
342
|
```
|
|
782
343
|
|
|
783
|
-
####
|
|
784
|
-
|
|
785
|
-
-- MobDebug
|
|
786
|
-
local mobdebug = require('mobdebug')
|
|
787
|
-
mobdebug.start() -- Start debugging session
|
|
344
|
+
#### TypeScript
|
|
345
|
+
**디버거**: Chrome DevTools + Source Maps, VS Code
|
|
788
346
|
|
|
789
|
-
|
|
790
|
-
|
|
347
|
+
**tsconfig.json 소스맵 설정**:
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"compilerOptions": {
|
|
351
|
+
"sourceMap": true,
|
|
352
|
+
"inlineSources": true
|
|
353
|
+
}
|
|
354
|
+
}
|
|
791
355
|
```
|
|
792
356
|
|
|
793
|
-
|
|
357
|
+
**VSCode launch.json**:
|
|
794
358
|
```json
|
|
795
359
|
{
|
|
796
360
|
"version": "0.2.0",
|
|
797
361
|
"configurations": [
|
|
798
362
|
{
|
|
799
|
-
"name": "Debug
|
|
800
|
-
"type": "
|
|
363
|
+
"name": "TypeScript Debug",
|
|
364
|
+
"type": "node",
|
|
801
365
|
"request": "launch",
|
|
802
|
-
"program": "${
|
|
366
|
+
"program": "${workspaceFolder}/src/index.ts",
|
|
367
|
+
"preLaunchTask": "tsc: build - tsconfig.json",
|
|
368
|
+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
|
|
369
|
+
"sourceMaps": true
|
|
803
370
|
}
|
|
804
371
|
]
|
|
805
372
|
}
|
|
806
373
|
```
|
|
807
374
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
### Shell (Bash)
|
|
375
|
+
#### Dart/Flutter
|
|
376
|
+
**디버거**: Flutter DevTools, Hot Reload
|
|
811
377
|
|
|
812
|
-
|
|
378
|
+
**CLI 명령어**:
|
|
813
379
|
```bash
|
|
814
|
-
#
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
# Or in script
|
|
818
|
-
#!/bin/bash
|
|
819
|
-
set -x # Enable tracing
|
|
820
|
-
# ... code ...
|
|
821
|
-
set +x # Disable tracing
|
|
380
|
+
# Flutter 디버그 모드 실행
|
|
381
|
+
flutter run --debug
|
|
822
382
|
|
|
823
|
-
#
|
|
824
|
-
|
|
825
|
-
|
|
383
|
+
# DevTools 열기
|
|
384
|
+
flutter pub global activate devtools
|
|
385
|
+
flutter pub global run devtools
|
|
826
386
|
```
|
|
827
387
|
|
|
828
|
-
####
|
|
829
|
-
|
|
830
|
-
# Exit on error
|
|
831
|
-
set -e
|
|
832
|
-
|
|
833
|
-
# Exit on undefined variable
|
|
834
|
-
set -u
|
|
835
|
-
|
|
836
|
-
# Exit on pipe failure
|
|
837
|
-
set -o pipefail
|
|
388
|
+
#### Swift
|
|
389
|
+
**디버거**: LLDB (Xcode), Instruments
|
|
838
390
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
{
|
|
846
|
-
"version": "0.2.0",
|
|
847
|
-
"configurations": [
|
|
848
|
-
{
|
|
849
|
-
"name": "Bash-Debug",
|
|
850
|
-
"type": "bashdb",
|
|
851
|
-
"request": "launch",
|
|
852
|
-
"program": "${file}",
|
|
853
|
-
"cwd": "${workspaceFolder}",
|
|
854
|
-
"args": [],
|
|
855
|
-
"internalConsoleOptions": "openOnSessionStart"
|
|
856
|
-
}
|
|
857
|
-
]
|
|
858
|
-
}
|
|
391
|
+
**LLDB 사용**:
|
|
392
|
+
```bash
|
|
393
|
+
lldb MyApp.app
|
|
394
|
+
(lldb) breakpoint set --name viewDidLoad
|
|
395
|
+
(lldb) run
|
|
396
|
+
(lldb) po variable # Print Object
|
|
859
397
|
```
|
|
860
398
|
|
|
861
399
|
---
|
|
862
400
|
|
|
863
|
-
|
|
401
|
+
### Functional & Concurrency
|
|
864
402
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
#### Installation
|
|
868
|
-
```bash
|
|
869
|
-
# Built-in with Node.js
|
|
870
|
-
node --version
|
|
403
|
+
#### Haskell
|
|
404
|
+
**디버거**: GHCi debugger, Debug.Trace
|
|
871
405
|
|
|
872
|
-
|
|
406
|
+
**GHCi 디버깅**:
|
|
407
|
+
```haskell
|
|
408
|
+
-- GHCi에서
|
|
409
|
+
:break module.function
|
|
410
|
+
:trace expression
|
|
411
|
+
:step
|
|
412
|
+
:continue
|
|
873
413
|
```
|
|
874
414
|
|
|
875
|
-
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
node --inspect script.js
|
|
879
|
-
|
|
880
|
-
# Start with inspector and break at first line
|
|
881
|
-
node --inspect-brk script.js
|
|
882
|
-
|
|
883
|
-
# Connect with Chrome DevTools
|
|
884
|
-
# Navigate to chrome://inspect
|
|
415
|
+
**Debug.Trace 사용**:
|
|
416
|
+
```haskell
|
|
417
|
+
import Debug.Trace
|
|
885
418
|
|
|
886
|
-
|
|
887
|
-
node inspect script.js
|
|
888
|
-
debug> cont
|
|
889
|
-
debug> next
|
|
890
|
-
debug> step
|
|
891
|
-
debug> repl # Evaluate expressions
|
|
419
|
+
myFunction x = trace ("x = " ++ show x) $ x + 1
|
|
892
420
|
```
|
|
893
421
|
|
|
894
|
-
####
|
|
895
|
-
|
|
896
|
-
// Trigger debugger breakpoint
|
|
897
|
-
debugger;
|
|
422
|
+
#### Elixir
|
|
423
|
+
**디버거**: IEx debugger, :observer.start()
|
|
898
424
|
|
|
899
|
-
|
|
900
|
-
```
|
|
425
|
+
**IEx 디버깅**:
|
|
426
|
+
```elixir
|
|
427
|
+
# 코드 내
|
|
428
|
+
require IEx
|
|
429
|
+
IEx.pry()
|
|
901
430
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
{
|
|
905
|
-
"version": "0.2.0",
|
|
906
|
-
"configurations": [
|
|
907
|
-
{
|
|
908
|
-
"type": "node",
|
|
909
|
-
"request": "launch",
|
|
910
|
-
"name": "Launch Program",
|
|
911
|
-
"skipFiles": ["<node_internals>/**"],
|
|
912
|
-
"program": "${workspaceFolder}/app.js"
|
|
913
|
-
},
|
|
914
|
-
{
|
|
915
|
-
"type": "node",
|
|
916
|
-
"request": "attach",
|
|
917
|
-
"name": "Attach",
|
|
918
|
-
"port": 9229,
|
|
919
|
-
"skipFiles": ["<node_internals>/**"]
|
|
920
|
-
},
|
|
921
|
-
{
|
|
922
|
-
"name": "Jest Tests",
|
|
923
|
-
"type": "node",
|
|
924
|
-
"request": "launch",
|
|
925
|
-
"runtimeArgs": [
|
|
926
|
-
"--inspect-brk",
|
|
927
|
-
"${workspaceFolder}/node_modules/.bin/jest",
|
|
928
|
-
"--runInBand"
|
|
929
|
-
],
|
|
930
|
-
"console": "integratedTerminal"
|
|
931
|
-
}
|
|
932
|
-
]
|
|
933
|
-
}
|
|
431
|
+
# Observer 실행
|
|
432
|
+
:observer.start()
|
|
934
433
|
```
|
|
935
434
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
### TypeScript
|
|
435
|
+
#### Julia
|
|
436
|
+
**디버거**: Debugger.jl, Infiltrator.jl
|
|
939
437
|
|
|
940
|
-
|
|
941
|
-
```
|
|
942
|
-
|
|
943
|
-
npm install -D typescript ts-node @types/node
|
|
438
|
+
**Debugger.jl 사용**:
|
|
439
|
+
```julia
|
|
440
|
+
using Debugger
|
|
944
441
|
|
|
945
|
-
|
|
442
|
+
@enter myfunction(args)
|
|
443
|
+
# 또는
|
|
444
|
+
@bp # 브레이크포인트
|
|
946
445
|
```
|
|
947
446
|
|
|
948
|
-
####
|
|
949
|
-
|
|
950
|
-
# Compile with source maps
|
|
951
|
-
npx tsc --sourceMap
|
|
447
|
+
#### R
|
|
448
|
+
**디버거**: browser(), debug(), RStudio Debugger
|
|
952
449
|
|
|
953
|
-
|
|
954
|
-
|
|
450
|
+
**CLI 명령어**:
|
|
451
|
+
```r
|
|
452
|
+
# 함수 디버깅
|
|
453
|
+
debug(my_function)
|
|
454
|
+
my_function(args)
|
|
955
455
|
|
|
956
|
-
#
|
|
957
|
-
|
|
958
|
-
```
|
|
456
|
+
# 코드 내 브레이크포인트
|
|
457
|
+
browser()
|
|
959
458
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
{
|
|
963
|
-
"compilerOptions": {
|
|
964
|
-
"sourceMap": true,
|
|
965
|
-
"outDir": "./dist",
|
|
966
|
-
"rootDir": "./src"
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
```
|
|
970
|
-
|
|
971
|
-
#### VSCode Configuration
|
|
972
|
-
```json
|
|
973
|
-
{
|
|
974
|
-
"version": "0.2.0",
|
|
975
|
-
"configurations": [
|
|
976
|
-
{
|
|
977
|
-
"type": "node",
|
|
978
|
-
"request": "launch",
|
|
979
|
-
"name": "TypeScript: Current File",
|
|
980
|
-
"runtimeArgs": ["-r", "ts-node/register"],
|
|
981
|
-
"args": ["${file}"],
|
|
982
|
-
"cwd": "${workspaceFolder}",
|
|
983
|
-
"protocol": "inspector"
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
"type": "node",
|
|
987
|
-
"request": "launch",
|
|
988
|
-
"name": "TypeScript: Jest",
|
|
989
|
-
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
|
990
|
-
"args": ["--runInBand"],
|
|
991
|
-
"console": "integratedTerminal"
|
|
992
|
-
}
|
|
993
|
-
]
|
|
994
|
-
}
|
|
459
|
+
# 디버그 모드 해제
|
|
460
|
+
undebug(my_function)
|
|
995
461
|
```
|
|
996
462
|
|
|
997
463
|
---
|
|
998
464
|
|
|
999
|
-
###
|
|
1000
|
-
|
|
1001
|
-
#### Installation
|
|
1002
|
-
```bash
|
|
1003
|
-
# Install Flutter SDK
|
|
1004
|
-
# flutter.dev/docs/get-started/install
|
|
465
|
+
### Enterprise & Data
|
|
1005
466
|
|
|
1006
|
-
#
|
|
1007
|
-
|
|
1008
|
-
```
|
|
467
|
+
#### C#
|
|
468
|
+
**디버거**: Visual Studio Debugger, Rider, vsdbg
|
|
1009
469
|
|
|
1010
|
-
|
|
470
|
+
**vsdbg 사용** (Linux/macOS):
|
|
1011
471
|
```bash
|
|
1012
|
-
#
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
# Attach to running app
|
|
1016
|
-
flutter attach
|
|
1017
|
-
|
|
1018
|
-
# Dart VM Observatory
|
|
1019
|
-
# Opens in browser automatically
|
|
1020
|
-
|
|
1021
|
-
# Hot reload
|
|
1022
|
-
r # Reload
|
|
1023
|
-
R # Hot restart
|
|
472
|
+
# vsdbg 설치
|
|
473
|
+
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/.vsdbg
|
|
1024
474
|
```
|
|
1025
475
|
|
|
1026
|
-
|
|
476
|
+
**VSCode launch.json**:
|
|
1027
477
|
```json
|
|
1028
478
|
{
|
|
1029
479
|
"version": "0.2.0",
|
|
1030
480
|
"configurations": [
|
|
1031
481
|
{
|
|
1032
|
-
"name": "
|
|
482
|
+
"name": ".NET Core Debug",
|
|
483
|
+
"type": "coreclr",
|
|
1033
484
|
"request": "launch",
|
|
1034
|
-
"
|
|
1035
|
-
"
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
"name": "Flutter: Attach",
|
|
1039
|
-
"request": "attach",
|
|
1040
|
-
"type": "dart"
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
"name": "Dart: Tests",
|
|
1044
|
-
"request": "launch",
|
|
1045
|
-
"type": "dart",
|
|
1046
|
-
"program": "test/"
|
|
485
|
+
"program": "${workspaceFolder}/bin/Debug/net8.0/MyApp.dll",
|
|
486
|
+
"args": [],
|
|
487
|
+
"cwd": "${workspaceFolder}",
|
|
488
|
+
"stopAtEntry": false
|
|
1047
489
|
}
|
|
1048
490
|
]
|
|
1049
491
|
}
|
|
1050
492
|
```
|
|
1051
493
|
|
|
1052
|
-
####
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
494
|
+
#### SQL
|
|
495
|
+
**디버거**: EXPLAIN ANALYZE, pg_stat_statements
|
|
496
|
+
|
|
497
|
+
**PostgreSQL 디버깅**:
|
|
498
|
+
```sql
|
|
499
|
+
-- 쿼리 플랜 분석
|
|
500
|
+
EXPLAIN ANALYZE SELECT * FROM users WHERE id = 1;
|
|
1057
501
|
|
|
1058
|
-
|
|
1059
|
-
|
|
502
|
+
-- 느린 쿼리 추적
|
|
503
|
+
CREATE EXTENSION pg_stat_statements;
|
|
504
|
+
SELECT * FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 10;
|
|
1060
505
|
```
|
|
1061
506
|
|
|
1062
507
|
---
|
|
1063
508
|
|
|
1064
|
-
|
|
509
|
+
## 컨테이너 디버깅 완전 가이드
|
|
1065
510
|
|
|
1066
|
-
|
|
511
|
+
### Docker 디버깅
|
|
512
|
+
|
|
513
|
+
#### 기본 디버깅 패턴
|
|
1067
514
|
```bash
|
|
1068
|
-
#
|
|
1069
|
-
|
|
515
|
+
# 1. 실행 중인 컨테이너에 접속
|
|
516
|
+
docker exec -it <container_name> /bin/sh
|
|
1070
517
|
|
|
1071
|
-
#
|
|
1072
|
-
|
|
518
|
+
# 2. 로그 확인
|
|
519
|
+
docker logs <container_name>
|
|
520
|
+
docker logs -f <container_name> # 실시간
|
|
1073
521
|
|
|
1074
|
-
#
|
|
1075
|
-
|
|
522
|
+
# 3. 컨테이너 상태 확인
|
|
523
|
+
docker inspect <container_name>
|
|
524
|
+
docker stats <container_name>
|
|
1076
525
|
```
|
|
1077
526
|
|
|
1078
|
-
####
|
|
1079
|
-
```bash
|
|
1080
|
-
# Build and debug
|
|
1081
|
-
swift build
|
|
1082
|
-
lldb .build/debug/MyApp
|
|
527
|
+
#### 언어별 원격 디버깅
|
|
1083
528
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
529
|
+
**Java (JDWP)**:
|
|
530
|
+
```dockerfile
|
|
531
|
+
# Dockerfile
|
|
532
|
+
ENV JAVA_TOOL_OPTIONS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'
|
|
533
|
+
EXPOSE 5005
|
|
1089
534
|
```
|
|
1090
535
|
|
|
1091
|
-
#### Xcode Debugging
|
|
1092
|
-
1. Set breakpoints in gutter
|
|
1093
|
-
2. Run (⌘+R) or Debug (⌘+Y)
|
|
1094
|
-
3. Use LLDB console in bottom pane
|
|
1095
|
-
4. View hierarchy debugger: Debug → View Debugging → Capture View Hierarchy
|
|
1096
|
-
|
|
1097
|
-
#### LLDB Configuration for Swift
|
|
1098
536
|
```bash
|
|
1099
|
-
#
|
|
1100
|
-
|
|
1101
|
-
settings set target.process.follow-fork-mode child
|
|
1102
|
-
settings set target.x86-disassembly-flavor intel
|
|
537
|
+
# 컨테이너 실행
|
|
538
|
+
docker run -p 5005:5005 -p 8080:8080 myapp
|
|
1103
539
|
```
|
|
1104
540
|
|
|
1105
|
-
|
|
541
|
+
**Python (debugpy)**:
|
|
542
|
+
```dockerfile
|
|
543
|
+
# Dockerfile
|
|
544
|
+
RUN pip install debugpy
|
|
545
|
+
ENV DEBUGPY_ENABLE=true
|
|
546
|
+
EXPOSE 5678
|
|
547
|
+
```
|
|
1106
548
|
|
|
1107
|
-
|
|
549
|
+
```python
|
|
550
|
+
# app.py
|
|
551
|
+
import debugpy
|
|
1108
552
|
|
|
1109
|
-
|
|
553
|
+
if os.environ.get('DEBUGPY_ENABLE'):
|
|
554
|
+
debugpy.listen(("0.0.0.0", 5678))
|
|
555
|
+
print("Debugger listening on port 5678")
|
|
556
|
+
```
|
|
1110
557
|
|
|
1111
|
-
#### Installation
|
|
1112
558
|
```bash
|
|
1113
|
-
#
|
|
1114
|
-
|
|
1115
|
-
|
|
559
|
+
# 컨테이너 실행
|
|
560
|
+
docker run -p 5678:5678 -p 8000:8000 myapp
|
|
561
|
+
```
|
|
1116
562
|
|
|
1117
|
-
|
|
1118
|
-
|
|
563
|
+
**Node.js (--inspect)**:
|
|
564
|
+
```dockerfile
|
|
565
|
+
# Dockerfile
|
|
566
|
+
EXPOSE 9229
|
|
567
|
+
CMD ["node", "--inspect=0.0.0.0:9229", "app.js"]
|
|
1119
568
|
```
|
|
1120
569
|
|
|
1121
|
-
#### GHCi Debugger
|
|
1122
570
|
```bash
|
|
1123
|
-
#
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
# Set breakpoint
|
|
1127
|
-
:break main
|
|
1128
|
-
:break MyModule.myFunction
|
|
1129
|
-
|
|
1130
|
-
# Run
|
|
1131
|
-
:main
|
|
1132
|
-
|
|
1133
|
-
# Step through
|
|
1134
|
-
:step
|
|
1135
|
-
:steplocal # Don't step into libraries
|
|
1136
|
-
:trace myFunction args
|
|
571
|
+
# 컨테이너 실행
|
|
572
|
+
docker run -p 9229:9229 -p 3000:3000 myapp
|
|
573
|
+
```
|
|
1137
574
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
575
|
+
**Go (Delve)**:
|
|
576
|
+
```dockerfile
|
|
577
|
+
# Dockerfile
|
|
578
|
+
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
|
579
|
+
EXPOSE 2345
|
|
580
|
+
CMD ["dlv", "debug", "--headless", "--listen=:2345", "--api-version=2", "--accept-multiclient"]
|
|
1142
581
|
```
|
|
1143
582
|
|
|
1144
|
-
#### Profiling
|
|
1145
583
|
```bash
|
|
1146
|
-
#
|
|
1147
|
-
|
|
584
|
+
# 컨테이너 실행
|
|
585
|
+
docker run -p 2345:2345 -p 8080:8080 myapp
|
|
586
|
+
```
|
|
1148
587
|
|
|
1149
|
-
|
|
1150
|
-
|
|
588
|
+
#### 멀티스테이지 빌드 디버깅
|
|
589
|
+
```dockerfile
|
|
590
|
+
# 디버그 스테이지
|
|
591
|
+
FROM golang:1.22 AS debug
|
|
592
|
+
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
|
593
|
+
COPY . .
|
|
594
|
+
CMD ["dlv", "debug", "--headless", "--listen=:2345"]
|
|
1151
595
|
|
|
1152
|
-
#
|
|
1153
|
-
|
|
596
|
+
# 프로덕션 스테이지
|
|
597
|
+
FROM golang:1.22 AS production
|
|
598
|
+
COPY . .
|
|
599
|
+
RUN go build -o app
|
|
600
|
+
CMD ["./app"]
|
|
601
|
+
```
|
|
1154
602
|
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
603
|
+
```bash
|
|
604
|
+
# 디버그 빌드
|
|
605
|
+
docker build --target debug -t myapp:debug .
|
|
606
|
+
docker run -p 2345:2345 myapp:debug
|
|
1159
607
|
```
|
|
1160
608
|
|
|
1161
609
|
---
|
|
1162
610
|
|
|
1163
|
-
###
|
|
611
|
+
### Kubernetes 디버깅
|
|
1164
612
|
|
|
1165
|
-
####
|
|
613
|
+
#### 기본 디버깅 커맨드
|
|
1166
614
|
```bash
|
|
1167
|
-
#
|
|
1168
|
-
|
|
615
|
+
# 1. Pod 로그 확인
|
|
616
|
+
kubectl logs <pod-name>
|
|
617
|
+
kubectl logs -f <pod-name> # 실시간
|
|
618
|
+
kubectl logs <pod-name> -c <container-name> # 특정 컨테이너
|
|
619
|
+
kubectl logs <pod-name> --previous # 이전 컨테이너 로그
|
|
1169
620
|
|
|
1170
|
-
#
|
|
1171
|
-
|
|
621
|
+
# 2. Pod에 접속
|
|
622
|
+
kubectl exec -it <pod-name> -- /bin/sh
|
|
623
|
+
kubectl exec -it <pod-name> -c <container-name> -- /bin/bash
|
|
624
|
+
|
|
625
|
+
# 3. Pod 상태 확인
|
|
626
|
+
kubectl describe pod <pod-name>
|
|
627
|
+
kubectl get pod <pod-name> -o yaml
|
|
1172
628
|
```
|
|
1173
629
|
|
|
1174
|
-
####
|
|
1175
|
-
```
|
|
1176
|
-
#
|
|
1177
|
-
|
|
630
|
+
#### 포트 포워딩 (디버거 연결)
|
|
631
|
+
```bash
|
|
632
|
+
# Java JDWP
|
|
633
|
+
kubectl port-forward pod/<pod-name> 5005:5005
|
|
1178
634
|
|
|
1179
|
-
#
|
|
1180
|
-
:
|
|
635
|
+
# Python debugpy
|
|
636
|
+
kubectl port-forward pod/<pod-name> 5678:5678
|
|
1181
637
|
|
|
1182
|
-
#
|
|
1183
|
-
|
|
638
|
+
# Node.js --inspect
|
|
639
|
+
kubectl port-forward pod/<pod-name> 9229:9229
|
|
1184
640
|
|
|
1185
|
-
#
|
|
1186
|
-
|
|
641
|
+
# Go Delve
|
|
642
|
+
kubectl port-forward pod/<pod-name> 2345:2345
|
|
1187
643
|
```
|
|
1188
644
|
|
|
1189
|
-
####
|
|
1190
|
-
```
|
|
1191
|
-
#
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
# Trace calls
|
|
1195
|
-
:sys.trace(pid, true)
|
|
645
|
+
#### Ephemeral 컨테이너 (K8s 1.23+)
|
|
646
|
+
```bash
|
|
647
|
+
# 디버그 도구가 있는 임시 컨테이너 추가
|
|
648
|
+
kubectl debug -it <pod-name> --image=busybox --target=<container-name>
|
|
1196
649
|
|
|
1197
|
-
#
|
|
1198
|
-
|
|
650
|
+
# 또는 디버그 도구 이미지 사용
|
|
651
|
+
kubectl debug -it <pod-name> --image=nicolaka/netshoot --target=<container-name>
|
|
1199
652
|
```
|
|
1200
653
|
|
|
1201
|
-
####
|
|
1202
|
-
```
|
|
1203
|
-
#
|
|
1204
|
-
|
|
654
|
+
#### 네트워크 디버깅
|
|
655
|
+
```bash
|
|
656
|
+
# 네트워크 정책 확인
|
|
657
|
+
kubectl get networkpolicies
|
|
1205
658
|
|
|
1206
|
-
#
|
|
1207
|
-
|
|
659
|
+
# Service 엔드포인트 확인
|
|
660
|
+
kubectl get endpoints <service-name>
|
|
1208
661
|
|
|
1209
|
-
#
|
|
662
|
+
# DNS 확인 (Pod 내부에서)
|
|
663
|
+
kubectl exec -it <pod-name> -- nslookup <service-name>
|
|
1210
664
|
```
|
|
1211
665
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
### Julia
|
|
1215
|
-
|
|
1216
|
-
#### Installation
|
|
666
|
+
#### 리소스 디버깅
|
|
1217
667
|
```bash
|
|
1218
|
-
#
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
# Install debugger
|
|
1222
|
-
julia> using Pkg
|
|
1223
|
-
julia> Pkg.add("Debugger")
|
|
1224
|
-
julia> Pkg.add("Infiltrator")
|
|
668
|
+
# 리소스 사용량 확인
|
|
669
|
+
kubectl top pod <pod-name>
|
|
670
|
+
kubectl top node <node-name>
|
|
1225
671
|
|
|
1226
|
-
#
|
|
1227
|
-
|
|
672
|
+
# 이벤트 확인
|
|
673
|
+
kubectl get events --sort-by='.lastTimestamp'
|
|
674
|
+
kubectl get events --field-selector involvedObject.name=<pod-name>
|
|
1228
675
|
```
|
|
1229
676
|
|
|
1230
|
-
|
|
1231
|
-
```julia
|
|
1232
|
-
# Debugger.jl
|
|
1233
|
-
using Debugger
|
|
677
|
+
---
|
|
1234
678
|
|
|
1235
|
-
|
|
679
|
+
## 분산 추적 (Distributed Tracing)
|
|
1236
680
|
|
|
1237
|
-
|
|
1238
|
-
n # next
|
|
1239
|
-
s # step into
|
|
1240
|
-
finish # finish current function
|
|
1241
|
-
bt # backtrace
|
|
1242
|
-
```
|
|
681
|
+
### OpenTelemetry 1.24.0+ 설정
|
|
1243
682
|
|
|
1244
|
-
####
|
|
1245
|
-
```
|
|
1246
|
-
|
|
683
|
+
#### Python 설정
|
|
684
|
+
```python
|
|
685
|
+
from opentelemetry import trace
|
|
686
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
687
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
688
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
689
|
+
|
|
690
|
+
# Tracer Provider 설정
|
|
691
|
+
trace.set_tracer_provider(TracerProvider())
|
|
692
|
+
tracer = trace.get_tracer(__name__)
|
|
693
|
+
|
|
694
|
+
# OTLP Exporter 설정
|
|
695
|
+
otlp_exporter = OTLPSpanExporter(
|
|
696
|
+
endpoint="http://localhost:4317",
|
|
697
|
+
insecure=True
|
|
698
|
+
)
|
|
699
|
+
trace.get_tracer_provider().add_span_processor(
|
|
700
|
+
BatchSpanProcessor(otlp_exporter)
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
# 사용 예제
|
|
704
|
+
with tracer.start_as_current_span("my-operation"):
|
|
705
|
+
# 작업 수행
|
|
706
|
+
pass
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
#### TypeScript/Node.js 설정
|
|
710
|
+
```typescript
|
|
711
|
+
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
712
|
+
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
713
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
|
|
714
|
+
|
|
715
|
+
// Tracer Provider 설정
|
|
716
|
+
const provider = new NodeTracerProvider();
|
|
717
|
+
const exporter = new OTLPTraceExporter({
|
|
718
|
+
url: 'http://localhost:4317',
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
|
|
722
|
+
provider.register();
|
|
723
|
+
|
|
724
|
+
// 사용 예제
|
|
725
|
+
import { trace } from '@opentelemetry/api';
|
|
726
|
+
|
|
727
|
+
const tracer = trace.getTracer('my-service');
|
|
728
|
+
const span = tracer.startSpan('my-operation');
|
|
729
|
+
// 작업 수행
|
|
730
|
+
span.end();
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
#### Go 설정
|
|
734
|
+
```go
|
|
735
|
+
import (
|
|
736
|
+
"go.opentelemetry.io/otel"
|
|
737
|
+
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
|
738
|
+
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
|
739
|
+
)
|
|
740
|
+
|
|
741
|
+
// Tracer Provider 설정
|
|
742
|
+
exporter, _ := otlptracegrpc.New(ctx,
|
|
743
|
+
otlptracegrpc.WithEndpoint("localhost:4317"),
|
|
744
|
+
otlptracegrpc.WithInsecure(),
|
|
745
|
+
)
|
|
746
|
+
|
|
747
|
+
tp := sdktrace.NewTracerProvider(
|
|
748
|
+
sdktrace.WithBatcher(exporter),
|
|
749
|
+
)
|
|
750
|
+
otel.SetTracerProvider(tp)
|
|
751
|
+
|
|
752
|
+
// 사용 예제
|
|
753
|
+
tracer := otel.Tracer("my-service")
|
|
754
|
+
ctx, span := tracer.Start(ctx, "my-operation")
|
|
755
|
+
defer span.End()
|
|
756
|
+
```
|
|
1247
757
|
|
|
1248
|
-
|
|
1249
|
-
y = x * 2
|
|
1250
|
-
@infiltrate # Breakpoint
|
|
1251
|
-
z = y + 1
|
|
1252
|
-
return z
|
|
1253
|
-
end
|
|
758
|
+
---
|
|
1254
759
|
|
|
1255
|
-
|
|
1256
|
-
```
|
|
760
|
+
### Prometheus 2.48.x 통합
|
|
1257
761
|
|
|
1258
|
-
####
|
|
1259
|
-
```
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
762
|
+
#### Python (prometheus-client 0.19.0)
|
|
763
|
+
```python
|
|
764
|
+
from prometheus_client import Counter, Histogram, Gauge, start_http_server
|
|
765
|
+
|
|
766
|
+
# 메트릭 정의
|
|
767
|
+
request_count = Counter('http_requests_total', 'Total HTTP requests')
|
|
768
|
+
request_duration = Histogram('http_request_duration_seconds', 'HTTP request duration')
|
|
769
|
+
active_connections = Gauge('active_connections', 'Active connections')
|
|
770
|
+
|
|
771
|
+
# 사용 예제
|
|
772
|
+
request_count.inc()
|
|
773
|
+
with request_duration.time():
|
|
774
|
+
# 작업 수행
|
|
775
|
+
pass
|
|
776
|
+
active_connections.set(42)
|
|
777
|
+
|
|
778
|
+
# 메트릭 서버 시작 (포트 8000)
|
|
779
|
+
start_http_server(8000)
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
#### Go (prometheus/client_golang)
|
|
783
|
+
```go
|
|
784
|
+
import (
|
|
785
|
+
"github.com/prometheus/client_golang/prometheus"
|
|
786
|
+
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
var (
|
|
790
|
+
requestCount = prometheus.NewCounter(prometheus.CounterOpts{
|
|
791
|
+
Name: "http_requests_total",
|
|
792
|
+
Help: "Total HTTP requests",
|
|
793
|
+
})
|
|
794
|
+
|
|
795
|
+
requestDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
|
796
|
+
Name: "http_request_duration_seconds",
|
|
797
|
+
Help: "HTTP request duration",
|
|
798
|
+
})
|
|
799
|
+
)
|
|
800
|
+
|
|
801
|
+
func init() {
|
|
802
|
+
prometheus.MustRegister(requestCount)
|
|
803
|
+
prometheus.MustRegister(requestDuration)
|
|
1272
804
|
}
|
|
805
|
+
|
|
806
|
+
// 메트릭 엔드포인트
|
|
807
|
+
http.Handle("/metrics", promhttp.Handler())
|
|
1273
808
|
```
|
|
1274
809
|
|
|
1275
810
|
---
|
|
1276
811
|
|
|
1277
|
-
###
|
|
812
|
+
### Cloud Debugger 통합
|
|
1278
813
|
|
|
1279
|
-
####
|
|
1280
|
-
```
|
|
1281
|
-
|
|
1282
|
-
|
|
814
|
+
#### AWS X-Ray
|
|
815
|
+
```python
|
|
816
|
+
from aws_xray_sdk.core import xray_recorder
|
|
817
|
+
from aws_xray_sdk.ext.flask.middleware import XRayMiddleware
|
|
1283
818
|
|
|
1284
|
-
|
|
1285
|
-
|
|
819
|
+
app = Flask(__name__)
|
|
820
|
+
XRayMiddleware(app, xray_recorder)
|
|
1286
821
|
|
|
1287
|
-
#
|
|
1288
|
-
|
|
822
|
+
# 커스텀 서브세그먼트
|
|
823
|
+
@xray_recorder.capture('my_function')
|
|
824
|
+
def my_function():
|
|
825
|
+
# 작업 수행
|
|
826
|
+
pass
|
|
1289
827
|
```
|
|
1290
828
|
|
|
1291
|
-
####
|
|
1292
|
-
```
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
829
|
+
#### GCP Cloud Debugger
|
|
830
|
+
```python
|
|
831
|
+
try:
|
|
832
|
+
import googleclouddebugger
|
|
833
|
+
googleclouddebugger.enable()
|
|
834
|
+
except ImportError:
|
|
835
|
+
pass
|
|
836
|
+
```
|
|
1296
837
|
|
|
1297
|
-
|
|
1298
|
-
myFunction <- function(x) {
|
|
1299
|
-
browser() # Breakpoint
|
|
1300
|
-
result <- x * 2
|
|
1301
|
-
return(result)
|
|
1302
|
-
}
|
|
838
|
+
---
|
|
1303
839
|
|
|
1304
|
-
|
|
1305
|
-
n # next
|
|
1306
|
-
s # step into
|
|
1307
|
-
c # continue
|
|
1308
|
-
Q # quit
|
|
1309
|
-
```
|
|
840
|
+
## 성능 프로파일링
|
|
1310
841
|
|
|
1311
|
-
|
|
1312
|
-
1. Set breakpoints by clicking line numbers
|
|
1313
|
-
2. Source file with Debug button
|
|
1314
|
-
3. Use Debug menu: Debug → On Error → Break in Code
|
|
842
|
+
### CPU 프로파일링
|
|
1315
843
|
|
|
1316
|
-
####
|
|
1317
|
-
```
|
|
1318
|
-
#
|
|
1319
|
-
|
|
844
|
+
#### Python (cProfile, py-spy)
|
|
845
|
+
```bash
|
|
846
|
+
# cProfile
|
|
847
|
+
python -m cProfile -o output.prof script.py
|
|
848
|
+
python -m pstats output.prof
|
|
1320
849
|
|
|
1321
|
-
#
|
|
1322
|
-
|
|
1323
|
-
|
|
850
|
+
# py-spy (프로덕션 안전)
|
|
851
|
+
py-spy record -o profile.svg -- python script.py
|
|
852
|
+
py-spy top --pid <pid>
|
|
1324
853
|
```
|
|
1325
854
|
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
855
|
+
#### Go (pprof)
|
|
856
|
+
```go
|
|
857
|
+
import _ "net/http/pprof"
|
|
1329
858
|
|
|
1330
|
-
|
|
859
|
+
// HTTP 서버에 pprof 엔드포인트 자동 추가
|
|
860
|
+
go func() {
|
|
861
|
+
log.Println(http.ListenAndServe("localhost:6060", nil))
|
|
862
|
+
}()
|
|
863
|
+
```
|
|
1331
864
|
|
|
1332
|
-
#### Installation
|
|
1333
865
|
```bash
|
|
1334
|
-
#
|
|
1335
|
-
|
|
866
|
+
# CPU 프로파일 수집
|
|
867
|
+
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
|
|
1336
868
|
|
|
1337
|
-
#
|
|
1338
|
-
|
|
869
|
+
# 프로파일 분석
|
|
870
|
+
go tool pprof -http=:8080 cpu.prof
|
|
871
|
+
```
|
|
1339
872
|
|
|
1340
|
-
|
|
1341
|
-
|
|
873
|
+
#### Rust (flamegraph)
|
|
874
|
+
```toml
|
|
875
|
+
[dependencies]
|
|
876
|
+
pprof = { version = "0.13", features = ["flamegraph"] }
|
|
1342
877
|
```
|
|
1343
878
|
|
|
1344
|
-
#### CLI Usage
|
|
1345
879
|
```bash
|
|
1346
|
-
#
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
# In VSCode, use integrated debugger
|
|
880
|
+
# Flamegraph 생성
|
|
881
|
+
cargo flamegraph
|
|
1350
882
|
```
|
|
1351
883
|
|
|
1352
|
-
####
|
|
1353
|
-
1. Set breakpoints (F9)
|
|
1354
|
-
2. Start debugging (F5)
|
|
1355
|
-
3. Step over (F10), Step into (F11)
|
|
1356
|
-
4. Immediate Window for expression evaluation
|
|
1357
|
-
|
|
1358
|
-
#### Remote Debugging (vsdbg)
|
|
884
|
+
#### Java (JFR)
|
|
1359
885
|
```bash
|
|
1360
|
-
#
|
|
1361
|
-
|
|
886
|
+
# JFR 활성화
|
|
887
|
+
java -XX:+FlightRecorder -XX:StartFlightRecording=duration=60s,filename=recording.jfr MyApp
|
|
1362
888
|
|
|
1363
|
-
#
|
|
1364
|
-
|
|
1365
|
-
"name": ".NET Core Attach (Remote)",
|
|
1366
|
-
"type": "coreclr",
|
|
1367
|
-
"request": "attach",
|
|
1368
|
-
"processId": "${command:pickRemoteProcess}",
|
|
1369
|
-
"pipeTransport": {
|
|
1370
|
-
"pipeCwd": "${workspaceFolder}",
|
|
1371
|
-
"pipeProgram": "ssh",
|
|
1372
|
-
"pipeArgs": ["user@remote-host"],
|
|
1373
|
-
"debuggerPath": "~/vsdbg/vsdbg"
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
889
|
+
# JFR 파일 분석 (JDK Mission Control)
|
|
890
|
+
jmc recording.jfr
|
|
1376
891
|
```
|
|
1377
892
|
|
|
1378
893
|
---
|
|
1379
894
|
|
|
1380
|
-
###
|
|
1381
|
-
|
|
1382
|
-
#### PostgreSQL Debugging
|
|
1383
|
-
```sql
|
|
1384
|
-
-- Enable verbose error messages
|
|
1385
|
-
\set VERBOSITY verbose
|
|
895
|
+
### 메모리 프로파일링
|
|
1386
896
|
|
|
1387
|
-
|
|
1388
|
-
|
|
897
|
+
#### Python (memory_profiler, tracemalloc)
|
|
898
|
+
```python
|
|
899
|
+
from memory_profiler import profile
|
|
1389
900
|
|
|
1390
|
-
|
|
1391
|
-
|
|
901
|
+
@profile
|
|
902
|
+
def my_function():
|
|
903
|
+
# 작업 수행
|
|
904
|
+
pass
|
|
905
|
+
```
|
|
1392
906
|
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
log_duration = on
|
|
1396
|
-
log_min_duration_statement = 100 -- ms
|
|
907
|
+
```bash
|
|
908
|
+
python -m memory_profiler script.py
|
|
1397
909
|
```
|
|
1398
910
|
|
|
1399
|
-
|
|
1400
|
-
```
|
|
1401
|
-
|
|
1402
|
-
SHOW WARNINGS;
|
|
911
|
+
**tracemalloc (내장)**:
|
|
912
|
+
```python
|
|
913
|
+
import tracemalloc
|
|
1403
914
|
|
|
1404
|
-
|
|
1405
|
-
|
|
915
|
+
tracemalloc.start()
|
|
916
|
+
# 작업 수행
|
|
917
|
+
snapshot = tracemalloc.take_snapshot()
|
|
918
|
+
top_stats = snapshot.statistics('lineno')
|
|
1406
919
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
slow_query_log_file = /var/log/mysql/slow.log
|
|
1410
|
-
long_query_time = 1
|
|
920
|
+
for stat in top_stats[:10]:
|
|
921
|
+
print(stat)
|
|
1411
922
|
```
|
|
1412
923
|
|
|
1413
|
-
####
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
4. Execute function, debugger opens
|
|
924
|
+
#### Go (pprof heap)
|
|
925
|
+
```bash
|
|
926
|
+
# 힙 프로파일 수집
|
|
927
|
+
go tool pprof http://localhost:6060/debug/pprof/heap
|
|
1418
928
|
|
|
1419
|
-
|
|
929
|
+
# 메모리 할당 추적
|
|
930
|
+
go tool pprof http://localhost:6060/debug/pprof/allocs
|
|
931
|
+
```
|
|
1420
932
|
|
|
1421
|
-
|
|
933
|
+
#### C/C++ (Valgrind massif)
|
|
934
|
+
```bash
|
|
935
|
+
# Massif 실행
|
|
936
|
+
valgrind --tool=massif ./myapp
|
|
1422
937
|
|
|
1423
|
-
|
|
938
|
+
# Massif 시각화
|
|
939
|
+
ms_print massif.out.<pid>
|
|
940
|
+
```
|
|
1424
941
|
|
|
1425
|
-
####
|
|
942
|
+
#### Rust (heaptrack)
|
|
1426
943
|
```bash
|
|
1427
|
-
#
|
|
1428
|
-
|
|
944
|
+
# heaptrack 실행
|
|
945
|
+
heaptrack ./target/release/myapp
|
|
1429
946
|
|
|
1430
|
-
#
|
|
1431
|
-
|
|
947
|
+
# 결과 분석
|
|
948
|
+
heaptrack_gui heaptrack.myapp.<pid>.gz
|
|
1432
949
|
```
|
|
1433
950
|
|
|
1434
|
-
|
|
1435
|
-
```dockerfile
|
|
1436
|
-
# Python example
|
|
1437
|
-
FROM python:3.11
|
|
1438
|
-
RUN pip install debugpy
|
|
1439
|
-
EXPOSE 5678
|
|
1440
|
-
CMD ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "--wait-for-client", "app.py"]
|
|
1441
|
-
```
|
|
951
|
+
---
|
|
1442
952
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
953
|
+
## Advanced 디버깅 기법
|
|
954
|
+
|
|
955
|
+
### 조건부 브레이크포인트
|
|
1446
956
|
|
|
1447
|
-
|
|
957
|
+
**Python (pdb)**:
|
|
958
|
+
```python
|
|
959
|
+
# 조건부 브레이크포인트
|
|
960
|
+
(Pdb) break script.py:42, x > 100
|
|
1448
961
|
```
|
|
1449
962
|
|
|
1450
|
-
|
|
963
|
+
**GDB**:
|
|
1451
964
|
```bash
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
# Logs with timestamps
|
|
1456
|
-
docker logs --timestamps <container>
|
|
965
|
+
(gdb) break main.c:42 if x > 100
|
|
966
|
+
```
|
|
1457
967
|
|
|
1458
|
-
|
|
1459
|
-
|
|
968
|
+
**LLDB**:
|
|
969
|
+
```bash
|
|
970
|
+
(lldb) breakpoint set --file main.c --line 42 --condition 'x > 100'
|
|
1460
971
|
```
|
|
1461
972
|
|
|
1462
973
|
---
|
|
1463
974
|
|
|
1464
|
-
###
|
|
975
|
+
### 역방향 디버깅 (Time Travel Debugging)
|
|
1465
976
|
|
|
1466
|
-
|
|
977
|
+
**GDB 역방향 실행**:
|
|
1467
978
|
```bash
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
#
|
|
1472
|
-
|
|
979
|
+
(gdb) target record-full
|
|
980
|
+
(gdb) continue
|
|
981
|
+
# 오류 발생 후
|
|
982
|
+
(gdb) reverse-continue # 역방향 실행
|
|
983
|
+
(gdb) reverse-step
|
|
1473
984
|
```
|
|
1474
985
|
|
|
1475
|
-
|
|
986
|
+
**WinDbg Time Travel Debugging** (Windows):
|
|
1476
987
|
```bash
|
|
1477
|
-
#
|
|
1478
|
-
|
|
988
|
+
# TTD 트레이스 수집
|
|
989
|
+
ttd.exe -out trace.run myapp.exe
|
|
1479
990
|
|
|
1480
|
-
#
|
|
1481
|
-
|
|
991
|
+
# 트레이스 디버깅
|
|
992
|
+
windbg -z trace.run
|
|
1482
993
|
```
|
|
1483
994
|
|
|
1484
|
-
|
|
1485
|
-
```bash
|
|
1486
|
-
# Debug with temporary container
|
|
1487
|
-
kubectl debug -it myapp-pod --image=busybox --target=myapp
|
|
995
|
+
---
|
|
1488
996
|
|
|
1489
|
-
|
|
1490
|
-
kubectl debug myapp-pod -it --copy-to=myapp-debug --container=debug-tools --image=ubuntu
|
|
1491
|
-
```
|
|
997
|
+
### 동적 계측 (Dynamic Instrumentation)
|
|
1492
998
|
|
|
1493
|
-
|
|
999
|
+
**DTrace (macOS/FreeBSD)**:
|
|
1494
1000
|
```bash
|
|
1495
|
-
#
|
|
1496
|
-
|
|
1001
|
+
# 함수 호출 추적
|
|
1002
|
+
sudo dtrace -n 'pid$target::my_function:entry { printf("Called with arg=%d", arg0); }' -p <pid>
|
|
1003
|
+
```
|
|
1497
1004
|
|
|
1498
|
-
|
|
1499
|
-
|
|
1005
|
+
**SystemTap (Linux)**:
|
|
1006
|
+
```bash
|
|
1007
|
+
# 함수 호출 추적
|
|
1008
|
+
stap -e 'probe process("/path/to/binary").function("my_function") { println("Called") }'
|
|
1009
|
+
```
|
|
1500
1010
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1011
|
+
**BPF/eBPF (Linux)**:
|
|
1012
|
+
```bash
|
|
1013
|
+
# bpftrace 사용
|
|
1014
|
+
bpftrace -e 'uprobe:/path/to/binary:my_function { printf("Called\n"); }'
|
|
1503
1015
|
```
|
|
1504
1016
|
|
|
1505
1017
|
---
|
|
1506
1018
|
|
|
1507
|
-
|
|
1019
|
+
## Best Practices 요약
|
|
1508
1020
|
|
|
1509
|
-
|
|
1021
|
+
### 1. 디버거 선택
|
|
1022
|
+
- 언어에 적합한 디버거 사용 (Python → debugpy, Go → Delve)
|
|
1023
|
+
- 프로덕션 환경에서는 안전한 프로파일러 사용 (py-spy, async-profiler)
|
|
1510
1024
|
|
|
1511
|
-
|
|
1512
|
-
-
|
|
1513
|
-
-
|
|
1514
|
-
-
|
|
1515
|
-
- [ ] Instrument key operations with spans
|
|
1516
|
-
- [ ] Add span attributes for context
|
|
1517
|
-
- [ ] Propagate trace context across services
|
|
1025
|
+
### 2. 로깅 전략
|
|
1026
|
+
- 구조화된 로깅 사용 (JSON 형식)
|
|
1027
|
+
- 로그 레벨 적절히 설정 (DEBUG, INFO, WARNING, ERROR)
|
|
1028
|
+
- 분산 시스템에서는 Correlation ID 추가
|
|
1518
1029
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1030
|
+
### 3. 성능 고려
|
|
1031
|
+
- 디버그 심볼 포함 (-g 플래그)
|
|
1032
|
+
- 소스맵 생성 (TypeScript, JavaScript)
|
|
1033
|
+
- 프로파일링 전 워밍업 수행
|
|
1523
1034
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1035
|
+
### 4. 보안
|
|
1036
|
+
- 프로덕션 디버그 포트는 방화벽으로 보호
|
|
1037
|
+
- 민감 정보 로그에 기록 금지
|
|
1038
|
+
- 디버그 모드는 환경 변수로 제어
|
|
1526
1039
|
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1040
|
+
### 5. 자동화
|
|
1041
|
+
- CI/CD 파이프라인에 디버그 빌드 추가
|
|
1042
|
+
- 자동 스택 트레이스 수집 (Sentry, Rollbar)
|
|
1043
|
+
- 메트릭 자동 수집 (Prometheus, Datadog)
|
|
1530
1044
|
|
|
1531
1045
|
---
|
|
1532
1046
|
|
|
1533
|
-
|
|
1047
|
+
**End of Reference** | moai-essentials-debug v2.1.0
|