Gdb를 얻거나 다른 도구를 사용하여 실행중인 프로세스의 코어 덤프와 심볼 테이블을 만들 수 있습니까? 프로세스를 종료하지 않고이 작업을 수행 할 수있는 방법이 있다면 좋을 것입니다.
이것이 가능하다면 어떤 명령을 사용 하시겠습니까? (Linux 상자 에서이 작업을 수행하려고합니다)
$ gdb --pid = 26426 (gdb) gcore 저장된 코어 파일 core.26426 (gdb) 분리
또는 gcore $(pidof processname)
을 실행하십시오.
이는 가능한 짧은 시간 내에 연결 및 분리 할 수있는 이점 (gdb 실행 및 CLI에 명령 실행)을 제공합니다.
Gdb에서 generate-core-file
명령을 사용하여 실행중인 프로세스의 코어 덤프를 생성 할 수 있습니다.
참고 : 다음 방법은 실행중인 프로세스를 종료하고 기호도 필요합니다.
다음 신호 중 하나를 action = core와 함께 실행중인 프로세스로 보낼 수 있습니다.
보낸 사람 : http://man7.org/linux/man-pages/man7/signal.7.html
Signal Value Action Comment
──────────────────────────────────────────────────────────────────────
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no
readers
SIGALRM 14 Term Timer signal from alarm(2)
SIGTERM 15 Term Termination signal
SIGUSR1 30,10,16 Term User-defined signal 1
SIGUSR2 31,12,17 Term User-defined signal 2
SIGCHLD 20,17,18 Ign Child stopped or terminated
SIGCONT 19,18,25 Cont Continue if stopped
SIGSTOP 17,19,23 Stop Stop process
SIGTSTP 18,20,24 Stop Stop typed at terminal
SIGTTIN 21,21,26 Stop Terminal input for background process
SIGTTOU 22,22,27 Stop Terminal output for background process
이렇게 :kill <signal> <pid>
그리고 코어가 있으면 심볼 파일과 함께 gdb에서 열 수 있습니다.