/* Gdb/Python header for private use by Python module.
- Copyright (C) 2008-2017 Free Software Foundation, Inc.
+ Copyright (C) 2008-2018 Free Software Foundation, Inc.
This file is part of GDB.
#define HAVE_SNPRINTF 1
#endif
+/* Another kludge to avoid compilation errors because MinGW defines
+ 'hypot' to '_hypot', but the C++ headers says "using ::hypot". */
+#ifdef __MINGW32__
+# define _hypot hypot
+#endif
+
/* Request clean size types from Python. */
#define PY_SSIZE_T_CLEAN
from including our python/python.h header file. */
#include <Python.h>
#include <frameobject.h>
+#include "py-ref.h"
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K 1
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symbol_object");
extern PyTypeObject event_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-extern PyTypeObject stop_event_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
extern PyTypeObject breakpoint_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_object");
extern PyTypeObject frame_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("frame_object");
+extern PyTypeObject thread_object_type
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
typedef struct gdbpy_breakpoint_object
{
PyObject *inf_obj;
} thread_object;
+struct inferior_object;
+
extern struct cmd_list_element *set_python_list;
extern struct cmd_list_element *show_python_list;
\f
const struct language_defn *language);
extern enum ext_lang_bt_status gdbpy_apply_frame_filter
(const struct extension_language_defn *,
- struct frame_info *frame, int flags, enum ext_lang_frame_args args_type,
+ struct frame_info *frame, frame_filter_flags flags,
+ enum ext_lang_frame_args args_type,
struct ui_out *out, int frame_low, int frame_high);
extern void gdbpy_preserve_values (const struct extension_language_defn *,
struct objfile *objfile,
extern int gdbpy_breakpoint_has_cond (const struct extension_language_defn *,
struct breakpoint *b);
-extern void *gdbpy_clone_xmethod_worker_data
- (const struct extension_language_defn *extlang, void *data);
-extern void gdbpy_free_xmethod_worker_data
- (const struct extension_language_defn *extlang, void *data);
extern 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);
-extern 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);
-extern enum ext_lang_rc gdbpy_get_xmethod_result_type
- (const struct extension_language_defn *extlang,
- struct xmethod_worker *worker,
- struct value *object, struct value **args, int nargs,
- struct type **result_type);
-extern struct value *gdbpy_invoke_xmethod
- (const struct extension_language_defn *extlang,
- struct xmethod_worker *worker,
- struct value *obj, struct value **args, int nargs);
+ std::vector<xmethod_worker_up> *dm_vec);
+
\f
PyObject *gdbpy_history (PyObject *self, PyObject *args);
+PyObject *gdbpy_convenience_variable (PyObject *self, PyObject *args);
+PyObject *gdbpy_set_convenience_variable (PyObject *self, PyObject *args);
PyObject *gdbpy_breakpoints (PyObject *, PyObject *);
PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw);
PyObject *gdbarch_to_arch_object (struct gdbarch *gdbarch);
thread_object *create_thread_object (struct thread_info *tp);
-thread_object *find_thread_object (ptid_t ptid)
- CPYCHECKER_RETURNS_BORROWED_REF;
-PyObject *find_inferior_object (int pid);
-PyObject *inferior_to_inferior_object (struct inferior *inferior);
+thread_object *thread_to_thread_object (thread_info *thr)
+ CPYCHECKER_RETURNS_BORROWED_REF;
+inferior_object *inferior_to_inferior_object (inferior *inf);
const struct block *block_object_to_block (PyObject *obj);
struct symbol *symbol_object_to_symbol (PyObject *obj);
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_py_events (void)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_stop_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_signal_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_breakpoint_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_continue_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_inferior_call_pre_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_inferior_call_post_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_register_changed_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_memory_changed_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_exited_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_thread_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_new_objfile_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_clear_objfiles_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_arch (void)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_xmethods (void)
~gdbpy_enter ();
- gdbpy_enter (const gdbpy_enter &) = delete;
- gdbpy_enter &operator= (const gdbpy_enter &) = delete;
+ DISABLE_COPY_AND_ASSIGN (gdbpy_enter);
private:
/* Note that these are declared here, and not in python.h with the
other pretty-printer functions, because they refer to PyObject. */
-PyObject *apply_varobj_pretty_printer (PyObject *print_obj,
- struct value **replacement,
- struct ui_file *stream);
+gdbpy_ref<> apply_varobj_pretty_printer (PyObject *print_obj,
+ struct value **replacement,
+ struct ui_file *stream);
PyObject *gdbpy_get_varobj_pretty_printer (struct value *value);
gdb::unique_xmalloc_ptr<char> gdbpy_get_display_hint (PyObject *printer);
PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args);