Pin
Classes | Functions
Utilities for tokenizing strings and general functions

Classes

struct  DECSTR
 
struct  HEXSTR
 
class  MemRange
 
struct  OPTIONAL_VALUE< T >
 
struct  FLTSTR
 

Functions

BOOL CharIsSpace (CHAR c)
 
CHAR CharToUpper (CHAR c)
 
std::string ptrstr (const VOID *val)
 
std::string StringFromAddrint (ADDRINT l)
 
std::string StringFromUint64 (UINT64 l)
 
std::string StringDec (UINT64 l, UINT32 digits, CHAR padding)
 
std::string StringDecSigned (INT64 l, UINT32 digits, CHAR padding)
 
std::string StringBignum (INT64 l, UINT32 digits, CHAR padding)
 
std::string Reformat (const std::string &s, const std::string &prefix, UINT32 min_line, UINT32 max_line)
 
std::string StringHex32 (UINT32 l, UINT32 digits, BOOL prefix_0x)
 
std::string StringBool (BOOL b)
 
std::string StringTri (TRI t)
 
INT32 Int32FromString (const std::string &s)
 
UINT32 Uint32FromString (const std::string &s)
 
INT64 Int64FromString (const std::string &s)
 
UINT64 Uint64FromString (const std::string &s)
 
FLT64 FLT64FromString (const std::string &s)
 
INT CharToHexDigit (CHAR c)
 
ADDRINT AddrintFromString (const std::string &str)
 
std::string ReadLine (std::istream &inputFile, UINT32 *lineNum)
 
std::string StringHex (UINT32 l, UINT32 digits, BOOL prefix_0x=TRUE)
 
std::string decstr (INT64 val, UINT32 width=0)
 
std::string decstr (INT32 val, UINT32 width=0)
 
std::string decstr (INT16 val, UINT32 width=0)
 
std::string decstr (UINT64 val, UINT32 width=0)
 
std::string decstr (UINT32 val, UINT32 width=0)
 
std::string decstr (UINT16 val, UINT32 width=0)
 
std::string hexstr (INT64 val, UINT32 width=0)
 
std::string hexstr (INT32 val, UINT32 width=0)
 
std::string hexstr (INT16 val, UINT32 width=0)
 
std::string hexstr (UINT64 val, UINT32 width=0)
 
std::string hexstr (VOID *p, UINT32 width=0)
 
std::string hexstr (const VOID *p, UINT32 width=0)
 
std::string hexstr (UINT32 val, UINT32 width=0)
 
std::string hexstr (UINT16 val, UINT32 width=0)
 
std::string ljstr (const std::string &s, UINT32 width, CHAR padding=' ')
 
UINT32 BitCount (ADDRINT val)
 
VOID * Addrint2VoidStar (ADDRINT addr)
 
ADDRINT VoidStar2Addrint (const VOID *addr)
 
ADDRINT VoidStar2Addrint (VOID *addr)
 
template<typename T >
RoundUp (T value, size_t alignment)
 
template<typename T >
T * RoundUp (T *ptr, size_t alignment)
 
template<typename T >
RoundDown (T value, size_t alignment)
 
template<typename T >
T * RoundDown (T *ptr, size_t alignment)
 
ADDRINT GetPageOfAddr (ADDRINT addr)
 
std::string Joinpath (std::string s1, std::string s2)
 
CHAR * CreateTmpFileName (const CHAR *fnameTemplate, const UINT32 fnameTemplateSize)
 
const VOID * GetSp ()
 
size_t PtrDiff (const VOID *ptr1, const VOID *ptr2)
 
VOID * PtrAtOffset (VOID *ptr, size_t offset)
 
const VOID * PtrAtOffset (const VOID *ptr, size_t offset)
 
MemRange MemPageRange (ADDRINT addr)
 
MemRange MemPageRange (const VOID *addr)
 
std::string StringFlt (FLT64 val, UINT32 precision, UINT32 width)
 
