mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-08 16:48:17 +08:00
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.
This commit is contained in:
@ -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}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user