#include "objfiles.h"
#include "value.h"
#include "language.h"
-#include "event-loop.h"
+#include "gdbsupport/event-loop.h"
#include "readline/tilde.h"
#include "python.h"
#include "extension-priv.h"
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (get_objfile_arch (objfile), current_language);
+ gdbpy_enter enter_py (objfile->arch (), current_language);
gdbpy_current_objfile = objfile;
python_run_simple_file (file, filename);
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (get_objfile_arch (objfile), current_language);
+ gdbpy_enter enter_py (objfile->arch (), current_language);
gdbpy_current_objfile = objfile;
PyRun_SimpleString (script);
static struct cmd_list_element *user_set_python_list;
static struct cmd_list_element *user_show_python_list;
-/* Function for use by 'set python' prefix command. */
-
-static void
-user_set_python (const char *args, int from_tty)
-{
- help_list (user_set_python_list, "set python ", all_commands,
- gdb_stdout);
-}
-
-/* Function for use by 'show python' prefix command. */
-
-static void
-user_show_python (const char *args, int from_tty)
-{
- cmd_show_list (user_show_python_list, from_tty, "");
-}
-
/* Initialize the Python code. */
#ifdef HAVE_PYTHON
std::string oldloc = setlocale (LC_ALL, NULL);
setlocale (LC_ALL, "");
progsize = strlen (progname.get ());
- progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t));
- if (!progname_copy)
- {
- fprintf (stderr, "out of memory\n");
- return false;
- }
+ progname_copy = XNEWVEC (wchar_t, progsize + 1);
count = mbstowcs (progname_copy, progname.get (), progsize + 1);
if (count == (size_t) -1)
{
#endif
Py_Initialize ();
+#if PY_VERSION_HEX < 0x03090000
+ /* PyEval_InitThreads became deprecated in Python 3.9 and will
+ be removed in Python 3.11. Prior to Python 3.7, this call was
+ required to initialize the GIL. */
PyEval_InitThreads ();
+#endif
#ifdef IS_PY3K
gdb_module = PyImport_ImportModule ("_gdb");
|| gdbpy_initialize_event () < 0
|| gdbpy_initialize_arch () < 0
|| gdbpy_initialize_xmethods () < 0
- || gdbpy_initialize_unwind () < 0)
+ || gdbpy_initialize_unwind () < 0
+ || gdbpy_initialize_tui () < 0)
return false;
#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
add_com_alias ("py", "python", class_obscure, 1);
/* Add set/show python print-stack. */
- add_prefix_cmd ("python", no_class, user_show_python,
- _("Prefix command for python preference settings."),
- &user_show_python_list, "show python ", 0,
- &showlist);
+ add_basic_prefix_cmd ("python", no_class,
+ _("Prefix command for python preference settings."),
+ &user_show_python_list, "show python ", 0,
+ &showlist);
- add_prefix_cmd ("python", no_class, user_set_python,
- _("Prefix command for python preference settings."),
- &user_set_python_list, "set python ", 0,
- &setlist);
+ add_show_prefix_cmd ("python", no_class,
+ _("Prefix command for python preference settings."),
+ &user_set_python_list, "set python ", 0,
+ &setlist);
add_setshow_enum_cmd ("print-stack", no_class, python_excp_enums,
&gdbpy_should_print_stack, _("\
"convenience_variable (NAME, VALUE) -> None.\n\
Set the value of the convenience variable $NAME." },
+#ifdef TUI
+ { "register_window_type", (PyCFunction) gdbpy_register_tui_window,
+ METH_VARARGS | METH_KEYWORDS,
+ "register_window_type (NAME, CONSTRUCSTOR) -> None\n\
+Register a TUI window constructor." },
+#endif /* TUI */
+
{NULL, NULL, 0, NULL}
};