From adc368187c7bc29c3c227cf986dd021973ce6eaf Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Fri, 9 Apr 2010 09:41:43 +0000 Subject: 2010-04-09 Phil Muldoon Thiago Jung Bauermann Tom Tromey * breakpoint.c (condition_command): Simplify. Move condition setting code to ... (set_breakpoint_condition): ... here. New function. * breakpoint.h (set_breakpoint_condition): Declare. * Makefile.in (SUBDIR_PYTHON_OBS): Add py-breakpoint. (SUBDIR_PYTHON_SRCS): Likewise. (py-breakpoint.o): New rule. * python/py-breakpoint.c: New file. * python/python-internal.h (gdbpy_breakpoints) (gdbpy_initialize_breakpoints): Declare. (GDB_PY_SET_HANDLE_EXCEPTION) Define. 2010-04-09 Phil Muldoon * gdb.python/py-breakpoint.exp: New File. * gdb.python/py-breakpoint.C: Ditto. 2010-04-09 Phil Muldoon Thiago Jung Bauermann Tom Tromey * gdb.texinfo (Breakpoints In Python): New Node. --- gdb/python/python-internal.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index e8fcfa9..98d2b3f 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -75,6 +75,7 @@ extern PyTypeObject block_object_type; extern PyTypeObject symbol_object_type; PyObject *gdbpy_history (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 *gdbpy_selected_frame (PyObject *self, PyObject *args); @@ -82,6 +83,7 @@ PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args); PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw); PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length, const char *encoding, struct type *type); +PyObject *gdbpy_get_hook_function (const char *); PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal); PyObject *symtab_to_symtab_object (struct symtab *symtab); @@ -111,6 +113,7 @@ void gdbpy_initialize_blocks (void); void gdbpy_initialize_types (void); void gdbpy_initialize_functions (void); void gdbpy_initialize_objfile (void); +void gdbpy_initialize_breakpoints (void); void gdbpy_initialize_lazy_string (void); struct cleanup *make_cleanup_py_decref (PyObject *py); @@ -131,6 +134,18 @@ extern const struct language_defn *python_language; "%s", Exception.message); \ } while (0) +/* Use this after a TRY_EXCEPT to throw the appropriate Python + exception. This macro is for use inside setter functions. */ +#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \ + do { \ + if (Exception.reason < 0) \ + { \ + PyErr_Format (Exception.reason == RETURN_QUIT \ + ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \ + "%s", Exception.message); \ + return -1; \ + } \ + } while (0) void gdbpy_print_stack (void); -- cgit v1.1