<< >> Title Contents Index Home Help

User Defined Events

Section 15.2.1.2 of the PGI User's Guide lists the PGDBG commands used to define events (breakpoints, watchpoints,...). These are user defined events. User defined events are Thread Level commands (See Thread Level Commands for details).

Breakpoints, by default, are set across all threads of all processes. A prefix p/t-set can be used to set breakpoints on specific processes and threads.

Example:
i)   pgdbg [all] 0> b 15
ii)  pgdbg [all] 0> [all] b 15
iii) pgdbg [all] 0> [0.1:3] b 15
i and ii are equivalent.  iii sets a breakpoint on threads 1,2,3 of process 0 only.

All other user events by default are set for the current thread only. A prefix p/t-set can be used to set user events on specific processes and threads.

Example:

i)  pgdbg [all] 0> watch glob
ii) pgdbg [all] 0> [*] watch glob
i sets a data breakpoint for glob on thread 0 only.  ii sets a data breakpoint for glob on all threads that are currently active. 

When a process or thread is created it inherits all of the breakpoints defined for it thus far. All other events must be defined after the process/thread is created. All processes must be stopped to add, enable, or disable a user event.

Many events contain 'if' and 'do' clauses.

Example:

pgdbg [all] 0> [*] break func if (glob!=0) do {set f = 0}

The breakpoint will fire only if glob is non-zero. The 'do' clause is executed if the breakpoint fires. The 'if' clause and the 'do' clause execute in the context of a single thread. The conditional in the 'if' and the body of the 'do' execute off of a single (same) thread; the thread that triggered the event. Think of the above definition as

[0] if (glob!=0) {[0] set f = 0}
[1] if (glob!=0) {[1] set f = 0}
...

When thread 1 hits func, glob is evaluated in the context of thread 1. If glob evaluates to non-zero, f is bound in the context of thread 1 and its value is set to 0.

Control commands can be used in 'do' clauses, however they only apply to the current thread, and are only well defined as the last command in the 'do' clause.

Example:

pgdbg [all] 0> [*] break func if (glob!=0) do {set f = 0; c}

If the wait command appears in a 'do' clause, the current thread is added to the wait set of the current process.


pgdbg [all] 0> [*] break func if (glob!=0) do {set f = 0; c; wait}

'if' conditionals and 'do' bodies cannot be parallelized with prefix p/t-sets.

Example:

pgdbg [all] 0> break func if (glob!=0) do {[*] set f = 0} ILLEGAL

This is illegal. The body of a 'do' statement cannot be parallelized.


<< >> Title Contents Index Home Help