40 PyObject *result = PyTuple_New (argc);
45 for (i = 0; i < argc; ++i)
53 PyTuple_SetItem (result, i, elt);
62 void *cookie,
int argc,
struct value **argv)
67 PyObject *result = NULL;
68 PyObject *callable, *args;
86 error (
_(
"No method named 'invoke' in object."));
89 result = PyObject_Call (callable, args, NULL);
96 PyObject *ptype, *pvalue, *ptraceback;
99 PyErr_Fetch (&ptype, &pvalue, &ptraceback);
114 "convenience function\n"
115 "and then another occurred computing the "
116 "error message.\n"));
128 || msg == NULL || *msg ==
'\0')
130 PyErr_Restore (ptype, pvalue, ptraceback);
132 if (msg != NULL && *msg !=
'\0')
133 error (
_(
"Error occurred in Python convenience function: %s"),
136 error (
_(
"Error occurred in Python convenience function."));
142 Py_XDECREF (ptraceback);
152 error (
_(
"Error while executing Python code."));
165 fnpy_init (PyObject *
self, PyObject *args, PyObject *kwds)
168 char *docstring = NULL;
170 if (! PyArg_ParseTuple (args,
"s", &name))
182 if (docstring == NULL)
194 docstring = xstrdup (
_(
"This function is not documented."));
236 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
237 "GDB function object",
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
#define PyObject_GetAttrString(obj, attr)
static PyObject * convert_values_to_python(int argc, struct value **argv)
int gdbpy_is_string(PyObject *obj)
PyTypeObject fnpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("PyObject")
void printf_filtered(const char *format,...)
static int fnpy_init(PyObject *self, PyObject *args, PyObject *kwds)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
char * python_string_to_host_string(PyObject *obj)
struct cleanup * ensure_python_env(struct gdbarch *gdbarch, const struct language_defn *language)
PyObject * value_to_value_object(struct value *val)
PyObject * gdbpy_gdberror_exc
static struct value * fnpy_call(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
void gdbpy_print_stack(void)
struct value * convert_value_from_python(PyObject *obj)
void add_internal_function(const char *name, const char *doc, internal_function_fn handler, void *cookie)
int gdbpy_initialize_functions(void)
PyTypeObject fnpy_object_type
void error(const char *fmt,...)
#define PyObject_HasAttrString(obj, attr)
char * gdbpy_exception_to_string(PyObject *ptype, PyObject *pvalue)
void do_cleanups(struct cleanup *old_chain)
#define PyVarObject_HEAD_INIT(type, size)