_leb128_unsigned_decode32: _leb128_signed_decode32 - decode leb128
int _leb128_unsigned_decode64(char* data, __uint64_t* value);
int _leb128_signed_decode64(char* data, __int64_t* value);
int _leb128_unsigned_decode32(char* data, __uint32_t* value);
int _leb128_signed_decode32(char* data, __int32_t* value);
These routines decode leb128 numbers into the integers they encode. The
leb128 format is a variable-length encoding extensively used in the DWARF
debugging information format and is described in the DWARF documentation.
The caller must know if the leb128 number data in hand is 32 or 64 bit
and if it is signed or unsigned: nothing in the leb128 format makes it
possible to determine this from the input data itself.
If a data points to a number which fits in 32 bits either the 32bit or
64bit decoding routine may be called: the correct value is returned
through the value pointer. If data points at a number too large to fit
in 32 bits both the returned-value *and* the number of bytes returned by
either of the 32-bit functions will be incorrect.
The decoded number is placed into data and the number of bytes of data
which held the number is returned.
Link with the option -lelfutil to link in these routines.
The arguments are as follows:
data is a pointer to the input number to be converted from leb128 format
into an integer.
is a pointer to properly aligned space (provided by the caller) to
which the called routine writes the decoded integer value.
Returns the number of bytes found and used in decoding the number. The
returned value will be in the range 1 to 5 for the 32-bit number input
versions. The returned value will be in the range 1 to 10 for the 64-bit
number input versions.
If a number is erroneously encoded for the call (if the decoded value
will not fit in the provided value pointed to) there is no error
indication: instead a value is returned and the length returned is 5 (for
the 32bit versions) or 10 (for the 64bit versions).
libelfutil(5), xlate(4), _leb128_unsigned_encode64,
_leb128_signed_encode32, DWARF Debugging Information Format , A Consumer
Library Interface to DWARF
PPPPaaaaggggeeee 2222 [ Back ]