diff options
author | Doug Evans <dje@google.com> | 2012-08-10 20:26:00 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-08-10 20:26:00 +0000 |
commit | a72c32530ec5ee0b1baf366ba99db5f2e83681cb (patch) | |
tree | e66eca144d70a1fbe48eac3bf97ea1cb74a97ba9 /gdb/doc | |
parent | 200bc880f4ba86e027c4f45cbc912f494da768f2 (diff) | |
download | gdb-a72c32530ec5ee0b1baf366ba99db5f2e83681cb.zip gdb-a72c32530ec5ee0b1baf366ba99db5f2e83681cb.tar.gz gdb-a72c32530ec5ee0b1baf366ba99db5f2e83681cb.tar.bz2 |
Add $_memeq, $_regex, $_streq, $_strlen convenience functions.
* NEWS: Document them.
* data-directory/Makefile.in (PYTHON_FILES): Add function/__init__.py,
function/strfns.py.
* python/py-type.c (typy_array_1): New function.
(typy_array): Call it.
(typy_vector): New function.
(type_object_methods): Add "vector".
* python/lib/gdb/function/__init__.py: New file.
* python/lib/gdb/function/strfns.py: New file.
doc/
* gdb.texinfo (Convenience Funs): New node.
(Types In Python): Document Type.vector.
testsuite/
* gdb.python/py-strfns.c: New file.
* gdb.python/py-strfns.exp: New file.
* gdb.python/py-type.exp (test_fields): Add vector tests.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 49 |
2 files changed, 54 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index cfd2bd5..4318d84 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2012-08-10 Doug Evans <dje@google.com> + + * gdb.texinfo (Convenience Funs): New node. + (Types In Python): Document Type.vector. + 2012-08-09 Yao Qi <yao@codesourcery.com> * observer.texi: New observer command_param_changed. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a03532e..5cc5b48 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -7558,6 +7558,7 @@ being passed the type of @var{arg} as the argument. * Pretty Printing:: Python pretty printing * Value History:: Value history * Convenience Vars:: Convenience variables +* Convenience Funs:: Convenience functions * Registers:: Registers * Floating Point Hardware:: Floating point hardware * Vector Unit:: Vector Unit @@ -9311,6 +9312,9 @@ On HP-UX systems, if you refer to a function or variable name that begins with a dollar sign, @value{GDBN} searches for a user or system name first, before it searches for a convenience variable. +@node Convenience Funs +@section Convenience Functions + @cindex convenience functions @value{GDBN} also supplies some @dfn{convenience functions}. These have a syntax similar to convenience variables. A convenience @@ -9318,6 +9322,38 @@ function can be used in an expression just like an ordinary function; however, a convenience function is implemented internally to @value{GDBN}. +These functions require @value{GDBN} to be configured with +@code{Python} support. + +@table @code + +@item $_memeq(@var{buf1}, @var{buf2}, @var{length}) +@findex $_memeq@r{, convenience function} +Returns one if the @var{length} bytes at the addresses given by +@var{buf1} and @var{buf2} are equal. +Otherwise it returns zero. + +@item $_regex(@var{str}, @var{regex}) +@findex $_regex@r{, convenience function} +Returns one if the string @var{str} matches the regular expression +@var{regex}. Otherwise it returns zero. +The syntax of the regular expression is that specified by @code{Python}'s +regular expression support. + +@item $_streq(@var{str1}, @var{str2}) +@findex $_streq@r{, convenience function} +Returns one if the strings @var{str1} and @var{str2} are equal. +Otherwise it returns zero. + +@item $_strlen(@var{str}) +@findex $_strlen@r{, convenience function} +Returns the length of string @var{str}. + +@end table + +@value{GDBN} provides the ability to list and get help on +convenience functions. + @table @code @item help function @kindex help function @@ -23361,6 +23397,19 @@ second argument is the upper bound of the array. An array's length must not be negative, but the bounds can be. @end defun +@defun Type.vector (@var{n1} @r{[}, @var{n2}@r{]}) +Return a new @code{gdb.Type} object which represents a vector of this +type. If one argument is given, it is the inclusive upper bound of +the vector; in this case the lower bound is zero. If two arguments are +given, the first argument is the lower bound of the vector, and the +second argument is the upper bound of the vector. A vector's length +must not be negative, but the bounds can be. + +The difference between an @code{array} and a @code{vector} is that +arrays behave like in C: when used in expressions they decay to a pointer +to the first element whereas vectors are treated as first class values. +@end defun + @defun Type.const () Return a new @code{gdb.Type} object which represents a @code{const}-qualified variant of this type. |