diff options
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r-- | gdb/python/python-internal.h | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 5262d76..51ace13 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -88,6 +88,8 @@ #include <frameobject.h> #include "py-ref.h" +static_assert (PY_VERSION_HEX >= 0x03040000); + #define Py_TPFLAGS_CHECKTYPES 0 /* If Python.h does not define WITH_THREAD, then the various @@ -135,17 +137,6 @@ typedef unsigned long gdb_py_ulongest; #endif /* HAVE_LONG_LONG */ -#if PY_VERSION_HEX < 0x03020000 -typedef long Py_hash_t; -#endif - -/* PyMem_RawMalloc appeared in Python 3.4. For earlier versions, we can just - fall back to PyMem_Malloc. */ - -#if PY_VERSION_HEX < 0x03040000 -#define PyMem_RawMalloc PyMem_Malloc -#endif - /* A template variable holding the format character (as for Py_BuildValue) for a given type. */ template<typename T> @@ -512,14 +503,20 @@ PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length, const char *encoding, struct type *type); PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2); -PyObject *gdbpy_create_ptid_object (ptid_t ptid); + +/* Return a reference to a new Python Tuple object representing a ptid_t. + The object is a tuple containing (pid, lwp, tid). */ + +extern gdbpy_ref<> gdbpy_create_ptid_object (ptid_t ptid); + PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args); PyObject *gdbpy_selected_inferior (PyObject *self, PyObject *args); PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args); PyObject *gdbpy_parameter_value (const setting &var); gdb::unique_xmalloc_ptr<char> gdbpy_parse_command_name (const char *name, struct cmd_list_element ***base_list, - struct cmd_list_element **start_list); + struct cmd_list_element **start_list, + struct cmd_list_element **prefix_cmd = nullptr); PyObject *gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *kw); @@ -573,6 +570,20 @@ struct symtab_and_line *sal_object_to_symtab_and_line (PyObject *obj); frame_info_ptr frame_object_to_frame_info (PyObject *frame_obj); struct gdbarch *arch_object_to_gdbarch (PyObject *obj); +/* Return true if OBJ is a gdb.Style object. OBJ must not be NULL. */ + +extern bool gdbpy_is_style (PyObject *obj); + +/* Return the ui_file_style from OBJ, a gdb.Style object. OBJ must not be + NULL. + + It is possible that OBJ is a gdb.Style object, but the underlying style + cannot be fetched for some reason. If this happens then a Python error + is set and an empty optional is returned. */ + +extern std::optional<ui_file_style> + gdbpy_style_object_to_ui_file_style (PyObject *obj); + extern PyObject *gdbpy_execute_mi_command (PyObject *self, PyObject *args, PyObject *kw); @@ -1116,6 +1127,14 @@ extern std::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR address, disassemble_info *info); +/* Return the gdb.Corefile object representing the core file loaded into + the program space of INF, or None if there is no core file loaded. INF + must not be NULL. If an error occurs then NULL is returned, and a + suitable Python error will be set. */ + +extern gdbpy_ref<> gdbpy_core_file_from_inferior (inferior *inf); + + /* A wrapper for PyType_Ready that also automatically registers the type in the appropriate module. Returns 0 on success, -1 on error. If MOD is supplied, then the type is added to that module. If MOD |