memory checking. The librtc.so library is shipped as part of the wdb product. Install the HP WDB bundled with the compiler or a more recent version of wdb to get full functionality.

The default behavior of the +check=malloc option can be changed by users providing their own rtcconfig file. The user specified rtcconfig file can be in the current directory OR in a directory specified by the GDBRTC_CONFIG environment variable. The default configuration used by the

+check=malloc option is:

check_bounds=1; check_free=1; scramble_block=1;

abort_on_bounds=1; abort_on_bad_free=1; abort_on_nomem=1; check_leaks=1; min_leak_size=0; check_heap=0; frame_count=4; output_dir=.;

Note that when +check=bounds:pointer is also turned on, it can check freed memory read/write. But the check needs to retain freed memory which is not turned on by default. To turn on the feature, set the following environment variable at runtime:

RTC_MALLOC_CONFIG="retain_freed_blocks=1"

Or add "retain_freed_blocks=1" to the rtcconfig file.

When malloc fails to allocate specified memory, the runtime system will free the retained freed memory and try to allocate memory.

For a description for the above configuration parameters and the full list of other parameters, refer to the HP WDB debugger documentation.

Execution Path Recovery

This feature is enabled by the +pathtrace[=localglobalglobal_fixed_sizenone] Option. It provides a mechanism to record program execution control flow into global and/or local path tables. The saved information can be used by the HP WDB debugger to assist with crash path recovery from the core file, or to assist in debugging the program by showing the executed branches.

Currently only if-else, switch-case-default, and try-catchexecution paths are recorded in the path table. If there is no condition statement inside for, while, or do-whileloop, then no execution path is recorded.

+pathtrace=local

This option generates a local path table and records basic block-execution information in it at runtime.

+pathtrace=global

This option generates a global path table and records basic block-execution information in it at runtime.

+pathtrace=global_fixed_size

This option generates a fixed-size (65536 items) global path table and records basic block- execution information in it at runtime. This form differs from +pathtrace=global because the size of the table cannot be configured at runtime, and the contents cannot be dumped to a file. The fixed-size global path table has better runtime performance than the configurable global path table. The performance difference varies depending on the optimization level and how the program is written.

14

Page 14
Image 14
HP C/aC++ for PA-RISC Software manual Execution Path Recovery