std::string fltstr (FLT64 val, UINT32 prec=0, UINT32 width=0)
 

Detailed Description

Availability:
Mode: JIT & Probe
O/S: Linux & Windows
CPU: All

Function Documentation

◆ Addrint2VoidStar()

VOID* Addrint2VoidStar ( ADDRINT  addr)
inline

Convert ADDRINT to "void *"

◆ AddrintFromString()

ADDRINT AddrintFromString ( const std::string &  str)

Convert a string to an ADDRINT.

◆ BitCount()

UINT32 BitCount ( ADDRINT  val)

popcount/bitcount code using the usual trick

◆ CharIsSpace()

BOOL CharIsSpace ( CHAR  c)

This module contains useful utility functions.

ctype::isspace alternative (avoids complications from including ctype.h).

◆ CharToHexDigit()

INT CharToHexDigit ( CHAR  c)

Convert specified character to the corresponding hexadecimal digit.

Returns
integer in the interval [0, 15] or -1 upon failure

◆ CharToUpper()

CHAR CharToUpper ( CHAR  c)

ctype::toupper alternative (avoids complications from including ctype.h).

◆ CreateTmpFileName()

CHAR* CreateTmpFileName ( const CHAR *  fnameTemplate,
const UINT32  fnameTemplateSize 
)

Create a temporary file name

◆ decstr() [1/6]

