Bureaucrats, cc_docs_admin, cc_staff
337
edits
Line 41: | Line 41: | ||
}} | }} | ||
Before you can debug you need to execute | Before you can debug you need to execute ''run'' in the prompt: | ||
{{Command | {{Command | ||
| | | | ||
Line 48: | Line 48: | ||
}} | }} | ||
PGDBG automatically attaches to new threads as they are created during program execution. PGDBG describes when a new thread is created. | PGDBG automatically attaches to new threads as they are created during program execution. PGDBG describes when a new thread is created. | ||
During a debug session, at any one time, PGDBG operates in the context of a single thread, the current thread. The current thread is chosen by using the ''thread'' command. The ''threads'' command lists all threads currently employed by an active program: | |||
{{Command|| result= | |||
pgdbg > threads | |||
0 ID PID STATE SIGNAL LOCATION | |||
3 18399 Stopped SIGTRAP main line: 31 in "omp.c" address: 0x80490ab | |||
=> 2 18398 Stopped SIGTRAP main line: 32 in "omp.c" address: 0x80490cf | |||
1 18397 Stopped SIGTRAP main line: 31 in "omp.c" address: 0x80490ab | |||
0 18395 Stopped SIGTRAP f line: 5 in "omp.c" address: 0x8048fa0 | |||
}} | |||
For example, now we switch the context to thread with ID 2. Use command ''thread'' to do so: | |||
{{Command ||result= | |||
pgdbg > thread 3 | |||
pgdbg > threads | |||
0 ID PID STATE SIGNAL LOCATION | |||
=> 3 18399 Stopped SIGTRAP main line: 31 in "omp.c" address: 0x80490ab | |||
2 18398 Stopped SIGTRAP main line: 32 in "omp.c" address: 0x80490cf | |||
1 18397 Stopped SIGTRAP main line: 31 in "omp.c" address: 0x80490ab | |||
0 18395 Stopped SIGTRAP f line: 5 in "omp.c" address: 0x8048fa0 | |||
}} | |||
== Graphical mode == | == Graphical mode == |