TotalView Reference Guide : Part I: CLI Commands : Batch Debugging Using tvscript : tvscript Command Syntax : tvscript Options

tvscript Options
–create_actionpoint "source_location_expr [ =>action1 [, action2] ... ]"
Creates an action point at a source location using an expression. (See Action Point API” for writing expressions.) When the action point is hit, tvscript can trigger one or more actions. Add one –create_watchpoint command-line option for each action point.
See event_action for information about actions.
–event_action "event_action_list"
Performs an action when an event occurs. Events represent an unanticipated condition, such as free_not_allocated in the Memory Debugger. You can use more than one –event_action command-line option when invoking tvscript.
Here is how you enter an event_action_list :
event1=action1,event2=action2
or
event1=>action1,action2,action3
Supported tvscript Events:
Memory debugging event
The memory allocator returned a block not in the heap; the heap may be corrupt.
An allocation either failed or returned NULL; this usually means that the system is out of memory.
The memory allocator returned a misaligned block; the heap may be corrupt.
Program supplied an invalid alignment argument to the heap manager.
The memory allocator returned a block currently being used; the heap may be corrupt.
hoard_low_memory_­-threshold
Program attempted to reallocate an address that is not in the heap.
Program attempted to access memory beyond the end of an allocated block.
Program attempted to access memory before the start of an allocated block.
Program attempted to access a block of memory after it has been deallocated.
Program attempted to access memory beyond the end of a deallocated block.
Program attempted to access memory before the start of a deallocated block.
Source code debugging event
For each occurring event, define the action to perform:
Memory debugging actions
Generates and saves an HTML version of the Heap Status Source View Report.
save_memory_­debugging_file
Source code debugging actions
display_backtrace
[ level level-num ]
[ num_levels ]
[ options ]
–level level-num sets the level at which information starts being logged.
num_levels restricts output to this number of levels in the call stack.
If you do not set a level, tvscript displays all levels in the call stack.
options is one or more of the following:
–[no]show_arguments
–[no]show_fp
–[no]show_fp_registers
–[no]show_image
–[no]show_locals
–[no]show_pc
–[no]show_registers
print [ slice {slice_exp}]
{variable | exp}
Writes the value of a variable or an expression into the log file. If the variable is an array, the –slice option limits the amount of data defined by slice_exp. A slice expression is a way to define the slice, such as var[100:130] in C and C++. (This displays all values from var[100] to var[130].) To display every fourth value, add an additional argument; for example, var[100:130:4]. For additional information, see Chapter 14 Examining Arrays” in the TotalView User Guide.
–display_specifiers "display_specifiers_list"
By default, tvscript writes all of the information in the following table to the log file. You can exclude information by using one of the following specifiers:
Type of Specifier
Does not show the rank of a process, which is shown only for a parallel process
Memory debugging display specifiers
Does not show the Red Zone entries for allocations (and deallocations) for the address space
–memory_debugging
Enables memory debugging and memory event notification. This option is required with any option that begins with –mem. These options are TotalView command line options, as they can be invoked directly by TotalView.
–mem_detect_leaks
Performs leak detection before generating memory information.
–mem_detect_use_after_free
Tests for use after memory is freed.
–mem_guard_blocks
Adds guard blocks to an allocated memory block.
–mem_hoard_freed_memory
Holds onto freed memory rather than returning it to the heap.
–mem_hoard_low_memory_threshold nnnn
Sets the low memory threshold amount. When memory falls below this amount, an event is fired.
–mem_paint_all
Paints memory blocks with a bit pattern when a memory is allocated or deallocated.
–mem_paint_on_alloc
Paints memory blocks with a bit pattern when a memory block is allocated.
–mem_paint_on_dealloc
Paints memory blocks with a bit pattern when a memory block is deallocated.
–mem_red_zones_overruns
Turns on testing for Red Zone overruns.
–mem_red_zones_size_ranges min:max,min:max,...
Defines the memory allocations ranges for which Red Zones are in effect. Ranges can be specified as follows:
x:y allocations from x to y
:y allocations from 1 to y
x: allocations of x and higher
x allocation of x
–mem_red_zones_underruns
Turns on testing for Red Zone underruns.
–maxruntime "hh:mm:ss"
Specifies how long the script can run.
–script_file script_file
Names a file containing tvscript API calls and Tcl callback procedures that you create.
–script_log_filename logFilename
Overrides the name of the TVScript log file.
WARNING: Previous log files of the same name are overwritten.
–script_summary_log_filename summaryLogFilename
Overrides the name of the TVScript summary log file.
WARNING: Previous summary log files with the same name are overwritten.
tvscript Example:
The following example is similar to that shown in Batch Debugging Using tvscript”.
tvscript \
-create_actionpoint "method1=>display_backtrace -show_arguments" \
-create_actionpoint "method2#37=>display_backtrace -show_locals -level 1" \
-event_action "error=>display_backtrace -show_arguments -show_locals" \
-display_specifiers "noshow_pid,noshow_tid" \
-maxruntime "00:00:30" \
filterapp -a 20
This script performs the following actions:
*
Creates an action point at the beginning of method1. When tvscript reaches that breakpoint, it logs a backtrace and the method’s arguments.
*
Creates an action point at line 37 of method2. When tvscript reaches this line, it logs a backtrace and the local variables. The backtrace information starts at level 1.
*
*
*
Limits tvscript execution time to 30 sections.
*

Rogue Wave Software, Inc.
Voice: (303) 473-9118
rwonlinedocs@roguewave.com