mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
* python/py-arch.c (archpy_disassemble): Update.
* python/py-type.c (typy_get_composite, typy_lookup_typename) (typy_lookup_type): Use GDB_PY_HANDLE_EXCEPTION. * python/py-utils.c (gdbpy_convert_exception): Return 'void'. * python/python-internal.h (CPYCHECKER_SETS_EXCEPTION): New macro. (GDB_PY_HANDLE_EXCEPTION): Update. (gdbpy_convert_exception): Update. Use CPYCHECKER_SETS_EXCEPTION.
This commit is contained in:
@@ -1,3 +1,14 @@
|
|||||||
|
2013-05-20 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* python/py-arch.c (archpy_disassemble): Update.
|
||||||
|
* python/py-type.c (typy_get_composite, typy_lookup_typename)
|
||||||
|
(typy_lookup_type): Use GDB_PY_HANDLE_EXCEPTION.
|
||||||
|
* python/py-utils.c (gdbpy_convert_exception): Return 'void'.
|
||||||
|
* python/python-internal.h (CPYCHECKER_SETS_EXCEPTION): New
|
||||||
|
macro.
|
||||||
|
(GDB_PY_HANDLE_EXCEPTION): Update.
|
||||||
|
(gdbpy_convert_exception): Update. Use CPYCHECKER_SETS_EXCEPTION.
|
||||||
|
|
||||||
2013-05-20 Tom Tromey <tromey@redhat.com>
|
2013-05-20 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* python/python-internal.h (events_object_type): Remove.
|
* python/python-internal.h (events_object_type): Remove.
|
||||||
|
|||||||
@@ -200,7 +200,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
|||||||
Py_DECREF (result_list);
|
Py_DECREF (result_list);
|
||||||
ui_file_delete (memfile);
|
ui_file_delete (memfile);
|
||||||
|
|
||||||
return gdbpy_convert_exception (except);
|
gdbpy_convert_exception (except);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
as = ui_file_xstrdup (memfile, NULL);
|
as = ui_file_xstrdup (memfile, NULL);
|
||||||
|
|||||||
@@ -443,13 +443,7 @@ typy_get_composite (struct type *type)
|
|||||||
{
|
{
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
}
|
}
|
||||||
/* Don't use GDB_PY_HANDLE_EXCEPTION here because that returns
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
a (NULL) pointer of the wrong type. */
|
|
||||||
if (except.reason < 0)
|
|
||||||
{
|
|
||||||
gdbpy_convert_exception (except);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TYPE_CODE (type) != TYPE_CODE_PTR
|
if (TYPE_CODE (type) != TYPE_CODE_PTR
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_REF)
|
&& TYPE_CODE (type) != TYPE_CODE_REF)
|
||||||
@@ -732,11 +726,7 @@ typy_lookup_typename (const char *type_name, const struct block *block)
|
|||||||
type = lookup_typename (python_language, python_gdbarch,
|
type = lookup_typename (python_language, python_gdbarch,
|
||||||
type_name, block, 0);
|
type_name, block, 0);
|
||||||
}
|
}
|
||||||
if (except.reason < 0)
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
{
|
|
||||||
gdbpy_convert_exception (except);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -785,11 +775,7 @@ typy_lookup_type (struct demangle_component *demangled,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (except.reason < 0)
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
{
|
|
||||||
gdbpy_convert_exception (except);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a type from the switch statement above, just return
|
/* If we have a type from the switch statement above, just return
|
||||||
|
|||||||
@@ -294,9 +294,9 @@ gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue)
|
|||||||
|
|
||||||
/* Convert a GDB exception to the appropriate Python exception.
|
/* Convert a GDB exception to the appropriate Python exception.
|
||||||
|
|
||||||
This sets the Python error indicator, and returns NULL. */
|
This sets the Python error indicator. */
|
||||||
|
|
||||||
PyObject *
|
void
|
||||||
gdbpy_convert_exception (struct gdb_exception exception)
|
gdbpy_convert_exception (struct gdb_exception exception)
|
||||||
{
|
{
|
||||||
PyObject *exc_class;
|
PyObject *exc_class;
|
||||||
@@ -308,7 +308,7 @@ gdbpy_convert_exception (struct gdb_exception exception)
|
|||||||
else
|
else
|
||||||
exc_class = gdbpy_gdb_error;
|
exc_class = gdbpy_gdb_error;
|
||||||
|
|
||||||
return PyErr_Format (exc_class, "%s", exception.message);
|
PyErr_Format (exc_class, "%s", exception.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Converts OBJ to a CORE_ADDR value.
|
/* Converts OBJ to a CORE_ADDR value.
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
#define CPYCHECKER_STEALS_REFERENCE_TO_ARG(n)
|
#define CPYCHECKER_STEALS_REFERENCE_TO_ARG(n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_CPYCHECKER_SETS_EXCEPTION_ATTRIBUTE
|
||||||
|
#define CPYCHECKER_SETS_EXCEPTION __attribute__ ((cpychecker_sets_exception))
|
||||||
|
#else
|
||||||
|
#define CPYCHECKER_SETS_EXCEPTION
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t
|
/* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t
|
||||||
@@ -352,11 +358,14 @@ extern const struct language_defn *python_language;
|
|||||||
|
|
||||||
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
||||||
exception. */
|
exception. */
|
||||||
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
|
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
|
||||||
do { \
|
do { \
|
||||||
if (Exception.reason < 0) \
|
if (Exception.reason < 0) \
|
||||||
return gdbpy_convert_exception (Exception); \
|
{ \
|
||||||
} while (0)
|
gdbpy_convert_exception (Exception); \
|
||||||
|
return NULL; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
||||||
exception. This macro is for use inside setter functions. */
|
exception. This macro is for use inside setter functions. */
|
||||||
@@ -414,7 +423,8 @@ extern PyObject *gdbpy_gdb_error;
|
|||||||
extern PyObject *gdbpy_gdb_memory_error;
|
extern PyObject *gdbpy_gdb_memory_error;
|
||||||
extern PyObject *gdbpy_gdberror_exc;
|
extern PyObject *gdbpy_gdberror_exc;
|
||||||
|
|
||||||
extern PyObject *gdbpy_convert_exception (struct gdb_exception);
|
extern void gdbpy_convert_exception (struct gdb_exception)
|
||||||
|
CPYCHECKER_SETS_EXCEPTION;
|
||||||
|
|
||||||
int get_addr_from_python (PyObject *obj, CORE_ADDR *addr);
|
int get_addr_from_python (PyObject *obj, CORE_ADDR *addr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user