This example session will introduce you to basic debug commands.
You must first collect the example source files
and Makefile and build the executable galaxyf. This
example code is a small demonstration program that does NX message
passing.
Starting debug
Change your directory so that you are present in the directory where
the example executable is located.
debug should come up, pause while loading the processes, and
then display the debug prompt containing the default context.
If the source files for the example are in a different directory,
add that directory to the source search path list with the
use command: use + galaxy
Setting Context and Viewing Process State
The context defines the set of processes to which a command is applied.
The default context displayed in the prompt can be changed by issuing the
context command
with a new context argument.
Change the context to include only 1 process and then change it back
again: context(1) context(all)
Most commands allow a context specification which causes the context to
change only for the single command.
The state of the processes can be determined using the
process command.
Display the state of the processes immediately after loading: process
Viewing Source and Setting Breakpoints
A line numbered source code listing is given by the
list command. You can see the line
you are currently stopped at by entering: list
Entering list again will continue listing from where the previous
list left off: list
Now list the lines where we will be setting some breakpoints: list 40
Set breakpoints on lines 44, 46, and 48 using the
stop command as follows: stop 44; stop 46; stop 48
Use the
status command to
confirm the breakpoints are set: status
Now execute the program with the
cont command as follows: cont;wait
Note the use of the wait command in conjunction with cont
which allows any program terminal I/O to occur.
Shortly, a process state display will appear (caused by the wait)
which shows processes stopped at lines 44, 46, and 48.
The context indicates which processes' are stopped at each breakpoint.
Viewing Data
The contents of a variable is displayed using the
print command.
Print the value of a variable: print my_node
The data values are unique for each process, so each is listed
separately.
Print the first 5 elements of the receive buffer array: print recvLeft.fMessage,10
In this case the data values are the same across all of the nodes
so a single list is displayed.
Forcing Message Blocking Situation
Set a breakpoint on the message receive call in form.c
procedure Form() at line 20: stop `form`20
Resume execution of the program: cont;wait
After waiting awhile, you realize the program is taking longer than
expected to reach the breakpoint.
Interrupt the wait command: <Ctrl-C>
Check the state of the processes: process
Note that processes 2, 4, and 6 (for eight process load) have hit
the breakpoint while the other processes remain in the
Executing state.
The previously Executing processes should now be in
the Interrupted state as seen with the process command: process
Viewing the Stack
The call stack is displayed with the
where command: where
You can now determine that the processes you halted are stopped within a
routine that reflects a blocking receive was in progress.
You can view the source code for a particular function of interest
(e.g. to see the blocking call): list Form
Note that a window of lines is displayed in this case.
Viewing the Message Queue
Information about receives in progress is displayed with the
recvqueue command: recvqueue
Pending message information is viewed using the
sendqueue command: sendqueue
Exiting Debug
You can allow the program to finish executing at this point or
simply exit the debugger. To finish the execution, remove all of
the breakpoints using the
delete command
and continue the program: delete all cont; wait
To terminate the program and exit the debugger use the
quit command (or exit): quit