실행 중인 프로세스의 코어 덤프와 해당 심볼 테이블을 얻을 수 있습니까?
문제
실행 중인 프로세스의 코어 덤프와 심볼 테이블을 생성하기 위해 gdb를 얻거나 다른 도구를 사용할 수 있습니까?프로세스를 종료하지 않고 이를 수행할 수 있는 방법이 있다면 좋을 것입니다.
이것이 가능하다면 어떤 명령을 사용하시겠습니까?(Linux 박스에서 이 작업을 수행하려고 합니다.)
해결책
$ gdb --pid=26426 (gdb) gcore Saved corefile core.26426 (gdb) detach
다른 팁
아니면 달리세요 gcore $(pidof processname)
.
이는 가능한 가장 짧은 시간에 연결하고 분리할 수 있는 이점이 있습니다(gdb를 실행하고 CLI에 명령을 실행하는 것보다).
메모: 다음 방법은 실행 중인 프로세스를 종료하고 기호도 필요합니다.
다음 신호 중 하나(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에서 열 수 있습니다.
당신은 사용할 수 있습니다 generate-core-file
실행 중인 프로세스의 코어 덤프를 생성하는 gdb의 명령입니다.
제휴하지 않습니다 StackOverflow