Salesforce

How to attach to a process using  gdb  to generate a stack

« Go Back

Information

 
TitleHow to attach to a process using  gdb  to generate a stack
URL NameP110651
Article Number000127977
EnvironmentUNIX
Progress/OpenEdge Product Family
Question/Problem Description
How to attach to a process using  gdb  to generate a stack
How to use the gdb debugger in Linux to attach to a process
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
Use the following steps to attach to a process and generate a stack:
1.  Run ps-elf | grep <process>
2.  Mark down the pid for the process to attach to
3.  Copy the full path to the process
4.  Run the following command which reads the symbols from the executable and attaches to the process ID in memory:
gdb <full path to process> <pid # of process>
example:
gdb /dlc/bin/_sqlsrv2 18227
5.  type the following at the gdb command prompt:
where
(this will display the stack)
6.  type the following at the gdb command prompt:
detach
(this will detach from process without causing the process to terminate)
7. type the following at the gdb command prompt:
q
(this will quit the debugger)

Note: Other ways to run gdb in batch mode are:

For a non multi-threaded process
gdb --pid=<PID> -ex "where" -ex "detach" -ex "quit" > PID_stack.txt

For multi-threaded processes
gdb --pid=<PID> -ex "thread apply all bt" -ex "detach" -ex "quit" > PID_stack.txt
 
Workaround
Notes
To get information on the threads for the attached process,  type the following at the gdb command prompt prior to detaching:
info threads
Reference to Written Documentation:

Man pages for the gdb debugger
Keyword Phrase
Last Modified Date6/6/2024 5:01 PM

Powered by