aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-09-06 09:15:44 -0700
committerDoug Evans <xdje42@gmail.com>2014-09-06 09:15:44 -0700
commitfaa42425cb1f5cd279fc8c91d0b75d37853a128a (patch)
tree239606104986f50fe38a824610ed3fa46b7cdd7f /gdb/doc
parent0d41ba00c60b5e0b66895cfa56c1db137a9345d8 (diff)
downloadgdb-faa42425cb1f5cd279fc8c91d0b75d37853a128a.zip
gdb-faa42425cb1f5cd279fc8c91d0b75d37853a128a.tar.gz
gdb-faa42425cb1f5cd279fc8c91d0b75d37853a128a.tar.bz2
PR 15276: Add $_caller_is, $_caller_matches, $_any_caller_is, $_any_caller_matches
gdb/ChangeLog: PR 15276 * NEWS: Mention $_caller_is, $_caller_matches, $_any_caller_is, $_any_caller_matches. * data-directory/Makefile.in (PYTHON_FILE_LIST): Add caller_is.py. * python/lib/gdb/function/caller_is.py: New file. gdb/testsuite/ChangeLog: PR 15276 * gdb.python/py-caller-is.c: New file. * gdb.python/py-caller-is.exp: New file. gdb/doc/ChangeLog: PR 15276 * gdb.texinfo (Convenience Funs): Document $_caller_is, $_caller_matches, $_any_caller_is, $_any_caller_matches.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog6
-rw-r--r--gdb/doc/gdb.texinfo64
2 files changed, 70 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 2b453e7..ddc11f0 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-06 Doug Evans <xdje42@gmail.com>
+
+ PR 15276
+ * gdb.texinfo (Convenience Funs): Document $_caller_is,
+ $_caller_matches, $_any_caller_is, $_any_caller_matches.
+
2014-09-03 Justin Lebar <jlebar@google.com>
* python.texi (Types In Python): Type.template_argument(n) returns a
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8d9148c..facbd16 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -10098,6 +10098,70 @@ Otherwise it returns zero.
@findex $_strlen@r{, convenience function}
Returns the length of string @var{str}.
+@item $_caller_is(@var{name}@r{[}, @var{number_of_frames}@r{]})
+@findex $_caller_is@r{, convenience function}
+Returns one if the calling function's name is equal to @var{name}.
+Otherwise it returns zero.
+
+If the optional argument @var{number_of_frames} is provided,
+it is the number of frames up in the stack to look.
+The default is 1.
+
+Example:
+
+@smallexample
+(gdb) backtrace
+#0 bottom_func ()
+ at testsuite/gdb.python/py-caller-is.c:21
+#1 0x00000000004005a0 in middle_func ()
+ at testsuite/gdb.python/py-caller-is.c:27
+#2 0x00000000004005ab in top_func ()
+ at testsuite/gdb.python/py-caller-is.c:33
+#3 0x00000000004005b6 in main ()
+ at testsuite/gdb.python/py-caller-is.c:39
+(gdb) print $_caller_is ("middle_func")
+$1 = 1
+(gdb) print $_caller_is ("top_func", 2)
+$1 = 1
+@end smallexample
+
+@item $_caller_matches(@var{regexp}@r{[}, @var{number_of_frames}@r{]})
+@findex $_caller_matches@r{, convenience function}
+Returns one if the calling function's name matches the regular expression
+@var{regexp}. Otherwise it returns zero.
+
+If the optional argument @var{number_of_frames} is provided,
+it is the number of frames up in the stack to look.
+The default is 1.
+
+@item $_any_caller_is(@var{name}@r{[}, @var{number_of_frames}@r{]})
+@findex $_any_caller_is@r{, convenience function}
+Returns one if any calling function's name is equal to @var{name}.
+Otherwise it returns zero.
+
+If the optional argument @var{number_of_frames} is provided,
+it is the number of frames up in the stack to look.
+The default is 1.
+
+This function differs from @code{$_caller_is} in that this function
+checks all stack frames from the immediate caller to the frame specified
+by @var{number_of_frames}, whereas @code{$_caller_is} only checks the
+frame specified by @var{number_of_frames}.
+
+@item $_any_caller_matches(@var{regexp}@r{[}, @var{number_of_frames}@r{]})
+@findex $_any_caller_matches@r{, convenience function}
+Returns one if any calling function's name matches the regular expression
+@var{regexp}. Otherwise it returns zero.
+
+If the optional argument @var{number_of_frames} is provided,
+it is the number of frames up in the stack to look.
+The default is 1.
+
+This function differs from @code{$_caller_matches} in that this function
+checks all stack frames from the immediate caller to the frame specified
+by @var{number_of_frames}, whereas @code{$_caller_matches} only checks the
+frame specified by @var{number_of_frames}.
+
@end table
@value{GDBN} provides the ability to list and get help on