Convenience Funs - Debugging with GDB
Description: Debugging with GDB

Next: Registers, Previous: Convenience Vars, Up: Data

### 10.12 Convenience Functions

gdb also supplies some convenience functions. These have a syntax similar to convenience variables. A convenience function can be used in an expression just like an ordinary function; however, a convenience function is implemented internally to gdb.

These functions require gdb to be configured with `Python` support.

`$_memeq(`buf1`,` buf2`,` length`)`
  Returns one if the length bytes at the addresses given by buf1 and buf2 are equal. Otherwise it returns zero.
`$_regex(`str`,` regex`)`
  Returns one if the string str matches the regular expression regex. Otherwise it returns zero. The syntax of the regular expression is that specified by `Python`'s regular expression support.
`$_streq(`str1`,` str2`)`
  Returns one if the strings str1 and str2 are equal. Otherwise it returns zero.
`$_strlen(`str`)`
  Returns the length of string str.

gdb provides the ability to list and get help on convenience functions.

`help function`
  Print a list of all convenience functions.