Executing to a Selected Line
You do not have to set a breakpoint to stop execution at a specific line because TotalView lets you run your program to a selected line or machine instruction. After selecting the line on which you want the program to stop, invoke one of the eight Run To commands. These commands are located on the Group, Process, and Thread pulldowns.
The Run To commands do not work like the other group single-step commands. Here is what you should know if you are running at process width:
Process group
If the TOI is already at the goal location, TotalView steps the TOI past the line before the process is run. This allows you to use the Run To command repeatedly within loops.
Thread group
If any thread in the process is already at the goal. It is temporarily held while other threads in the process run. After all threads in the thread group reach the goal, TotalView stops the process. This allows you to synchronize the threads within the process of interest at a source line.
If you are running at group width:
Process group
TotalView examines each process in the process and share group to determine if at least one thread is already at the goal. If a thread is at the goal, TotalView holds its process. Other process are allowed to run. When at least one thread from each of these processes is held, the command completes. This lets you synchronize at least one thread in each of these processes at a source line. If you are running a control group, this synchronizes all processes in the share group.
Thread group
TotalView examines all the threads in the thread group that are in the same share group as the TOI to determine if a thread is already at the goal. If it is, TotalView holds it. Other threads are allowed to run. When all of the threads in the TOI's share group reach the goal, TotalView stops the TOI's control group and the command completes. This lets you synchronize thread group members. If you are running a workers group, this synchronizes all worker threads in the share group.
The process stops when the TOI and at least one thread from each process in the group or process reach the command stopping point. This lets you synchronize a group of processes and bring them to one location.
You can also run to a selected line in a nested stack frame, as follows:
- Select a nested frame in the Stack Trace Pane.
- Select a source line or instruction within the function.
- Issue a Run To command.
TotalView executes the primary thread until it reaches the selected line in the selected stack frame.
If your program calls recursive functions, you can select a nested stack frame in the Stack Trace Pane. In this situation, TotalView uses the frame pointer (FP) of the selected stack frame and the selected source line or instruction to determine when to stop execution. When your program reaches the selected line, TotalView compares the value of the selected FP to the value of the current FP:
- If the value of the current FP is deeper (more deeply nested) than the value of the selected FP, TotalView automatically continues your program.
- If the value of the current FP is equal or shallower (less deeply nested) than the value of the selected FP, TotalView stops your program.
If your program reaches a breakpoint while running to a selected line, the debugger discards the "run to" operation and stops at the breakpoint.