用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/SWMFsoftware/FLEKS --skill debug-session命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | Debug Session |
| description | Set up and launch a debugging session for FLEKS using VS Code or lldb |
This skill helps set up and run debugging sessions for FLEKS.
DEBUGC flag in
Makefile.conf already includes -g)-O0 for best debuggability (check
OPT0–OPT4 in Makefile.conf)lldb (macOS default)The debug flags are configured in Makefile.conf (referenced via SWMF).
The default DEBUGC is -g -Wall -Wextra -Wno-unused-parameter, which
includes debug symbols. To ensure no optimization interferes, verify
OPT3 = -O0 in Makefile.conf.
The existing launch configuration is in .vscode/launch.json:
"cpp build and debug active file"${workspaceFolder}/../../run/SWMF.exe${workspaceFolder}/../../run/lldb on macOS (via osx.MIMode), gdb on Linux
(via linux.MIMode)"cpp build active file" (defined in
.vscode/tasks.json if present)F5 or go to Run → Start Debugging"cpp build and debug active file"Debug: Toggle Breakpoint commandcd ../../run
lldb ./SWMF.exe
| Command | Description |
|---|---|
b <file>:<line> | Set breakpoint at file:line |
b <function> | Set breakpoint at function |
r | Run program |
c | Continue execution |
n | Step over (next) |
s | Step into |
finish | Step out of function |
p <var> | Print variable value |
po <expr> | Print object / evaluate expression |
bt | Show backtrace |
frame select <n> | Select stack frame |
thread list | List all threads |
quit | Exit debugger |
cd ../../run
lldb ./SWMF.exe
(lldb) b Pic.cpp:100
(lldb) r
(lldb) p variableName
(lldb) bt
(lldb) c
For debugging parallel runs, you have several options:
# Run MPI program
cd ../../run
mpirun -np 4 ./SWMF.exe &
# Find process ID
ps aux | grep SWMF
# Attach lldb
lldb -p <pid>
mpirun -np 4 xterm -e lldb ./SWMF.exe
For many debugging scenarios, running with a single MPI process is the simplest approach:
cd ../../run
lldb -- mpirun -np 1 ./SWMF.exe
For physics simulations, useful things to watch:
tc.iCycle — Current simulation cycletc.timeSI — Simulation time in SI unitsnGst — Number of ghost cellsnodeE(iv, 0) for E_x)| Issue | Solution |
|---|---|
| No symbols | Rebuild with -g flag (default in DEBUGC) |
| Can't find source | Check sourceFileMap in launch.json or use settings set target.source-map in lldb |
| Breakpoint not hit | Verify code path is executed; check MPI rank |
| Variables optimized away | Set OPT3 = -O0 in Makefile.conf and rebuild |
| Fortran crash / backtrace | Add -fbacktrace to DEBUGFLAG in Makefile.conf (default on) |