Table 14-1 Memory Debugging Commands in Interactive and Batch Mode

Command Description

Interactive mode

Batch mode

Toggles heap profiling and detection

set heap-check [on

check_heap= [on off] (or)

of leaks, bounds, and double free

off]

set heap-check [on off]

Toggle the leak detection capability

set heap-check leaks [on

check_leaks =[on off] (or)

 

off]

set heap-check leaks [on

 

 

off]

Toggle validation of calls to strcpy,

set heap-check

check_string= [on off] (or)

strncpy, memcpy, memccpy,

string [on off]

set heap-check string [on

memset, memmove, bzero, and

 

off]

bcopy

 

 

Toggle validation of calls to free()

set heap-check free

check_free = [on off] (or)

 

[on off]

set heap-check free [on

 

 

off]

Specify whether freed blocks should

set heap-check

scramble_blocks=[on off] (or)

be scrambled

scramble [on off]

set heap-check scramble [on

 

 

off]

Toggle bounds check on heap blocks

set heap-check

check_bounds = [on off]

 

bounds [on off]

(or) set heap-check bounds

 

 

[on off]

Specify the minimum size of a block

set heap-check

min_heap_size = <num> (or) set

for stack trace collection. GDB will

min-heap-size <num>

heap-check min-heap-size

report blocks of size greater than or

 

<num>

equal to <num> at each call-site.

 

 

Specify the minimum size of a block

set heap-check

min_leak_size = <num> (or) set

for stack trace collection. GDB report

min-leak-size <num>

heap-check min-leak-size

leaks of blocks, smaller than this

 

<num>

value. However, no stack trace is

 

 

provided.

 

 

Specify the depth of call stack to be captured

Instruct GDB to stop, whenever a block at the given address gets allocated or deallocated.

Instructs malloc to return null after <num> invocations of malloc.

Instructs malloc to return null after <num> bytes have been allocated by malloc.

set heap-check

frame_count = <num> (or) set

frame-count <num>

heap-check frame-count <num>

set heap-check watch

Not supported in batch mode

address

 

set heap-check

Not supported in batch mode

null-check <num>

 

set heap-check

Not supported in batch mode

null-check-size

 

<size>

 

Specifies the seed value to be used

set heap-check

Not supported in batch mode

for generating random

seed-value <num>

 

null-check-count.

 

 

14.10 Debugging Memory Problems 177

Page 177
Image 177
HP gnu source-level debugger 5992-4701 manual Memory Debugging Commands in Interactive and Batch Mode, Off