피드로 돌아가기
Dev.toInfrastructure
원문 읽기
Stripped Binary 환경의 C++ Crash 분석을 위한 결정론적 진단 워크플로우
Debugging Legacy C++ Crashes: Core Dumps, Symbols, addr2line, and GDB Explained
AI 요약
Context
Production 환경의 C++ 서비스에서 Symbol 제거(Stripping), ASLR 적용, ulimit 설정 제한으로 인한 Core Dump 부재 등 디버깅 제약 사항 발생. 로그와 Stack Trace가 없는 레거시 시스템의 비결정적 장애 분석 한계 직면.
Technical Solution
- Build ID 기반의 Symbol File 매칭을 통한 Stripped Binary의 런타임 컨텍스트 복구
- Base Address와 Crash Address 간의 Offset 계산을 통한 addr2line 기반 소스 코드 매핑
- Frame Pointer 유지(-fno-omit-frame-pointer) 설계를 통한 Backtrace 신뢰성 확보
- kernel.core_pattern 최적화를 통한 실행 파일명, PID, 타임스탬프 포함의 체계적 Core 파일 관리
- Symbol 부재 시 Register(rax, rdi 등) 분석 및 기계어 명령어(Instruction) 추론을 통한 Null Pointer Dereference 식별
실천 포인트
- ulimit -c unlimited 설정 및 /proc/sys/kernel/core_pattern 경로 및 권한 검증 - Release 빌드 시 -g 옵션 유지 후 Symbol 분리 저장 및 Build ID 기반 인덱싱 자동화 - -fno-omit-frame-pointer 적용을 통한 정확한 Call Stack 추적 환경 구축 - Staging 환경에서 의도적 Crash 유발을 통한 Core Dump 생성 및 분석 파이프라인 사전 검증