32 #include "readline/tilde.h"
106 extern PyMethodDef python_GdbMethods[];
109 extern struct PyModuleDef python_GdbModuleDef;
222 if (PyErr_Occurred ())
226 warning (
_(
"internal error: Unhandled Python exception"));
253 if (!gdb_python_initialized)
254 error (
_(
"Python not initialized"));
277 PyOS_InterruptOccurred ();
285 PyErr_SetInterrupt ();
293 return PyOS_InterruptOccurred ();
305 m = PyImport_AddModule (
"__main__");
309 d = PyModule_GetDict (m);
312 v = PyRun_StringFlags (command, Py_single_input, d, d, NULL);
342 int len = strlen (arg);
343 char *script =
xmalloc (len + 2);
345 strcpy (script, arg);
347 script[len + 1] =
'\0';
353 err = PyRun_InteractiveLoop (
instream,
"<stdin>");
360 error (
_(
"Error while executing Python code."));
387 PyRun_SimpleFile (file, filename);
392 PyObject *python_file;
397 full_path = tilde_expand (filename);
399 python_file = PyFile_FromString (full_path,
"r");
404 error (
_(
"Error while opening file: %s"), full_path);
408 PyRun_SimpleFile (PyFile_AsFile (python_file), filename);
427 for (iter = l; iter; iter = iter->
next)
428 size += strlen (iter->
line) + 1;
432 for (iter = l; iter; iter = iter->
next)
436 strcpy (&script[here], iter->
line);
438 script[here++] =
'\n';
456 error (
_(
"Invalid \"python\" block structure."));
461 ret = PyRun_SimpleString (script);
464 error (
_(
"Error while executing Python code."));
484 if (PyRun_SimpleString (arg))
485 error (
_(
"Error while executing Python code."));
514 char *str = * (
char **) var;
518 return PyString_Decode (str, strlen (str),
host_charset (), NULL);
542 if ((* (
int *) var) ==
INT_MAX)
546 return PyLong_FromLong (* (
int *) var);
550 unsigned int val = * (
unsigned int *) var;
554 return PyLong_FromUnsignedLong (val);
558 return PyErr_Format (PyExc_RuntimeError,
559 _(
"Programmer error: unhandled type."));
574 if (! PyArg_ParseTuple (args,
"s", &arg))
577 newarg = concat (
"show ", arg, (
char *) NULL);
592 return PyErr_Format (PyExc_RuntimeError,
593 _(
"Could not find parameter `%s'."), arg);
596 return PyErr_Format (PyExc_RuntimeError,
597 _(
"`%s' is not a parameter."), arg);
608 return PyUnicode_Decode (cset, strlen (cset),
host_charset (), NULL);
618 return PyUnicode_Decode (cset, strlen (cset),
host_charset (), NULL);
627 PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
628 int from_tty, to_string;
629 static char *keywords[] = {
"command",
"from_tty",
"to_string", NULL };
632 if (! PyArg_ParseTupleAndKeywords (args, kw,
"s|O!O!", keywords, &arg,
633 &PyBool_Type, &from_tty_obj,
634 &PyBool_Type, &to_string_obj))
640 int cmp = PyObject_IsTrue (from_tty_obj);
649 int cmp = PyObject_IsTrue (to_string_obj);
658 char *copy = xstrdup (arg);
686 PyObject *r = PyString_FromString (result);
708 str_obj = PyString_Decode (soname, strlen (soname),
host_charset (), NULL);
727 const char *arg = NULL;
728 char *copy_to_free = NULL, *copy = NULL;
730 PyObject *result = NULL;
731 PyObject *return_result = NULL;
732 PyObject *unparsed = NULL;
734 if (! PyArg_ParseTuple (args,
"|s", &arg))
745 copy = xstrdup (arg);
763 if (sals.
sals != NULL && sals.
sals != &sal)
781 result = PyTuple_New (sals.
nelts);
784 for (i = 0; i < sals.
nelts; ++i)
795 PyTuple_SetItem (result, i, obj);
804 return_result = PyTuple_New (2);
811 if (copy && strlen (copy) > 0)
813 unparsed = PyString_FromString (copy);
814 if (unparsed == NULL)
818 return_result = NULL;
828 PyTuple_SetItem (return_result, 0, unparsed);
829 PyTuple_SetItem (return_result, 1, result);
834 return return_result;
841 const char *expr_str;
842 struct value *result = NULL;
844 if (!PyArg_ParseTuple (args,
"s", &expr_str))
867 PyObject *result = NULL;
898 FILE *file,
const char *filename)
927 static struct serial *gdbpy_event_fds[2];
946 while (gdbpy_event_list)
948 PyObject *call_result;
953 gdbpy_event_list = gdbpy_event_list->
next;
954 if (gdbpy_event_list == NULL)
958 call_result = PyObject_CallObject (item->
event, NULL);
959 if (call_result == NULL)
962 Py_XDECREF (call_result);
978 if (!PyArg_ParseTuple (args,
"O", &func))
981 if (!PyCallable_Check (func))
983 PyErr_SetString (PyExc_RuntimeError,
984 _(
"Posted event is not callable"));
992 wakeup = gdbpy_event_list == NULL;
997 *gdbpy_event_list_end =
event;
998 gdbpy_event_list_end = &
event->
next;
1006 return PyErr_SetFromErrno (PyExc_IOError);
1031 const char *current_gdb_prompt)
1034 char *prompt = NULL;
1036 if (!gdb_python_initialized)
1041 if (gdb_python_module
1052 if (PyCallable_Check (hook))
1055 PyObject *current_prompt;
1057 current_prompt = PyString_FromString (current_gdb_prompt);
1058 if (current_prompt == NULL)
1061 result = PyObject_CallFunctionObjArgs (hook, current_prompt, NULL);
1073 if (result != Py_None && ! PyString_Check (result))
1075 PyErr_Format (PyExc_RuntimeError,
1076 _(
"Return from prompt_hook must " \
1077 "be either a Python string, or None"));
1081 if (result != Py_None)
1119 static char *keywords[] = {
"text",
"stream", NULL };
1120 int stream_type = 0;
1122 if (! PyArg_ParseTupleAndKeywords (args, kw,
"s|i", keywords, &arg,
1128 switch (stream_type)
1160 static char *keywords[] = {
"stream", NULL };
1161 int stream_type = 0;
1163 if (! PyArg_ParseTupleAndKeywords (args, kw,
"|i", keywords,
1167 switch (stream_type)
1203 if (gdbpy_should_print_stack == python_excp_none)
1208 else if (gdbpy_should_print_stack == python_excp_full)
1226 PyObject *ptype, *pvalue, *ptraceback;
1227 char *msg = NULL, *
type = NULL;
1229 PyErr_Fetch (&ptype, &pvalue, &ptraceback);
1242 _(
"Error occurred computing Python error" \
1255 Py_XDECREF (pvalue);
1256 Py_XDECREF (ptraceback);
1285 list = PyList_New (0);
1293 if (!item || PyList_Append (list, item) == -1)
1320 const char *filename)
1324 if (!gdb_python_initialized)
1328 gdbpy_current_objfile = objfile;
1333 gdbpy_current_objfile = NULL;
1349 if (!gdb_python_initialized)
1353 gdbpy_current_objfile = objfile;
1355 PyRun_SimpleString (script);
1358 gdbpy_current_objfile = NULL;
1368 if (! gdbpy_current_objfile)
1385 list = PyList_New (0);
1393 if (!item || PyList_Append (list, item) == -1)
1413 PyObject *type_module, *
func = NULL, *printers_obj = NULL;
1415 if (!gdb_python_initialized)
1420 type_module = PyImport_ImportModule (
"gdb.types");
1421 if (type_module == NULL)
1434 printers_obj = PyObject_CallFunctionObjArgs (func, (
char *) NULL);
1435 if (printers_obj == NULL)
1441 Py_XDECREF (type_module);
1456 struct type *
type,
char **prettied_type)
1459 PyObject *type_obj, *type_module = NULL, *
func = NULL;
1460 PyObject *result_obj = NULL;
1462 char *result = NULL;
1464 if (printers_obj == NULL)
1467 if (!gdb_python_initialized)
1473 if (type_obj == NULL)
1479 type_module = PyImport_ImportModule (
"gdb.types");
1480 if (type_module == NULL)
1493 result_obj = PyObject_CallFunctionObjArgs (func, printers_obj,
1494 type_obj, (
char *) NULL);
1495 if (result_obj == NULL)
1501 if (result_obj != Py_None)
1509 Py_XDECREF (type_obj);
1510 Py_XDECREF (type_module);
1512 Py_XDECREF (result_obj);
1515 *prettied_type = result;
1529 if (printers == NULL)
1532 if (!gdb_python_initialized)
1550 error (
_(
"Python scripting is not supported in this copy of GDB."));
1634 size_t progsize, count;
1636 wchar_t *progname_copy;
1643 Start an interactive Python prompt.\n\
1645 To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\
1648 Alternatively, a single-line Python command can be given as an\n\
1649 argument, and if the command is an expression, the result will be\n\
1650 printed. For example:\n\
1652 (gdb) python-interactive 2 + 3\n\
1657 Start a Python interactive prompt.\n\
1659 Python scripting is not supported in this copy of GDB.\n\
1660 This command is only a placeholder.")
1668 Evaluate a Python command.\n\
1670 The command can be given as an argument, for instance:\n\
1674 If no argument is given, the following lines are read and used\n\
1675 as the Python commands. Type a line containing \"end\" to indicate\n\
1676 the end of the command.")
1679 Evaluate a Python command.\n\
1681 Python scripting is not supported in this copy of GDB.\n\
1682 This command is only a placeholder.")
1689 _(
"Prefix command for python preference settings."),
1690 &user_show_python_list,
"show python ", 0,
1694 _(
"Prefix command for python preference settings."),
1695 &user_set_python_list,
"set python ", 0,
1699 &gdbpy_should_print_stack,
_(
"\
1700 Set mode for Python stack dump on error."),
_(
"\
1701 Show the mode of Python stack printing on error."),
_(
"\
1702 none == no stack or message will be printed.\n\
1703 full == a message and a stack will be printed.\n\
1704 message == an error message without a stack will be printed."),
1706 &user_set_python_list,
1707 &user_show_python_list);
1710 #ifdef WITH_PYTHON_PATH
1720 oldloc = setlocale (LC_ALL, NULL);
1721 setlocale (LC_ALL,
"");
1722 progsize = strlen (progname);
1723 if (progsize == (
size_t) -1)
1725 fprintf (stderr,
"Could not convert python path to string\n");
1728 progname_copy = PyMem_Malloc ((progsize + 1) *
sizeof (
wchar_t));
1731 fprintf (stderr,
"out of memory\n");
1734 count = mbstowcs (progname_copy, progname, progsize + 1);
1735 if (count == (
size_t) -1)
1737 fprintf (stderr,
"Could not convert python path to string\n");
1740 setlocale (LC_ALL, oldloc);
1745 Py_SetProgramName (progname_copy);
1747 Py_SetProgramName (progname);
1755 gdb_module = PyModule_Create (&python_GdbModuleDef);
1757 _PyImport_FixupBuiltin (gdb_module,
"_gdb");
1759 gdb_module = Py_InitModule (
"_gdb", python_GdbMethods);
1761 if (gdb_module == NULL)
1765 if (PyModule_AddStringConstant (gdb_module,
"VERSION", (
char*)
version) < 0
1766 || PyModule_AddStringConstant (gdb_module,
"HOST_CONFIG",
1768 || PyModule_AddStringConstant (gdb_module,
"TARGET_CONFIG",
1773 if (PyModule_AddIntConstant (gdb_module,
"STDOUT", 0) < 0
1774 || PyModule_AddIntConstant (gdb_module,
"STDERR", 1) < 0
1775 || PyModule_AddIntConstant (gdb_module,
"STDLOG", 2) < 0)
1778 gdbpy_gdb_error = PyErr_NewException (
"gdb.error", PyExc_RuntimeError, NULL);
1779 if (gdbpy_gdb_error == NULL
1783 gdbpy_gdb_memory_error = PyErr_NewException (
"gdb.MemoryError",
1784 gdbpy_gdb_error, NULL);
1785 if (gdbpy_gdb_memory_error == NULL
1787 gdbpy_gdb_memory_error) < 0)
1790 gdbpy_gdberror_exc = PyErr_NewException (
"gdb.GdbError", NULL, NULL);
1791 if (gdbpy_gdberror_exc == NULL
1793 gdbpy_gdberror_exc) < 0)
1837 gdbpy_to_string_cst = PyString_FromString (
"to_string");
1838 if (gdbpy_to_string_cst == NULL)
1840 gdbpy_children_cst = PyString_FromString (
"children");
1841 if (gdbpy_children_cst == NULL)
1843 gdbpy_display_hint_cst = PyString_FromString (
"display_hint");
1844 if (gdbpy_display_hint_cst == NULL)
1846 gdbpy_doc_cst = PyString_FromString (
"__doc__");
1847 if (gdbpy_doc_cst == NULL)
1849 gdbpy_enabled_cst = PyString_FromString (
"enabled");
1850 if (gdbpy_enabled_cst == NULL)
1852 gdbpy_value_cst = PyString_FromString (
"value");
1853 if (gdbpy_value_cst == NULL)
1862 gdb_python_initialized = 1;
1885 char *gdb_pythondir;
1896 sys_path = PySys_GetObject (
"path");
1899 if (!(sys_path && PyList_Check (sys_path)))
1902 PySys_SetPath (
L"");
1906 sys_path = PySys_GetObject (
"path");
1908 if (sys_path && PyList_Check (sys_path))
1910 PyObject *pythondir;
1913 pythondir = PyString_FromString (gdb_pythondir);
1914 if (pythondir == NULL)
1917 err = PyList_Insert (sys_path, 0, pythondir);
1927 m = PyImport_AddModule (
"__main__");
1931 gdb_python_module = PyImport_ImportModule (
"gdb");
1932 if (gdb_python_module == NULL)
1938 "Could not load the Python gdb module from `%s'.\n"
1939 "Limited Python support is available from the _gdb module.\n"
1940 "Suggest passing --data-directory=/path/to/gdb/data-directory.\n"),
1957 warning (
_(
"internal error: Unhandled Python exception"));
1976 PyMethodDef python_GdbMethods[] =
1979 "Get a value from history" },
1981 "execute (command [, from_tty] [, to_string]) -> [String]\n\
1982 Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
1983 a Python String containing the output of the command if to_string is\n\
1986 "Return a gdb parameter's value" },
1989 "Return a tuple of all breakpoint objects" },
1992 "Find the default visualizer for a Value." },
1995 "Return the current Progspace." },
1997 "Return a sequence of all progspaces." },
2000 "Return the current Objfile being loaded, or None." },
2002 "Return a sequence of all loaded objfiles." },
2005 "newest_frame () -> gdb.Frame.\n\
2006 Return the newest frame object." },
2008 "selected_frame () -> gdb.Frame.\n\
2009 Return the selected frame object." },
2011 "stop_reason_string (Integer) -> String.\n\
2012 Return a string explaining unwind stop reason." },
2015 METH_VARARGS | METH_KEYWORDS,
2016 "lookup_type (name [, block]) -> type\n\
2017 Return a Type corresponding to the given name." },
2019 METH_VARARGS | METH_KEYWORDS,
2020 "lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)\n\
2021 Return a tuple with the symbol corresponding to the given name (or None) and\n\
2022 a boolean indicating if name is a field of the current implied argument\n\
2023 `this' (when the current language is object-oriented)." },
2025 METH_VARARGS | METH_KEYWORDS,
2026 "lookup_global_symbol (name [, domain]) -> symbol\n\
2027 Return the symbol corresponding to the given name (or None)." },
2030 METH_VARARGS | METH_KEYWORDS,
2031 "lookup_objfile (name, [by_build_id]) -> objfile\n\
2032 Look up the specified objfile.\n\
2033 If by_build_id is True, the objfile is looked up by using name\n\
2034 as its build id." },
2037 "Return the block containing the given pc value, or None." },
2039 "solib_name (Long) -> String.\n\
2040 Return the name of the shared library holding a given address, or None." },
2042 "decode_line (String) -> Tuple. Decode a string argument the way\n\
2043 that 'break' or 'edit' does. Return a tuple containing two elements.\n\
2044 The first element contains any unparsed portion of the String parameter\n\
2045 (or None if the string was fully parsed). The second element contains\n\
2046 a tuple that contains all the locations that match, represented as\n\
2047 gdb.Symtab_and_line objects (or None)."},
2049 "parse_and_eval (String) -> Value.\n\
2050 Parse String as an expression, evaluate it, and return the result as a Value."
2053 "find_pc_line (pc) -> Symtab_and_line.\n\
2054 Return the gdb.Symtab_and_line object corresponding to the pc value." },
2057 "Post an event into gdb's event loop." },
2060 "target_charset () -> string.\n\
2061 Return the name of the current target charset." },
2063 "target_wide_charset () -> string.\n\
2064 Return the name of the current target wide charset." },
2067 "string_to_argv (String) -> Array.\n\
2068 Parse String and return an argv-like array.\n\
2069 Arguments are separate by spaces and may be quoted."
2071 {
"write", (PyCFunction)
gdbpy_write, METH_VARARGS | METH_KEYWORDS,
2072 "Write a string using gdb's filtered stream." },
2073 {
"flush", (PyCFunction)
gdbpy_flush, METH_VARARGS | METH_KEYWORDS,
2074 "Flush gdb's filtered stdout stream." },
2076 "selected_thread () -> gdb.InferiorThread.\n\
2077 Return the selected thread object." },
2079 "selected_inferior () -> gdb.Inferior.\n\
2080 Return the selected inferior object." },
2082 "inferiors () -> (gdb.Inferior, ...).\n\
2083 Return a tuple containing all inferiors." },
2084 {NULL, NULL, 0, NULL}
2088 struct PyModuleDef python_GdbModuleDef =
2090 PyModuleDef_HEAD_INIT,
struct gdbarch * target_gdbarch(void)
int gdbpy_initialize_xmethods(void)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
PyObject * gdbpy_breakpoints(PyObject *self, PyObject *args)
void * gdbpy_clone_xmethod_worker_data(const struct extension_language_defn *extlang, void *data)
int gdbpy_initialize_signal_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
int serial_pipe(struct serial *scbs[2])
int gdbpy_initialize_symbols(void)
static PyObject * gdbpy_flush(PyObject *self, PyObject *args, PyObject *kw)
#define PyObject_GetAttrString(obj, attr)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
PyObject * gdbpy_selected_frame(PyObject *self, PyObject *args)
const char * target_charset(struct gdbarch *gdbarch)
PyObject * gdbpy_display_hint_cst
int gdbpy_initialize_inferior_call_post_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
int gdbpy_print_python_errors_p(void)
int gdbpy_initialize_thread(void)
int gdbpy_initialize_py_events(void)
int gdbpy_initialize_finishbreakpoints(void)
static char * compute_python_string(struct command_line *l)
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
enum command_control_type execute_control_command_untraced(struct command_line *cmd)
int gdbpy_initialize_unwind(void)
static enum ext_lang_rc gdbpy_apply_type_printers(const struct extension_language_defn *, const struct ext_lang_type_printers *, struct type *, char **)
int gdbpy_initialize_memory_changed_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
void add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void set_default_source_symtab_and_line(void)
const struct language_defn * python_language
void warning(const char *fmt,...)
static const char * gdbpy_should_print_stack
#define PyEval_ReleaseLock()
static void gdbpy_finish_initialization(const struct extension_language_defn *)
enum ext_lang_bt_status gdbpy_apply_frame_filter(const struct extension_language_defn *extlang, struct frame_info *frame, int flags, enum ext_lang_frame_args args_type, struct ui_out *out, int frame_low, int frame_high)
int gdbpy_initialize_breakpoints(void)
enum ext_lang_rc gdbpy_get_xmethod_arg_types(const struct extension_language_defn *extlang, struct xmethod_worker *worker, int *nargs, struct type ***arg_types)
unsigned long gdb_py_ulongest
enum ext_lang_rc gdbpy_get_matching_xmethod_workers(const struct extension_language_defn *extlang, struct type *obj_type, const char *method_name, xmethod_worker_vec **dm_vec)
struct gdbarch * python_gdbarch
char * gdbpy_obj_to_string(PyObject *obj)
struct symtab_and_line get_current_source_symtab_and_line(void)
void objfile_script_executor_func(const struct extension_language_defn *, struct objfile *, const char *name, const char *script)
struct ui_file * gdb_stdout
static void gdbpy_free_type_printers(const struct extension_language_defn *, struct ext_lang_type_printers *)
static PyObject * gdbpy_target_charset(PyObject *self, PyObject *args)
static void user_show_python(char *args, int from_tty)
int gdbpy_initialize_arch(void)
struct active_ext_lang_state * previous_active
char * ldirname(const char *filename)
int gdbpy_initialize_frames(void)
int gdbpy_initialize_lazy_string(void)
char * execute_command_to_string(char *p, int from_tty)
const struct gdb_exception exception_none
int serial_write(struct serial *scb, const void *buf, size_t count)
static PyObject * gdbpy_target_wide_charset(PyObject *self, PyObject *args)
int gdbpy_initialize_blocks(void)
PyObject * gdbpy_to_string_cst
char * skip_spaces(char *chp)
static void gdbpy_run_events(struct serial *scb, void *context)
void execute_command(char *, int)
struct value * gdbpy_invoke_xmethod(const struct extension_language_defn *extlang, struct xmethod_worker *worker, struct value *obj, struct value **args, int nargs)
PyObject * gdbpy_lookup_type(PyObject *self, PyObject *args, PyObject *kw)
PyObject * gdbpy_enabled_cst
static void gdbpy_eval_from_control_command(const struct extension_language_defn *, struct command_line *cmd)
struct cmd_list_element * prefix
int lookup_cmd_composition(const char *text, struct cmd_list_element **alias, struct cmd_list_element **prefix_cmd, struct cmd_list_element **cmd)
void serial_async(struct serial *scb, serial_event_ftype *handler, void *context)
static const char python_excp_message[]
int gdb_python_initialized
static const char python_excp_none[]
static const char *const python_excp_enums[]
int gdbpy_initialize_register_changed_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
static void restore_python_env(void *p)
int gdbpy_initialize_inferior(void)
int gdbpy_breakpoint_has_cond(const struct extension_language_defn *extlang, struct breakpoint *b)
static int gdbpy_initialized(const struct extension_language_defn *)
int gdbpy_initialize_auto_load(void)
int gdbpy_initialize_continue_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
PyObject * gdbpy_gdb_memory_error
#define GDB_PY_HANDLE_EXCEPTION(Exception)
PyObject * gdb_python_module
void null_cleanup(void *arg)
PyObject * gdbpy_history(PyObject *self, PyObject *args)
struct active_ext_lang_state * set_active_ext_lang(const struct extension_language_defn *)
PyObject * gdbpy_frame_stop_reason_string(PyObject *self, PyObject *args)
struct command_line * get_command_line(enum command_control_type type, char *arg)
struct cmd_list_element * setlist
#define ALL_OBJFILES(obj)
#define PyGILState_Ensure()
int gdbpy_initialize_parameters(void)
static struct gdbpy_event ** gdbpy_event_list_end
#define CATCH(EXCEPTION, MASK)
int gdbpy_initialize_values(void)
struct cleanup * make_cleanup_restore_integer(int *variable)
struct cleanup * ensure_python_env(struct gdbarch *gdbarch, const struct language_defn *language)
static void gdbpy_start_type_printers(const struct extension_language_defn *, struct ext_lang_type_printers *)
void objfile_script_sourcer_func(const struct extension_language_defn *, struct objfile *, FILE *stream, const char *filename)
PyMethodDef python_GdbMethods[]
static struct gdbpy_event * gdbpy_event_list
void initialize_file_ftype(void)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
const char * target_wide_charset(struct gdbarch *gdbarch)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t err
static PyObject * gdbpy_progspaces(PyObject *unused1, PyObject *unused2)
struct gdbpy_event * next
enum ext_lang_bp_stop gdbpy_breakpoint_cond_says_stop(const struct extension_language_defn *extlang, struct breakpoint *b)
PyObject * gdbpy_selected_inferior(PyObject *self, PyObject *args)
PyObject * gdbpy_gdb_error
int gdbpy_initialize_exited_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
PyObject * gdbpy_block_for_pc(PyObject *self, PyObject *args)
struct cmd_list_element * showlist
PyObject * gdbpy_gdberror_exc
#define PyGILState_Release(ARG)
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
struct symtabs_and_lines decode_line_1(char **argptr, int flags, struct symtab *default_symtab, int default_line)
PyObject * gdbpy_newest_frame(PyObject *self, PyObject *args)
int gdbpy_initialize_event(void)
__extension__ enum var_types var_type
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static objfile_script_executor_func gdbpy_execute_objfile_script
PyObject * error_traceback
PyObject * gdbpy_parameter_value(enum var_types type, void *var)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
char * python_string_to_host_string(PyObject *obj)
char * solib_name_from_address(struct program_space *pspace, CORE_ADDR address)
int gdbpy_initialize_commands(void)
PyObject * objfile_to_objfile_object(struct objfile *objfile)
struct gdbarch * get_current_arch(void)
void script_sourcer_func(const struct extension_language_defn *, FILE *stream, const char *filename)
PyObject * gdbpy_lookup_objfile(PyObject *self, PyObject *args, PyObject *kw)
int gdbpy_initialize_objfile(void)
struct cleanup * prevent_dont_repeat(void)
#define PyThreadState_Swap(ARG)
PyObject * value_to_value_object(struct value *val)
enum ext_lang_rc gdbpy_get_xmethod_result_type(const struct extension_language_defn *extlang, struct xmethod_worker *worker, struct value *obj, struct value **args, int nargs, struct type **result_type_ptr)
static PyObject * gdbpy_parse_and_eval(PyObject *self, PyObject *args)
static void user_set_python(char *args, int from_tty)
PyObject * gdbpy_lookup_symbol(PyObject *self, PyObject *args, PyObject *kw)
static int gdbpy_check_quit_flag(const struct extension_language_defn *)
static const char python_excp_full[]
struct ui_file * gdb_stdlog
PyObject * gdbpy_parameter(PyObject *self, PyObject *args)
const struct extension_language_script_ops python_extension_script_ops
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
static PyObject * gdbpy_decode_line(PyObject *self, PyObject *args)
enum ext_lang_rc gdbpy_apply_val_pretty_printer(const struct extension_language_defn *extlang, struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, const struct language_defn *language)
PyObject * gdbpy_selected_thread(PyObject *self, PyObject *args)
int gdbpy_auto_load_enabled(const struct extension_language_defn *extlang)
void gdbpy_preserve_values(const struct extension_language_defn *extlang, struct objfile *objfile, htab_t copied_types)
static int gdbpy_initialize_events(void)
int gdbpy_initialize_symtabs(void)
int gdbpy_initialize_pspace(void)
struct command_line * next
static enum ext_lang_rc gdbpy_before_prompt_hook(const struct extension_language_defn *, const char *current_gdb_prompt)
PyObject * gdbpy_string_to_argv(PyObject *self, PyObject *args)
#define PyEval_InitThreads()
static PyObject * gdbpy_objfiles(PyObject *unused1, PyObject *unused2)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
const struct language_defn * current_language
static void finalize_python(void *ignore)
#define ALL_PSPACES(pspace)
initialize_file_ftype _initialize_python
int gdbpy_initialize_breakpoint_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
static void python_interactive_command(char *arg, int from_tty)
int gdbpy_initialize_types(void)
void gdbpy_convert_exception(struct gdb_exception exception)
PyObject * gdbpy_default_visualizer(PyObject *self, PyObject *args)
struct ui_file * gdb_stderr
static objfile_script_sourcer_func gdbpy_source_objfile_script
static void python_command(char *arg, int from_tty)
void set_prompt(const char *s)
static PyObject * gdbpy_get_current_progspace(PyObject *unused1, PyObject *unused2)
int gdbpy_initialize_inferior_call_pre_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
PyObject * gdbpy_lookup_global_symbol(PyObject *self, PyObject *args, PyObject *kw)
PyObject * gdbpy_children_cst
int gdbpy_initialize_functions(void)
void gdbpy_free_xmethod_worker_data(const struct extension_language_defn *extlang, void *data)
static script_sourcer_func gdbpy_source_script
int gdbpy_initialize_linetable(void)
static PyObject * gdbpy_write(PyObject *self, PyObject *args, PyObject *kw)
static PyObject * gdbpy_get_current_objfile(PyObject *unused1, PyObject *unused2)
struct cleanup * make_cleanup_free_command_lines(struct command_line **arg)
struct cleanup * make_final_cleanup(make_cleanup_ftype *function, void *arg)
static void gdbpy_clear_quit_flag(const struct extension_language_defn *)
struct program_space * current_program_space
struct value * parse_and_eval(const char *exp)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void gdbpy_set_quit_flag(const struct extension_language_defn *)
int gdbpy_initialize_stop_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
static PyObject * gdbpy_solib_name(PyObject *self, PyObject *args)
const struct language_defn * language
static struct cmd_list_element * user_show_python_list
static PyObject * gdbpy_find_pc_line(PyObject *self, PyObject *args)
void gdbpy_print_stack(void)
void bpstat_do_actions(void)
PyObject * gdbpy_value_cst
struct symtab_and_line * sals
static struct cmd_list_element * user_set_python_list
static PyObject * execute_gdb_command(PyObject *self, PyObject *args, PyObject *kw)
static struct objfile * gdbpy_current_objfile
const char * host_charset(void)
static void python_run_simple_file(FILE *file, const char *filename)
int gdbpy_initialize_eventregistry(void)
struct cleanup * make_cleanup_py_decref(PyObject *py)
void gdbpy_initialize_gdb_readline(void)
int serial_readchar(struct serial *scb, int timeout)
void gdb_flush(struct ui_file *file)
static int eval_python_command(const char *command)
int gdbpy_initialize_new_objfile_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
int gdbpy_initialize_clear_objfiles_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
PyObject * gdbpy_inferiors(PyObject *unused, PyObject *unused2)
int gdbpy_initialize_thread_event(void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
static PyObject * gdbpy_post_event(PyObject *self, PyObject *args)
void restore_active_ext_lang(struct active_ext_lang_state *previous)
struct command_line ** body_list
void error(const char *fmt,...)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
PyObject * pspace_to_pspace_object(struct program_space *pspace)
#define PyObject_HasAttrString(obj, attr)
char * gdbpy_exception_to_string(PyObject *ptype, PyObject *pvalue)
void do_cleanups(struct cleanup *old_chain)
enum return_reason reason
const ULONGEST const LONGEST len
PyObject * type_to_type_object(struct type *type)