Valgrind Software Quick Start Manual page 76

Table of Contents

Advertisement

• get_vbits <addr> [<len>] shows the definedness (V) bits for <len> (default 1) bytes starting at <addr>.
The definedness of each byte in the range is given using two hexadecimal digits. These hexadecimal digits encode
the validity of each bit of the corresponding byte, using 0 if the bit is defined and 1 if the bit is undefined. If a byte
is not addressable, its validity bits are replaced by __ (a double underscore).
In the following example, string10 is an array of 10 characters, in which the even numbered bytes are undefined.
In the below example, the byte corresponding to string10[5] is not addressable.
(gdb) p &string10
$4 = (char ( * )[10]) 0x8049e28
(gdb) monitor get_vbits 0x8049e28 10
ff00ff00 ff__ff00 ff00
(gdb)
The command get_vbits cannot be used with registers. To get the validity bits of a register, you must start Valgrind
with the option --vgdb-shadow-registers=yes. The validity bits of a register can be obtained by printing
the 'shadow 1' corresponding register. In the below x86 example, the register eax has all its bits undefined, while
the register ebx is fully defined.
(gdb) p /x $eaxs1
$9 = 0xffffffff
(gdb) p /x $ebxs1
$10 = 0x0
(gdb)
• make_memory [noaccess|undefined|defined|Definedifaddressable] <addr> [<len>]
marks the range of <len> (default 1) bytes at <addr> as having the given status. Parameter noaccess marks
the range as non-accessible, so Memcheck will report an error on any access to it. undefined or defined
mark the area as accessible, but Memcheck regards the bytes in it respectively as having undefined or defined
values. Definedifaddressable marks as defined, bytes in the range which are already addressible, but
makes no change to the status of bytes in the range which are not addressible. Note that the first letter of
Definedifaddressable is an uppercase D to avoid confusion with defined.
In the following example, the first byte of the string10 is marked as defined:
(gdb) monitor make_memory defined 0x8049e28 1
(gdb) monitor get_vbits 0x8049e28 10
0000ff00 ff00ff00 ff00
(gdb)
Memcheck: a memory error detector
64

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Software and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents