aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 11aaa7a..9bef225 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1571,6 +1571,14 @@ gdbpy_progspaces (PyObject *unused1, PyObject *unused2)
return list.release ();
}
+/* Return the name of the current language. */
+
+static PyObject *
+gdbpy_current_language (PyObject *unused1, PyObject *unused2)
+{
+ return host_string_to_python_string (current_language->name ()).release ();
+}
+
/* The "current" objfile. This is set when gdb detects that a new
@@ -2534,6 +2542,10 @@ Format ADDRESS, an address within PROG_SPACE, a gdb.Progspace, using\n\
ARCH, a gdb.Architecture to determine the address size. The format of\n\
the returned string is 'ADDRESS <SYMBOL+OFFSET>' without the quotes." },
+ { "current_language", gdbpy_current_language, METH_NOARGS,
+ "current_language () -> string\n\
+Return the name of the currently selected language." },
+
{NULL, NULL, 0, NULL}
};