LLDB CLI 스킬
이 CLI를 사용하여 JSON 출력으로 구조화된 LLDB 디버깅 워크플로를 실행하세요.
기능
- 실행 파일 경로에서 디버그 타겟 생성
- 프로세스 실행 또는 PID/이름으로 연결
- 중단점 관리 (설정/목록/삭제/활성화/비활성화)
- 스레드, 프레임, 지역 변수 및 역추적 검사
- 현재 프레임에서 표현식 평가
- 프로세스 메모리 읽기/찾기
- 코어 덤프 로드
- 지속적 세션 상태를 가진 대화형 REPL
- AI/에디터 클라이언트를 위한 공식 stdio Debug Adapter Protocol 서버
빠른 명령어
cli-anything-lldb --json target create --exe /path/to/exe
cli-anything-lldb --json process launch --arg foo --arg bar
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --function PluginEntry --allow-pending
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json thread backtrace --limit 20
cli-anything-lldb --json frame locals
cli-anything-lldb --json expr "myVar"
cli-anything-lldb --json memory read --address 0x1000 --size 64
cli-anything-lldb --json session close
Debug Adapter Protocol
AI 클라이언트가 개별 CLI 명령어를 외부 호출하는 대신 실제 디버그 어댑터 생명주기가 필요할 때 DAP 진입점을 사용하세요:
cli-anything-lldb-dap
cli-anything-lldb-dap --profile /path/to/stop-rules.json
또는:
cli-anything-lldb dap
cli-anything-lldb dap --profile /path/to/stop-rules.json
DAP 서버는 stdio Content-Length 프레임을 사용하며 stdout을 독점적으로 사용해야 합니다. 주변에 로그를 stdout으로 출력하지 마십시오. 지원되는 요청에는 initialize, launch, attach, configurationDone, setBreakpoints, setFunctionBreakpoints, threads, stackTrace, scopes, variables, setVariable, evaluate, continue, pause, next, stepIn, stepOut, source, loadedSources, readMemory, modules, exceptionInfo, disassemble, disconnect가 포함됩니다.
DAP 변수는 구조체/클래스/배열에 대한 자식 참조를 노출할 수 있습니다. setVariable은 정지 상태에서만 사용하세요. LLDB는 최적화된 값이나 읽기 전용 값에 대한 쓰기를 거부할 수 있습니다.
장기 실행 GUI 디버기(double)의 경우 DAP continue는 클라이언트 관점에서 비차단입니다. 어댑터는 먼저 응답과 continued 이벤트를 보낸 후 백그라운드 스레드에서 LLDB를 기다립니다. DAP pause는 LLDB 비동기 인터럽트를 사용합니다. 에이전트가 디버기 실행 중에 중단점을 변경해야 하는 경우 어댑터는 먼저 인터럽트하고 LLDB 중단점을 변경하기 전에 정지 상태를 기다립니다. 대상이 제 시간에 멈추지 않으면 명시적인 pause/stopped 주기 후에 재시도하세요.
디버거 내부 시작 또는 셰이더 JIT 중단점에서 중지되는 GUI 앱의 경우 launch 및 attach는 비표준 부울 인수 autoContinueInternalBreakpoints를 허용합니다. 내부 중지가 작업에 방해가 될 때만 활성화하세요. 어댑터는 자동 계속 전에 output 이벤트를 내보냅니다. 대상별 노이즈의 경우 인라인 stopRules 또는 외부 stopRuleProfile/--profile JSON 파일을 통한 구조화된 중지 규칙을 선호하세요. 규칙은 reason, module, function 및/또는 regex로 일치시킨 후 명확한 cliAnythingStop.origin 메타데이터와 함께 stop하거나 자동으로 continue할 수 있습니다. C4D와 같은 앱의 경우 NVIDIA 셰이더 JIT/시작 트랩이 일반 어댑터 외부에 있도록 프로필을 사용하세요.
DAP stopped 이벤트에는 body.cliAnythingStop.origin이 포함됩니다: 클라이언트 일시 중지 요청의 경우 manualPause, 일치하는 내부 규칙의 경우 internalTrap, 일반 프로그램 중지의 경우 debuggee입니다. 기존 cli-anything-lldb-dap 프로세스는 새 코드나 프로필 내용을 핫로드하지 않습니다. 새 규칙을 적용하려면 어댑터를 다시 시작하고 다시 연결하거나 다시 실행하세요.
명령어 그룹
target
cli-anything-lldb --json target create --exe /path/to/exe [--arch x86_64]
cli-anything-lldb --json target info
process
cli-anything-lldb --json process launch [--arg ARG ...] [--env KEY=VALUE ...] [--cwd DIR] [--stop-at-entry]
cli-anything-lldb --json process attach --pid 1234
cli-anything-lldb --json process attach --name myapp --wait-for
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json process detach
cli-anything-lldb --json process info
breakpoint
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --file main.c --line 42 --condition "i > 10"
cli-anything-lldb --json breakpoint set --function LateLoadedSymbol --allow-pending
cli-anything-lldb --json breakpoint list
cli-anything-lldb --json breakpoint delete --id 1
cli-anything-lldb --json breakpoint enable --id 1
cli-anything-lldb --json breakpoint disable --id 1
thread / frame / step
cli-anything-lldb --json thread list
cli-anything-lldb --json thread select --id 11111
cli-anything-lldb --json thread backtrace --limit 50
cli-anything-lldb --json frame select --index 0
cli-anything-lldb --json frame info
cli-anything-lldb --json frame locals
cli-anything-lldb --json step over
cli-anything-lldb --json step into
cli-anything-lldb --json step out
expr / memory / core
cli-anything-lldb --json expr "argc"
cli-anything-lldb --json memory read --address 0x1000 --size 128
cli-anything-lldb --json memory find "needle" --start 0x1000 --size 4096
cli-anything-lldb --json core load --path /path/to/core
에이전트 사용 참고 사항
- 모든 자동화된 흐름에는
--json을 사용하세요. - 비 REPL 호출은 기본적으로 지속적인 세션 데몬을 공유합니다.
--session-file PATH또는CLI_ANYTHING_LLDB_SESSION_FILE을 사용하여 작업에 명시적인 세션을 고정하세요.- 완료되면
cli-anything-lldb --json session close를 실행하여 연결된 프로세스가 분리되고 실행된 디버기가 정리되도록 하세요. - 지속성이 필요할 때가 아니라 인간형 대화형 셸이 더 편리할 때 REPL을 사용하세요.
- 해결되지 않은 CLI 중단점은 기본적으로 실패합니다. 향후 모듈/심볼 로드가 예상되는 경우에만
--allow-pending을 전달하세요. - DAP 해결되지 않은 중단점은 프로토콜 의미를 사용합니다: 해결될 때까지
verified: false. - DAP
continue는 장기 실행 GUI 프로세스의 경우 비차단이며, DAPpause는 비동기 인터럽트를 사용합니다. - 활성 continue 중 DAP 중단점 변경은 먼저 인터럽트하고 LLDB를 변경하기 전에 정지 상태를 기다립니다.
- 앱별 내부 트랩에 DAP 중지 규칙 프로필을 사용하세요. 프로필 변경 후 다시 시작하고 다시 연결/재실행하세요.
memory find는 청크 스캔을 사용하며 호출당 최대 1MiB로 제한됩니다.- 프로세스 또는 코어 명령어 전에
target create를 호출하세요. - 구조화된 오류를 예상하세요:
{"error": "...", "type": "..."}