Documentation

class valparse.valparse.Arguments(valexe: str, valargs: List[str], exe: str, exeargs: List[str])

Class to keep track of Valgrind arguments

Parameters:
  • valexe (str) – Executable corresponding to the Valgrind tool

  • valargs (List[str]) – Arguments passed to Valgrind

  • exe (str) – Executable corresponding to the program being tested

  • exeargs (List[str]) – Arguments passed to the program being tested

Raises:

ValgrindFormatError – If the <args> block does not meet Valgrind protocol specifications

class valparse.valparse.FatalSignal(tid: int, signo: int, signame: str, sicode: int, siaddr: str, stack: List[Frame], event: str | None = None, threadname: str | None = None)

Class to keep track of fatal signal

Parameters:
  • tid (int) – Thread ID

  • signo (int) – Signal number

  • signame (str) – Signal name

  • sicode (int) – Signal code

  • siaddr (str) – Signal address

  • stack (List[Frame]) – Stack trace

  • event (Optional[str]) – Event

  • threadname (Optional[str]) – Thread name

get_signal() signal.Signals

Returns signal object from signal name

class valparse.valparse.Frame(ip: str, obj: str | None = None, fn: str | None = None, dir: str | None = None, file: str | None = None, line: int | None = None)

Class to keep track of Valgrind stack frame

Parameters:
  • ip (str) – Instruction pointer

  • obj (Optional[str]) – Object name

  • fn (Optional[str]) – Function name

  • dir (Optional[str]) – Directory name

  • file (Optional[str]) – File name

  • line (Optional[int]) – Line number

class valparse.valparse.Parser(xmlfile: str)

Class to parse Valgrind XML output

Parameters:

xmlfile (str) – XML file to parse

Raises:
hasErrors() bool
Returns:

True if there are errors, False otherwise

Return type:

bool

hasFatalSignal() bool
Returns:

True if there is a fatal signal, False otherwise

Return type:

bool

hasLeaks() bool
Returns:

True if there are leaks, False otherwise

Return type:

bool

totalBytesLeaked() int
Returns:

Total number of bytes leaked

Return type:

int

uniqueErrCount() int
Returns:

Number of unique errors

Return type:

int

uniqueLeakCount() int
Returns:

Number of unique leaks

Return type:

int

class valparse.valparse.SFrame(obj: str | None = None, fun: str | None = None)

Class to keep track of Valgrind suppression frame

Parameters:
  • obj (Optional[str]) – Object name

  • fun (Optional[str]) – Function name

class valparse.valparse.Status(start: str, end: str)

Class to keep track of start and end times of Valgrind run

Parameters:
  • start (str) – Start time of Valgrind run

  • end (str) – End time of Valgrind run

Raises:

ValgrindFormatError – If the <status> block does not meet Valgrind protocol specifications

classmethod from_xml_elements(el: List[Element]) Status

Takes in list of <status> blocks

class valparse.valparse.SuppCount(count: int, name: str)

Class to keep track of Valgrind suppression count

Parameters:
  • count (int) – Number of times suppression was applied

  • name (str) – Name of suppression

class valparse.valparse.Suppression(name: str, kind: str, stack: List[SFrame], auxkind: str | None = None)

Class to keep track of Valgrind suppression

Parameters:
  • name (str) – Name of suppression

  • kind (str) – Kind of suppression

  • stack (List[SFrame]) – Suppression stack trace

  • auxkind (Optional[str]) – Auxiliary kind of suppression

createRawText(name: str)

Creates raw text for suppression

class valparse.valparse.ValgrindError(kind: ValgrindErrorKind, msg: str, stack: List[Frame], msg_secondary: str | None = None, bytes_leaked: int | None = None, blocks_leaked: int | None = None)

Class to keep track of Valgrind error

Parameters:
  • kind (ValgrindErrorKind) – Kind of Valgrind error

  • msg (str) – Error message

  • stack (List[Frame]) – Stack trace

  • msg_secondary (Optional[str]) – Secondary error message

  • bytes_leaked (Optional[int]) – Number of bytes leaked

  • blocks_leaked (Optional[int]) – Number of blocks leaked

isLeak() bool

Returns True if error is a leak, False otherwise

isError() bool

Returns True if error is an error, False otherwise

class valparse.valparse.ValgrindErrorKind(value)

Enum representing Valgrind error types

exception valparse.valparse.ValgrindFormatError

Raised when the XML file does not meet Valgrind protocol specifications

exception valparse.valparse.ValgrindToolError

Raised when an unsupported Valgrind XML tool is passed in

exception valparse.valparse.ValgrindVersionError

Raised when an unsupported Valgrind XML version is passed in

valparse.valparse.dumpSuppressions(filename: str, supps: List[Tuple[str, Suppression]], append: bool | None = False)

Dumps the raw suppression text to file with filename specified.

Parameters:
  • filename (str) – File to write to

  • supps (List[Tuple[str, Suppression]]) – List of tuples of the form (name, Suppression)

  • append (Optional[bool], optional) – If True, the file is opened in append mode, by default False