std::string decstr ( INT16  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ decstr() [2/6]

std::string decstr ( INT32  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ decstr() [3/6]

std::string decstr ( INT64  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ decstr() [4/6]

std::string decstr ( UINT16  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ decstr() [5/6]

std::string decstr ( UINT32  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ decstr() [6/6]

std::string decstr ( UINT64  val,
UINT32  width = 0 
)
inline

Create a string containing the given decimal integer.

◆ FLT64FromString()

FLT64 FLT64FromString ( const std::string &  s)

Convert a string to a FLT64.

◆ fltstr()

std::string fltstr ( FLT64  val,
UINT32  prec = 0,
UINT32  width = 0 
)
inline

Create a string containing the given floating point number.

◆ GetPageOfAddr()

ADDRINT GetPageOfAddr ( ADDRINT  addr)

Get the address of the page that addr is in

◆ GetSp()

const VOID* GetSp ( )
Returns
current stack pointer

◆ hexstr() [1/8]

std::string hexstr ( const VOID *  p,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [2/8]

std::string hexstr ( INT16  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [3/8]

std::string hexstr ( INT32  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [4/8]

std::string hexstr ( INT64  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [5/8]

std::string hexstr ( UINT16  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [6/8]

std::string hexstr ( UINT32  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [7/8]

std::string hexstr ( UINT64  val,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ hexstr() [8/8]

std::string hexstr ( VOID *  p,
UINT32  width = 0 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ Int32FromString()

INT32 Int32FromString ( const std::string &  s)

Convert a string to an INT32.

◆ Int64FromString()

INT64 Int64FromString ( const std::string &  s)

Convert a string to an INT64.

◆ Joinpath()

std::string Joinpath ( std::string  s1,
std::string  s2 
)

Concatenate two strings with a path delimiter

◆ ljstr()

std::string ljstr ( const std::string &  s,
UINT32  width,
CHAR  padding = ' ' 
)
inline

Left justify string.

◆ MemPageRange() [1/2]

MemRange MemPageRange ( ADDRINT  addr)

Get the page that contains the specified address

Parameters
[in]addraddress inside the requested page
Returns
one-page range that contains the specified address

◆ MemPageRange() [2/2]

MemRange MemPageRange ( const VOID *  addr)

Get the page that contains the specified address

Parameters
[in]addraddress inside the requested page
Returns
one-page range that contains the specified address

◆ PtrAtOffset() [1/2]

const VOID* PtrAtOffset ( const VOID *  ptr,
size_t  offset 
)
inline

Return const pointer whose offset, in bytes, from <ptr> is <offset>

Return const pointer of type <T> whose offset, in bytes, from <ptr> is <offset>

◆ PtrAtOffset() [2/2]

VOID* PtrAtOffset ( VOID *  ptr,
size_t  offset 
)
inline

Return pointer whose offset, in bytes, from <ptr> is <offset>

Return pointer of type <T> whose offset, in bytes, from <ptr> is <offset>

◆ PtrDiff()

size_t PtrDiff ( const VOID *  ptr1,
const VOID *  ptr2 
)
inline

Return offset, in bytes, of <ptr1> from <ptr2>

◆ ptrstr()

std::string ptrstr ( const VOID *  val)

Print pointer.

◆ ReadLine()

std::string ReadLine ( std::istream &  inputFile,
UINT32 *  lineNum 
)

Read a line from file while maintaining a current line count skipping over blank and comment lines.

◆ Reformat()

std::string Reformat ( const std::string &  s,
const std::string &  prefix,
UINT32  min_line,
UINT32  max_line 
)

Add new lines to string to make it fit given line width restrictions.

◆ RoundDown() [1/2]

template<typename T >
T* RoundDown ( T *  ptr,
size_t  alignment 
)

Specialization of the RoundDown function for pointer type

◆ RoundDown() [2/2]

template<typename T >
T RoundDown ( value,
size_t  alignment 
)

Round integer of type <T> down to given alignment.

◆ RoundUp() [1/2]

template<typename T >
T* RoundUp ( T *  ptr,
size_t  alignment 
)

Specialization of the RoundUp function for pointer type

◆ RoundUp() [2/2]

template<typename T >
T RoundUp ( value,
size_t  alignment 
)

Round integer of type <T> up to given alignment.

◆ StringBignum()

std::string StringBignum ( INT64  l,
UINT32  digits,
CHAR  padding 
)

Convert a INT64 into a dec string with 1000 separation . Padding can be specified as well.

◆ StringBool()

std::string StringBool ( BOOL  b)

Convert a BOOL into a string.

◆ StringDec()

std::string StringDec ( UINT64  l,
UINT32  digits,
CHAR  padding 
)

Convert a UINT64 into a dec string. Padding can be specified as well.

◆ StringDecSigned()

std::string StringDecSigned ( INT64  l,
UINT32  digits,
CHAR  padding 
)

Convert a INT64 into a dec string. Padding can be specified as well.

◆ StringFlt()

std::string StringFlt ( FLT64  val,
UINT32  precision,
UINT32  width 
)

Convert a FLT64 into a string. Padding can be specified as well.

◆ StringFromAddrint()

std::string StringFromAddrint ( ADDRINT  l)

Convert a ADDRINT into a string using the hex address format.

◆ StringFromUint64()

std::string StringFromUint64 ( UINT64  l)

Convert a UINT64 into a string using the hex address format.

◆ StringHex()

std::string StringHex ( UINT32  l,
UINT32  digits,
BOOL  prefix_0x = TRUE 
)
inline

Create a string with a hexadecimal prefix containing the given hexadecimal integer.

◆ StringHex32()

std::string StringHex32 ( UINT32  l,
UINT32  digits,
BOOL  prefix_0x 
)

Convert a UINT32 into a hex string. Padding can be specified as well.

◆ StringTri()

std::string StringTri ( TRI  t)

Convert a TRI into a string.

◆ Uint32FromString()

UINT32 Uint32FromString ( const std::string &  s)

Convert a string to a UINT32.

◆ Uint64FromString()

UINT64 Uint64FromString ( const std::string &  s)

Convert a string to a UINT64.

◆ VoidStar2Addrint() [1/2]

ADDRINT VoidStar2Addrint ( const VOID *  addr)
inline

Convert "void *" to ADDRINT.

◆ VoidStar2Addrint() [2/2]

ADDRINT VoidStar2Addrint ( VOID *  addr)
inline

Convert "void *" to ADDRINT