aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-05-24 10:15:17 -0600
committerTom Tromey <tromey@adacore.com>2022-06-01 06:15:53 -0600
commit80fa4b2a606763e71c4b599fa88288f554a0ea5b (patch)
tree251f21a9776f96cc0a0b83e905968385cb409b48 /gdb/doc
parent46c7fd95fc42466a5a8c3b3d70925f1a8af68de3 (diff)
downloadgdb-80fa4b2a606763e71c4b599fa88288f554a0ea5b.zip
gdb-80fa4b2a606763e71c4b599fa88288f554a0ea5b.tar.gz
gdb-80fa4b2a606763e71c4b599fa88288f554a0ea5b.tar.bz2
Add gdb.current_language and gdb.Frame.language
This adds the gdb.current_language function, which can be used to find the current language without (1) ever having the value "auto" or (2) having to parse the output of "show language". It also adds the gdb.Frame.language, which can be used to find the language of a given frame. This is normally preferable if one has a Frame object handy.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/python.texi12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index f933c7d..ba5a9b3 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -668,6 +668,14 @@ Here are some examples of the possible string formats:
@end smallexample
@end defun
+@defun gdb.current_language ()
+Return the name of the current language as a string. Unlike
+@code{gdb.parameter('language')}, this function will never return
+@samp{auto}. If a @code{gdb.Frame} object is available (@pxref{Frames
+In Python}), the @code{language} method might be preferable in some
+cases, as that is not affected by the user's language setting.
+@end defun
+
@node Exception Handling
@subsubsection Exception Handling
@cindex python exceptions
@@ -5202,6 +5210,10 @@ Stack}.
Return an integer, the stack frame level for this frame. @xref{Frames, ,Stack Frames}.
@end defun
+@defun Frame.language ()
+Return a string, the source language for this frame.
+@end defun
+
@node Blocks In Python
@subsubsection Accessing blocks from Python