1<html lang="en"> 2<head> 3<title>Convenience Funs - Debugging with GDB</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Debugging with GDB"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Data.html#Data" title="Data"> 9<link rel="prev" href="Convenience-Vars.html#Convenience-Vars" title="Convenience Vars"> 10<link rel="next" href="Registers.html#Registers" title="Registers"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988-2013 Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.3 or 17any later version published by the Free Software Foundation; with the 18Invariant Sections being ``Free Software'' and ``Free Software Needs 19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 20and with the Back-Cover Texts as in (a) below. 21 22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 23this GNU Manual. Buying copies from GNU Press supports the FSF in 24developing GNU and promoting software freedom.'' 25--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="Convenience-Funs"></a> 43<p> 44Next: <a rel="next" accesskey="n" href="Registers.html#Registers">Registers</a>, 45Previous: <a rel="previous" accesskey="p" href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>, 46Up: <a rel="up" accesskey="u" href="Data.html#Data">Data</a> 47<hr> 48</div> 49 50<h3 class="section">10.12 Convenience Functions</h3> 51 52<p><a name="index-convenience-functions-652"></a><span class="sc">gdb</span> also supplies some <dfn>convenience functions</dfn>. These 53have a syntax similar to convenience variables. A convenience 54function can be used in an expression just like an ordinary function; 55however, a convenience function is implemented internally to 56<span class="sc">gdb</span>. 57 58 <p>These functions require <span class="sc">gdb</span> to be configured with 59<code>Python</code> support. 60 61 <dl> 62<dt><code>$_memeq(</code><var>buf1</var><code>, </code><var>buf2</var><code>, </code><var>length</var><code>)</code><dd><a name="index-g_t_0024_005fmemeq_0040r_007b_002c-convenience-function_007d-653"></a>Returns one if the <var>length</var> bytes at the addresses given by 63<var>buf1</var> and <var>buf2</var> are equal. 64Otherwise it returns zero. 65 66 <br><dt><code>$_regex(</code><var>str</var><code>, </code><var>regex</var><code>)</code><dd><a name="index-g_t_0024_005fregex_0040r_007b_002c-convenience-function_007d-654"></a>Returns one if the string <var>str</var> matches the regular expression 67<var>regex</var>. Otherwise it returns zero. 68The syntax of the regular expression is that specified by <code>Python</code>'s 69regular expression support. 70 71 <br><dt><code>$_streq(</code><var>str1</var><code>, </code><var>str2</var><code>)</code><dd><a name="index-g_t_0024_005fstreq_0040r_007b_002c-convenience-function_007d-655"></a>Returns one if the strings <var>str1</var> and <var>str2</var> are equal. 72Otherwise it returns zero. 73 74 <br><dt><code>$_strlen(</code><var>str</var><code>)</code><dd><a name="index-g_t_0024_005fstrlen_0040r_007b_002c-convenience-function_007d-656"></a>Returns the length of string <var>str</var>. 75 76 </dl> 77 78 <p><span class="sc">gdb</span> provides the ability to list and get help on 79convenience functions. 80 81 <dl> 82<dt><code>help function</code><dd><a name="index-help-function-657"></a><a name="index-show-all-convenience-functions-658"></a>Print a list of all convenience functions. 83</dl> 84 85 </body></html> 86 87