32 #include "readline/tilde.h" 113 extern struct PyModuleDef python_GdbModuleDef;
213 error (
_(
"Python not initialized"));
229 if (PyErr_Occurred ())
233 warning (
_(
"internal error: Unhandled Python exception"));
250 PyErr_SetInterrupt ();
258 return PyOS_InterruptOccurred ();
270 m = PyImport_AddModule (
"__main__");
274 d = PyModule_GetDict (
m);
277 gdbpy_ref<> v (PyRun_StringFlags (command, Py_single_input, d, d, NULL));
305 int len = strlen (arg);
306 char *script = (
char *)
xmalloc (len + 2);
308 strcpy (script, arg);
310 script[len + 1] =
'\0';
323 error (
_(
"Error while executing Python code."));
348 PyRun_SimpleFile (file, filename);
355 gdbpy_ref<> python_file (PyFile_FromString (full_path.get (), (
char *)
"r"));
356 if (python_file == NULL)
359 error (
_(
"Error while opening file: %s"), full_path.get ());
362 PyRun_SimpleFile (PyFile_AsFile (python_file.get ()), filename);
376 for (iter = l; iter; iter = iter->
next)
378 script += iter->
line;
394 error (
_(
"Invalid \"python\" block structure."));
399 ret = PyRun_SimpleString (script.c_str ());
401 error (
_(
"Error while executing Python code."));
416 if (PyRun_SimpleString (arg))
417 error (
_(
"Error while executing Python code."));
443 const char *str = *(
char **) var;
471 if ((* (
int *) var) ==
INT_MAX)
475 return PyLong_FromLong (* (
int *) var);
479 unsigned int val = * (
unsigned int *) var;
483 return PyLong_FromUnsignedLong (val);
487 return PyErr_Format (PyExc_RuntimeError,
488 _(
"Programmer error: unhandled type."));
503 if (! PyArg_ParseTuple (args,
"s", &arg))
506 newarg = concat (
"show ", arg, (
char *) NULL);
521 return PyErr_Format (PyExc_RuntimeError,
522 _(
"Could not find parameter `%s'."), arg);
525 return PyErr_Format (PyExc_RuntimeError,
526 _(
"`%s' is not a parameter."), arg);
537 return PyUnicode_Decode (cset, strlen (cset),
host_charset (), NULL);
547 return PyUnicode_Decode (cset, strlen (cset),
host_charset (), NULL);
556 PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
557 int from_tty, to_string;
558 static const char *keywords[] = {
"command",
"from_tty",
"to_string", NULL };
561 &PyBool_Type, &from_tty_obj,
562 &PyBool_Type, &to_string_obj))
568 int cmp = PyObject_IsTrue (from_tty_obj);
577 int cmp = PyObject_IsTrue (to_string_obj);
614 return PyString_FromString (to_string_res.c_str ());
662 struct symtab_list_type
666 for (
const char *elem: vec)
667 xfree ((
void *) elem);
669 std::vector<const char *> vec;
673 std::vector<symbol_search> symbols;
674 unsigned long count = 0;
675 PyObject *symtab_list = NULL;
676 PyObject *minsyms_p_obj = NULL;
678 unsigned int throttle = 0;
679 static const char *keywords[] = {
"regex",
"minsyms",
"throttle",
681 symtab_list_type symtab_paths;
684 ®ex, &PyBool_Type,
685 &minsyms_p_obj, &throttle,
690 if (minsyms_p_obj != NULL)
692 int cmp = PyObject_IsTrue (minsyms_p_obj);
707 if (symtab_list != NULL)
720 if (PyErr_Occurred ())
728 if (obj_name == NULL)
732 if (obj_name == Py_None)
738 if (filename == NULL)
743 symtab_paths.vec.push_back (
nullptr);
744 symtab_paths.vec.back () = filename.release ();
750 const char **files = symtab_paths.vec.data ();
753 symtab_paths.vec.size (), files);
765 if (p.msymbol.minsym != NULL)
769 if (p.symbol != NULL)
774 if (throttle != 0 && count > throttle)
776 PyErr_SetString (PyExc_RuntimeError,
777 _(
"Number of breakpoints exceeds throttled maximum."));
795 if (p.msymbol.minsym != NULL)
798 if (p.msymbol.minsym == NULL)
810 gdbpy_ref<> argList (Py_BuildValue(
"(s)", symbol_name.c_str ()));
832 const char *arg = NULL;
837 if (! PyArg_ParseTuple (args,
"|s", &arg))
844 std::vector<symtab_and_line> decoded_sals;
849 if (location != NULL)
851 decoded_sals =
decode_line_1 (location.get (), 0, NULL, NULL, 0);
871 result.
reset (PyTuple_New (sals.
size ()));
874 for (
size_t i = 0; i < sals.
size (); ++i)
880 PyTuple_SetItem (result.
get (), i, obj);
885 result.
reset (Py_None);
890 if (return_result == NULL)
893 if (arg != NULL && strlen (arg) > 0)
895 unparsed.
reset (PyString_FromString (arg));
896 if (unparsed == NULL)
901 unparsed.
reset (Py_None);
905 PyTuple_SetItem (return_result.
get (), 0, unparsed.
release ());
906 PyTuple_SetItem (return_result.
get (), 1, result.
release ());
908 return return_result.
release ();
915 const char *expr_str;
916 struct value *result = NULL;
918 if (!PyArg_ParseTuple (args,
"s", &expr_str))
941 PyObject *result = NULL;
981 FILE *file,
const char *filename)
1034 if (call_result == NULL)
1050 if (!PyArg_ParseTuple (args,
"O", &
func))
1053 if (!PyCallable_Check (
func))
1055 PyErr_SetString (PyExc_RuntimeError,
1056 _(
"Posted event is not callable"));
1067 event->event =
func;
1098 const char *current_gdb_prompt)
1120 if (PyCallable_Check (hook.
get ()))
1122 gdbpy_ref<> current_prompt (PyString_FromString (current_gdb_prompt));
1123 if (current_prompt == NULL)
1130 (PyObject_CallFunctionObjArgs (hook.
get (), current_prompt.
get (),
1141 if (result != Py_None && ! PyString_Check (result.
get ()))
1143 PyErr_Format (PyExc_RuntimeError,
1144 _(
"Return from prompt_hook must " \
1145 "be either a Python string, or None"));
1150 if (result != Py_None)
1182 static const char *keywords[] = {
"text",
"stream", NULL };
1183 int stream_type = 0;
1191 switch (stream_type)
1223 static const char *keywords[] = {
"stream", NULL };
1224 int stream_type = 0;
1230 switch (stream_type)
1289 PyObject *ptype, *pvalue, *ptraceback;
1291 PyErr_Fetch (&ptype, &pvalue, &ptraceback);
1305 _(
"Error occurred computing Python error" \
1310 type.get (), msg.get ());
1318 Py_XDECREF (pvalue);
1319 Py_XDECREF (ptraceback);
1354 if (!item || PyList_Append (list.
get (), item) == -1)
1378 const char *filename)
1408 PyRun_SimpleString (script);
1444 if (!item || PyList_Append (list.
get (), item) == -1)
1460 PyObject *printers_obj = NULL;
1467 gdbpy_ref<> type_module (PyImport_ImportModule (
"gdb.types"));
1468 if (type_module == NULL)
1475 "get_type_recognizers"));
1482 printers_obj = PyObject_CallFunctionObjArgs (
func.get (), (
char *) NULL);
1483 if (printers_obj == NULL)
1499 struct type *
type,
char **prettied_type)
1504 if (printers_obj == NULL)
1513 if (type_obj == NULL)
1519 gdbpy_ref<> type_module (PyImport_ImportModule (
"gdb.types"));
1520 if (type_module == NULL)
1527 "apply_type_recognizers"));
1538 if (result_obj == NULL)
1544 if (result_obj == Py_None)
1554 *prettied_type = result.release ();
1567 if (printers == NULL)
1587 error (
_(
"Python scripting is not supported in this copy of GDB."));
1663 size_t progsize, count;
1664 wchar_t *progname_copy;
1667 #ifdef WITH_PYTHON_PATH 1679 setlocale (LC_ALL,
"");
1680 progsize = strlen (progname.get ());
1681 progname_copy = (
wchar_t *) PyMem_Malloc ((progsize + 1) *
sizeof (wchar_t));
1684 fprintf (stderr,
"out of memory\n");
1687 count = mbstowcs (progname_copy, progname.get (), progsize + 1);
1688 if (count == (
size_t) -1)
1690 fprintf (stderr,
"Could not convert python path to string\n");
1693 setlocale (LC_ALL, oldloc.c_str ());
1698 Py_SetProgramName (progname_copy);
1700 Py_SetProgramName (progname.release ());
1708 gdb_module = PyModule_Create (&python_GdbModuleDef);
1719 || PyModule_AddStringConstant (
gdb_module,
"HOST_CONFIG",
1721 || PyModule_AddStringConstant (
gdb_module,
"TARGET_CONFIG",
1726 if (PyModule_AddIntConstant (
gdb_module,
"STDOUT", 0) < 0
1727 || PyModule_AddIntConstant (
gdb_module,
"STDERR", 1) < 0
1728 || PyModule_AddIntConstant (
gdb_module,
"STDLOG", 2) < 0)
1781 #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \ 1782 if (gdbpy_initialize_event_generic (&name##_event_object_type, py_name) < 0) \ 1784 #include "py-event-types.def" 1785 #undef GDB_PY_DEFINE_EVENT_TYPE 1826 Start an interactive Python prompt.\n\ 1828 To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\ 1831 Alternatively, a single-line Python command can be given as an\n\ 1832 argument, and if the command is an expression, the result will be\n\ 1833 printed. For example:\n\ 1835 (gdb) python-interactive 2 + 3\n\ 1840 Start a Python interactive prompt.\n\ 1842 Python scripting is not supported in this copy of GDB.\n\ 1843 This command is only a placeholder.")
1851 Evaluate a Python command.\n\ 1853 The command can be given as an argument, for instance:\n\ 1857 If no argument is given, the following lines are read and used\n\ 1858 as the Python commands. Type a line containing \"end\" to indicate\n\ 1859 the end of the command.")
1862 Evaluate a Python command.\n\ 1864 Python scripting is not supported in this copy of GDB.\n\ 1865 This command is only a placeholder.")
1872 _(
"Prefix command for python preference settings."),
1877 _(
"Prefix command for python preference settings."),
1883 Set mode for Python stack dump on error."),
_(
"\ 1884 Show the mode of Python stack printing on error."),
_(
"\ 1885 none == no stack or message will be printed.\n\ 1886 full == a message and a stack will be printed.\n\ 1887 message == an error message without a stack will be printed."),
1918 if (!(sys_path && PyList_Check (sys_path)))
1927 if (sys_path && PyList_Check (sys_path))
1929 gdbpy_ref<> pythondir (PyString_FromString (gdb_pythondir.c_str ()));
1930 if (pythondir == NULL || PyList_Insert (sys_path, 0, pythondir.
get ()))
1938 m = PyImport_AddModule (
"__main__");
1951 "Could not load the Python gdb module from `%s'.\n" 1952 "Limited Python support is available from the _gdb module.\n" 1953 "Suggest passing --data-directory=/path/to/gdb/data-directory.\n"),
1954 gdb_pythondir.c_str ());
1977 warning (
_(
"internal error: Unhandled Python exception"));
1999 "Get a value from history" },
2001 "execute (command [, from_tty] [, to_string]) -> [String]\n\ 2002 Evaluate command, a string, as a gdb CLI command. Optionally returns\n\ 2003 a Python String containing the output of the command if to_string is\n\ 2006 "Return a gdb parameter's value" },
2009 "Return a tuple of all breakpoint objects" },
2012 "Find the default visualizer for a Value." },
2015 "Return the current Progspace." },
2017 "Return a sequence of all progspaces." },
2020 "Return the current Objfile being loaded, or None." },
2022 "Return a sequence of all loaded objfiles." },
2025 "newest_frame () -> gdb.Frame.\n\ 2026 Return the newest frame object." },
2028 "selected_frame () -> gdb.Frame.\n\ 2029 Return the selected frame object." },
2031 "stop_reason_string (Integer) -> String.\n\ 2032 Return a string explaining unwind stop reason." },
2035 "start_recording ([method] [, format]) -> gdb.Record.\n\ 2036 Start recording with the given method. If no method is given, will fall back\n\ 2037 to the system default method. If no format is given, will fall back to the\n\ 2038 default format for the given method."},
2040 "current_recording () -> gdb.Record.\n\ 2041 Return current recording object." },
2043 "stop_recording () -> None.\n\ 2044 Stop current recording." },
2047 METH_VARARGS | METH_KEYWORDS,
2048 "lookup_type (name [, block]) -> type\n\ 2049 Return a Type corresponding to the given name." },
2051 METH_VARARGS | METH_KEYWORDS,
2052 "lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)\n\ 2053 Return a tuple with the symbol corresponding to the given name (or None) and\n\ 2054 a boolean indicating if name is a field of the current implied argument\n\ 2055 `this' (when the current language is object-oriented)." },
2057 METH_VARARGS | METH_KEYWORDS,
2058 "lookup_global_symbol (name [, domain]) -> symbol\n\ 2059 Return the symbol corresponding to the given name (or None)." },
2062 METH_VARARGS | METH_KEYWORDS,
2063 "lookup_objfile (name, [by_build_id]) -> objfile\n\ 2064 Look up the specified objfile.\n\ 2065 If by_build_id is True, the objfile is looked up by using name\n\ 2066 as its build id." },
2069 "Return the block containing the given pc value, or None." },
2071 "solib_name (Long) -> String.\n\ 2072 Return the name of the shared library holding a given address, or None." },
2074 "decode_line (String) -> Tuple. Decode a string argument the way\n\ 2075 that 'break' or 'edit' does. Return a tuple containing two elements.\n\ 2076 The first element contains any unparsed portion of the String parameter\n\ 2077 (or None if the string was fully parsed). The second element contains\n\ 2078 a tuple that contains all the locations that match, represented as\n\ 2079 gdb.Symtab_and_line objects (or None)."},
2081 "parse_and_eval (String) -> Value.\n\ 2082 Parse String as an expression, evaluate it, and return the result as a Value." 2085 "find_pc_line (pc) -> Symtab_and_line.\n\ 2086 Return the gdb.Symtab_and_line object corresponding to the pc value." },
2089 "Post an event into gdb's event loop." },
2092 "target_charset () -> string.\n\ 2093 Return the name of the current target charset." },
2095 "target_wide_charset () -> string.\n\ 2096 Return the name of the current target wide charset." },
2097 {
"rbreak", (PyCFunction)
gdbpy_rbreak, METH_VARARGS | METH_KEYWORDS,
2098 "rbreak (Regex) -> List.\n\ 2099 Return a Tuple containing gdb.Breakpoint objects that match the given Regex." },
2101 "string_to_argv (String) -> Array.\n\ 2102 Parse String and return an argv-like array.\n\ 2103 Arguments are separate by spaces and may be quoted." 2105 {
"write", (PyCFunction)
gdbpy_write, METH_VARARGS | METH_KEYWORDS,
2106 "Write a string using gdb's filtered stream." },
2107 {
"flush", (PyCFunction)
gdbpy_flush, METH_VARARGS | METH_KEYWORDS,
2108 "Flush gdb's filtered stdout stream." },
2110 "selected_thread () -> gdb.InferiorThread.\n\ 2111 Return the selected thread object." },
2113 "selected_inferior () -> gdb.Inferior.\n\ 2114 Return the selected inferior object." },
2116 "inferiors () -> (gdb.Inferior, ...).\n\ 2117 Return a tuple containing all inferiors." },
2120 "invalidate_cached_frames () -> None.\n\ 2121 Invalidate any cached frame objects in gdb.\n\ 2122 Intended for internal use only." },
2124 {NULL, NULL, 0, NULL}
2128 struct PyModuleDef python_GdbModuleDef =
2130 PyModuleDef_HEAD_INIT,
2143 #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \ 2144 PyTypeObject name##_event_object_type \ 2145 CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \ 2147 PyVarObject_HEAD_INIT (NULL, 0) \ 2149 sizeof (event_object), \ 2166 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, \ 2185 #include "py-event-types.def" 2186 #undef GDB_PY_DEFINE_EVENT_TYPE struct gdbarch * target_gdbarch(void)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
int gdbpy_initialize_xmethods(void)
PyObject * gdbpy_start_recording(PyObject *self, PyObject *args)
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_symbols(void)
static PyObject * gdbpy_flush(PyObject *self, PyObject *args, PyObject *kw)
#define PyObject_GetAttrString(obj, attr)
PyObject * gdbpy_selected_frame(PyObject *self, PyObject *args)
const char * target_charset(struct gdbarch *gdbarch)
PyObject * gdbpy_display_hint_cst
std::vector< symbol_search > search_symbols(const char *regexp, enum search_domain kind, int nfiles, const char *files[])
int gdbpy_print_python_errors_p(void)
int gdbpy_initialize_thread(void)
int gdbpy_initialize_py_events(void)
int gdbpy_initialize_finishbreakpoints(void)
gdb::unique_xmalloc_ptr< char > gdbpy_obj_to_string(PyObject *obj)
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
static void python_interactive_command(const char *arg, int from_tty)
#define MSYMBOL_LINKAGE_NAME(symbol)
enum command_control_type execute_control_command_untraced(struct command_line *cmd)
constexpr size_type size() const noexcept
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 **)
PyObject * gdbpy_current_recording(PyObject *self, PyObject *args)
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)
command_line_up get_command_line(enum command_control_type type, const char *arg)
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
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)
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)
int gdbpy_initialize_arch(void)
int gdbpy_initialize_frames(void)
struct ui_out * interp_ui_out(struct interp *interp)
int gdbpy_initialize_lazy_string(void)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
const struct gdb_exception exception_none
static PyObject * gdbpy_target_wide_charset(PyObject *self, PyObject *args)
int gdbpy_initialize_blocks(void)
PyObject * gdbpy_to_string_cst
int gdbpy_initialize_record(void)
static PyObject * gdbpy_parameter(PyObject *self, PyObject *args)
char * skip_spaces(char *chp)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
const struct extension_language_defn extension_language_python
static void gdbpy_run_events(int error, gdb_client_data client_data)
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)
static const char python_excp_message[]
event_location_up string_to_event_location_basic(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
int gdb_python_initialized
static const char python_excp_none[]
static PyObject * gdbpy_invalidate_cached_frames(PyObject *self, PyObject *args)
static const char *const python_excp_enums[]
int gdbpy_initialize_inferior(void)
void add_file_handler(int fd, handler_func *proc, gdb_client_data client_data)
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)
void execute_command(const char *, int)
const char * symtab_to_fullname(struct symtab *s)
PyObject * gdbpy_gdb_memory_error
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
PyObject * gdb_python_module
#define PyErr_NewException
PyObject * gdbpy_history(PyObject *self, PyObject *args)
int gdbpy_initialize_btrace(void)
struct active_ext_lang_state * set_active_ext_lang(const struct extension_language_defn *)
PyObject * gdbpy_frame_stop_reason_string(PyObject *self, PyObject *args)
static void user_set_python(const char *args, int from_tty)
struct cmd_list_element * setlist
struct active_ext_lang_state * m_previous_active
#define PyGILState_Ensure()
int gdbpy_initialize_parameters(void)
static struct gdbpy_event ** gdbpy_event_list_end
std::string ldirname(const char *filename)
PyObject * host_string_to_python_string(const char *str)
#define CATCH(EXCEPTION, MASK)
int gdbpy_initialize_values(void)
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)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
PyMethodDef python_GdbMethods[]
static struct gdbpy_event * gdbpy_event_list
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
objfile(bfd *, const char *, objfile_flags)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
std::string execute_command_to_string(const char *p, int from_tty)
const char * target_wide_charset(struct gdbarch *gdbarch)
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
PyObject * gdbpy_block_for_pc(PyObject *self, PyObject *args)
struct cmd_list_element * showlist
int serial_event_fd(struct serial_event *event)
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)
const struct language_defn * m_language
scoped_restore_tmpl< int > prevent_dont_repeat(void)
PyObject * gdbpy_newest_frame(PyObject *self, PyObject *args)
int gdbpy_initialize_event(void)
__extension__ enum var_types var_type
static objfile_script_executor_func gdbpy_execute_objfile_script
PyObject * gdbpy_parameter_value(enum var_types type, void *var)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
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_instruction(void)
static struct serial_event * gdbpy_serial_event
int gdbpy_initialize_objfile(void)
#define SYMBOL_LINKAGE_NAME(symbol)
#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 std::string compute_python_string(struct command_line *l)
std::unique_ptr< event_location, event_location_deleter > event_location_up
gdb::unique_xmalloc_ptr< char > python_string_to_host_string(PyObject *obj)
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[]
static void user_show_python(const char *args, int from_tty)
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)
PyObject * gdbpy_selected_thread(PyObject *self, PyObject *args)
PyObject * m_error_traceback
int gdbpy_auto_load_enabled(const struct extension_language_defn *extlang)
std::vector< symtab_and_line > decode_line_1(const struct event_location *location, int flags, struct program_space *search_pspace, struct symtab *default_symtab, int default_line)
void gdbpy_preserve_values(const struct extension_language_defn *extlang, struct objfile *objfile, htab_t copied_types)
static int gdbpy_initialize_events(void)
events_object gdb_py_events
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)
static void python_command(const char *arg, int from_tty)
#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)
PyTypeObject breakpoint_object_type
const struct language_defn * current_language
void serial_event_clear(struct serial_event *event)
static void finalize_python(void *ignore)
#define ALL_PSPACES(pspace)
gdbpy_enter(struct gdbarch *gdbarch, const struct language_defn *language)
enum ext_lang_rc gdbpy_apply_val_pretty_printer(const struct extension_language_defn *extlang, struct type *type, LONGEST embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options, const struct language_defn *language)
int gdbpy_initialize_types(void)
constexpr bool empty() const noexcept
void gdbpy_convert_exception(struct gdb_exception exception)
PyObject * gdbpy_default_visualizer(PyObject *self, PyObject *args)
static objfile_script_sourcer_func gdbpy_source_objfile_script
struct serial_event * make_serial_event(void)
static bool do_finish_initialization(const struct extension_language_defn *extlang)
void set_prompt(const char *s)
static PyObject * gdbpy_get_current_progspace(PyObject *unused1, PyObject *unused2)
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)
void serial_event_set(struct serial_event *event)
struct cleanup * make_final_cleanup(make_cleanup_ftype *function, void *arg)
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 *)
const struct extension_language_ops python_extension_ops
static PyObject * gdbpy_solib_name(PyObject *self, PyObject *args)
int evpy_emit_event(PyObject *event, eventregistry_object *registry)
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)
void _initialize_python(void)
gdb::unique_xmalloc_ptr< char > gdbpy_exception_to_string(PyObject *ptype, PyObject *pvalue)
PyObject * gdbpy_value_cst
static struct cmd_list_element * user_set_python_list
static PyObject * execute_gdb_command(PyObject *self, PyObject *args, PyObject *kw)
int evregpy_no_listeners_p(eventregistry_object *registry)
static struct objfile * gdbpy_current_objfile
gdb::unique_xmalloc_ptr< char > python_string_to_target_string(PyObject *obj)
const char * host_charset(void)
std::unique_ptr< command_line, command_lines_deleter > command_line_up
static void python_run_simple_file(FILE *file, const char *filename)
int gdbpy_initialize_eventregistry(void)
void gdbpy_initialize_gdb_readline(void)
void reinit_frame_cache(void)
void gdb_flush(struct ui_file *file)
#define ALL_OBJFILES(obj)
static int eval_python_command(const char *command)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
PyObject * gdbpy_inferiors(PyObject *unused, PyObject *unused2)
struct gdbarch * m_gdbarch
static PyObject * gdbpy_post_event(PyObject *self, PyObject *args)
static bool do_start_initialization()
struct symtab * symbol_symtab(const struct symbol *symbol)
PyObject * gdbpy_stop_recording(PyObject *self, PyObject *args)
void restore_active_ext_lang(struct active_ext_lang_state *previous)
struct command_line ** body_list
static PyObject * gdbpy_rbreak(PyObject *self, PyObject *args, PyObject *kw)
void error(const char *fmt,...)
PyObject * pspace_to_pspace_object(struct program_space *pspace)
#define PyObject_HasAttrString(obj, attr)
struct interp * interp_lookup(struct ui *ui, const char *name)
PyObject * type_to_type_object(struct type *type)