1 /* Python interface to breakpoints
3 Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "exceptions.h"
23 #include "python-internal.h"
25 #include "breakpoint.h"
27 #include "gdbthread.h"
29 #include "cli/cli-script.h"
31 #include "arch-utils.h"
34 static PyTypeObject breakpoint_object_type;
36 /* Number of live breakpoints. */
39 /* Variables used to pass information between the Breakpoint
40 constructor and the breakpoint-created hook function. */
41 static breakpoint_object *bppy_pending_object;
43 /* Function that is called when a Python condition is evaluated. */
44 static char * const stop_func = "stop";
46 struct breakpoint_object
50 /* The breakpoint number according to gdb. */
53 /* The gdb breakpoint object, or NULL if the breakpoint has been
55 struct breakpoint *bp;
58 /* Require that BREAKPOINT be a valid breakpoint ID; throw a Python
59 exception if it is invalid. */
60 #define BPPY_REQUIRE_VALID(Breakpoint) \
62 if ((Breakpoint)->bp == NULL) \
63 return PyErr_Format (PyExc_RuntimeError, \
64 _("Breakpoint %d is invalid."), \
65 (Breakpoint)->number); \
68 /* Require that BREAKPOINT be a valid breakpoint ID; throw a Python
69 exception if it is invalid. This macro is for use in setter functions. */
70 #define BPPY_SET_REQUIRE_VALID(Breakpoint) \
72 if ((Breakpoint)->bp == NULL) \
74 PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \
75 (Breakpoint)->number); \
80 /* This is used to initialize various gdb.bp_* constants. */
89 /* Entries related to the type of user set breakpoints. */
90 static struct pybp_code pybp_codes[] =
92 { "BP_NONE", bp_none},
93 { "BP_BREAKPOINT", bp_breakpoint},
94 { "BP_WATCHPOINT", bp_watchpoint},
95 { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint},
96 { "BP_READ_WATCHPOINT", bp_read_watchpoint},
97 { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint},
98 {NULL} /* Sentinel. */
101 /* Entries related to the type of watchpoint. */
102 static struct pybp_code pybp_watch_types[] =
104 { "WP_READ", hw_read},
105 { "WP_WRITE", hw_write},
106 { "WP_ACCESS", hw_access},
107 {NULL} /* Sentinel. */
110 /* Python function which checks the validity of a breakpoint object. */
112 bppy_is_valid (PyObject *self, PyObject *args)
114 breakpoint_object *self_bp = (breakpoint_object *) self;
121 /* Python function to test whether or not the breakpoint is enabled. */
123 bppy_get_enabled (PyObject *self, void *closure)
125 breakpoint_object *self_bp = (breakpoint_object *) self;
127 BPPY_REQUIRE_VALID (self_bp);
130 if (self_bp->bp->enable_state == bp_enabled)
135 /* Python function to test whether or not the breakpoint is silent. */
137 bppy_get_silent (PyObject *self, void *closure)
139 breakpoint_object *self_bp = (breakpoint_object *) self;
141 BPPY_REQUIRE_VALID (self_bp);
142 if (self_bp->bp->silent)
147 /* Python function to set the enabled state of a breakpoint. */
149 bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
151 breakpoint_object *self_bp = (breakpoint_object *) self;
153 volatile struct gdb_exception except;
155 BPPY_SET_REQUIRE_VALID (self_bp);
157 if (newvalue == NULL)
159 PyErr_SetString (PyExc_TypeError,
160 _("Cannot delete `enabled' attribute."));
164 else if (! PyBool_Check (newvalue))
166 PyErr_SetString (PyExc_TypeError,
167 _("The value of `enabled' must be a boolean."));
171 cmp = PyObject_IsTrue (newvalue);
175 TRY_CATCH (except, RETURN_MASK_ALL)
178 enable_breakpoint (self_bp->bp);
180 disable_breakpoint (self_bp->bp);
182 GDB_PY_SET_HANDLE_EXCEPTION (except);
187 /* Python function to set the 'silent' state of a breakpoint. */
189 bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure)
191 breakpoint_object *self_bp = (breakpoint_object *) self;
194 BPPY_SET_REQUIRE_VALID (self_bp);
196 if (newvalue == NULL)
198 PyErr_SetString (PyExc_TypeError,
199 _("Cannot delete `silent' attribute."));
202 else if (! PyBool_Check (newvalue))
204 PyErr_SetString (PyExc_TypeError,
205 _("The value of `silent' must be a boolean."));
209 cmp = PyObject_IsTrue (newvalue);
213 breakpoint_set_silent (self_bp->bp, cmp);
218 /* Python function to set the thread of a breakpoint. */
220 bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
222 breakpoint_object *self_bp = (breakpoint_object *) self;
225 BPPY_SET_REQUIRE_VALID (self_bp);
227 if (newvalue == NULL)
229 PyErr_SetString (PyExc_TypeError,
230 _("Cannot delete `thread' attribute."));
233 else if (PyInt_Check (newvalue))
235 if (! gdb_py_int_as_long (newvalue, &id))
238 if (! valid_thread_id (id))
240 PyErr_SetString (PyExc_RuntimeError,
241 _("Invalid thread ID."));
245 else if (newvalue == Py_None)
249 PyErr_SetString (PyExc_TypeError,
250 _("The value of `thread' must be an integer or None."));
254 breakpoint_set_thread (self_bp->bp, id);
259 /* Python function to set the (Ada) task of a breakpoint. */
261 bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
263 breakpoint_object *self_bp = (breakpoint_object *) self;
266 volatile struct gdb_exception except;
268 BPPY_SET_REQUIRE_VALID (self_bp);
270 if (newvalue == NULL)
272 PyErr_SetString (PyExc_TypeError,
273 _("Cannot delete `task' attribute."));
276 else if (PyInt_Check (newvalue))
278 if (! gdb_py_int_as_long (newvalue, &id))
281 TRY_CATCH (except, RETURN_MASK_ALL)
283 valid_id = valid_task_id (id);
285 GDB_PY_SET_HANDLE_EXCEPTION (except);
289 PyErr_SetString (PyExc_RuntimeError,
290 _("Invalid task ID."));
294 else if (newvalue == Py_None)
298 PyErr_SetString (PyExc_TypeError,
299 _("The value of `task' must be an integer or None."));
303 breakpoint_set_task (self_bp->bp, id);
308 /* Python function which deletes the underlying GDB breakpoint. This
309 triggers the breakpoint_deleted observer which will call
310 gdbpy_breakpoint_deleted; that function cleans up the Python
314 bppy_delete_breakpoint (PyObject *self, PyObject *args)
316 breakpoint_object *self_bp = (breakpoint_object *) self;
317 volatile struct gdb_exception except;
319 BPPY_REQUIRE_VALID (self_bp);
321 TRY_CATCH (except, RETURN_MASK_ALL)
323 delete_breakpoint (self_bp->bp);
325 GDB_PY_HANDLE_EXCEPTION (except);
331 /* Python function to set the ignore count of a breakpoint. */
333 bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
335 breakpoint_object *self_bp = (breakpoint_object *) self;
337 volatile struct gdb_exception except;
339 BPPY_SET_REQUIRE_VALID (self_bp);
341 if (newvalue == NULL)
343 PyErr_SetString (PyExc_TypeError,
344 _("Cannot delete `ignore_count' attribute."));
347 else if (! PyInt_Check (newvalue))
349 PyErr_SetString (PyExc_TypeError,
350 _("The value of `ignore_count' must be an integer."));
354 if (! gdb_py_int_as_long (newvalue, &value))
360 TRY_CATCH (except, RETURN_MASK_ALL)
362 set_ignore_count (self_bp->number, (int) value, 0);
364 GDB_PY_SET_HANDLE_EXCEPTION (except);
369 /* Python function to set the hit count of a breakpoint. */
371 bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure)
373 breakpoint_object *self_bp = (breakpoint_object *) self;
375 BPPY_SET_REQUIRE_VALID (self_bp);
377 if (newvalue == NULL)
379 PyErr_SetString (PyExc_TypeError,
380 _("Cannot delete `hit_count' attribute."));
387 if (! gdb_py_int_as_long (newvalue, &value))
392 PyErr_SetString (PyExc_AttributeError,
393 _("The value of `hit_count' must be zero."));
398 self_bp->bp->hit_count = 0;
403 /* Python function to get the location of a breakpoint. */
405 bppy_get_location (PyObject *self, void *closure)
408 breakpoint_object *obj = (breakpoint_object *) self;
410 BPPY_REQUIRE_VALID (obj);
412 if (obj->bp->type != bp_breakpoint)
415 str = obj->bp->addr_string;
419 return PyString_Decode (str, strlen (str), host_charset (), NULL);
422 /* Python function to get the breakpoint expression. */
424 bppy_get_expression (PyObject *self, void *closure)
427 breakpoint_object *obj = (breakpoint_object *) self;
428 struct watchpoint *wp;
430 BPPY_REQUIRE_VALID (obj);
432 if (!is_watchpoint (obj->bp))
435 wp = (struct watchpoint *) obj->bp;
437 str = wp->exp_string;
441 return PyString_Decode (str, strlen (str), host_charset (), NULL);
444 /* Python function to get the condition expression of a breakpoint. */
446 bppy_get_condition (PyObject *self, void *closure)
449 breakpoint_object *obj = (breakpoint_object *) self;
451 BPPY_REQUIRE_VALID (obj);
453 str = obj->bp->cond_string;
457 return PyString_Decode (str, strlen (str), host_charset (), NULL);
460 /* Returns 0 on success. Returns -1 on error, with a python exception set.
464 bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
467 breakpoint_object *self_bp = (breakpoint_object *) self;
468 volatile struct gdb_exception except;
470 BPPY_SET_REQUIRE_VALID (self_bp);
472 if (newvalue == NULL)
474 PyErr_SetString (PyExc_TypeError,
475 _("Cannot delete `condition' attribute."));
478 else if (newvalue == Py_None)
482 exp = python_string_to_host_string (newvalue);
487 TRY_CATCH (except, RETURN_MASK_ALL)
489 set_breakpoint_condition (self_bp->bp, exp, 0);
492 if (newvalue != Py_None)
495 GDB_PY_SET_HANDLE_EXCEPTION (except);
500 /* Python function to get the commands attached to a breakpoint. */
502 bppy_get_commands (PyObject *self, void *closure)
504 breakpoint_object *self_bp = (breakpoint_object *) self;
505 struct breakpoint *bp = self_bp->bp;
507 volatile struct gdb_exception except;
508 struct ui_file *string_file;
509 struct cleanup *chain;
513 BPPY_REQUIRE_VALID (self_bp);
515 if (! self_bp->bp->commands)
518 string_file = mem_fileopen ();
519 chain = make_cleanup_ui_file_delete (string_file);
521 ui_out_redirect (current_uiout, string_file);
522 TRY_CATCH (except, RETURN_MASK_ALL)
524 print_command_lines (current_uiout, breakpoint_commands (bp), 0);
526 ui_out_redirect (current_uiout, NULL);
527 GDB_PY_HANDLE_EXCEPTION (except);
529 cmdstr = ui_file_xstrdup (string_file, &length);
530 make_cleanup (xfree, cmdstr);
531 result = PyString_Decode (cmdstr, strlen (cmdstr), host_charset (), NULL);
536 /* Python function to get the breakpoint type. */
538 bppy_get_type (PyObject *self, void *closure)
540 breakpoint_object *self_bp = (breakpoint_object *) self;
542 BPPY_REQUIRE_VALID (self_bp);
544 return PyInt_FromLong (self_bp->bp->type);
547 /* Python function to get the visibility of the breakpoint. */
550 bppy_get_visibility (PyObject *self, void *closure)
552 breakpoint_object *self_bp = (breakpoint_object *) self;
554 BPPY_REQUIRE_VALID (self_bp);
556 if (self_bp->bp->number < 0)
562 /* Python function to get the breakpoint's number. */
564 bppy_get_number (PyObject *self, void *closure)
566 breakpoint_object *self_bp = (breakpoint_object *) self;
568 BPPY_REQUIRE_VALID (self_bp);
570 return PyInt_FromLong (self_bp->number);
573 /* Python function to get the breakpoint's thread ID. */
575 bppy_get_thread (PyObject *self, void *closure)
577 breakpoint_object *self_bp = (breakpoint_object *) self;
579 BPPY_REQUIRE_VALID (self_bp);
581 if (self_bp->bp->thread == -1)
584 return PyInt_FromLong (self_bp->bp->thread);
587 /* Python function to get the breakpoint's task ID (in Ada). */
589 bppy_get_task (PyObject *self, void *closure)
591 breakpoint_object *self_bp = (breakpoint_object *) self;
593 BPPY_REQUIRE_VALID (self_bp);
595 if (self_bp->bp->task == 0)
598 return PyInt_FromLong (self_bp->bp->task);
601 /* Python function to get the breakpoint's hit count. */
603 bppy_get_hit_count (PyObject *self, void *closure)
605 breakpoint_object *self_bp = (breakpoint_object *) self;
607 BPPY_REQUIRE_VALID (self_bp);
609 return PyInt_FromLong (self_bp->bp->hit_count);
612 /* Python function to get the breakpoint's ignore count. */
614 bppy_get_ignore_count (PyObject *self, void *closure)
616 breakpoint_object *self_bp = (breakpoint_object *) self;
618 BPPY_REQUIRE_VALID (self_bp);
620 return PyInt_FromLong (self_bp->bp->ignore_count);
623 /* Python function to create a new breakpoint. */
625 bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
627 static char *keywords[] = { "spec", "type", "wp_class", "internal", NULL };
629 int type = bp_breakpoint;
630 int access_type = hw_write;
631 PyObject *internal = NULL;
633 volatile struct gdb_exception except;
635 if (! PyArg_ParseTupleAndKeywords (args, kwargs, "s|iiO", keywords,
636 &spec, &type, &access_type, &internal))
641 internal_bp = PyObject_IsTrue (internal);
642 if (internal_bp == -1)
646 bppy_pending_object = (breakpoint_object *) self;
647 bppy_pending_object->number = -1;
648 bppy_pending_object->bp = NULL;
650 TRY_CATCH (except, RETURN_MASK_ALL)
652 char *copy = xstrdup (spec);
653 struct cleanup *cleanup = make_cleanup (xfree, copy);
659 create_breakpoint (python_gdbarch,
665 &bkpt_breakpoint_ops,
671 if (access_type == hw_write)
672 watch_command_wrapper (copy, 0, internal_bp);
673 else if (access_type == hw_access)
674 awatch_command_wrapper (copy, 0, internal_bp);
675 else if (access_type == hw_read)
676 rwatch_command_wrapper (copy, 0, internal_bp);
678 error(_("Cannot understand watchpoint access type."));
682 error(_("Do not understand breakpoint type to set."));
685 do_cleanups (cleanup);
687 if (except.reason < 0)
689 PyErr_Format (except.reason == RETURN_QUIT
690 ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
691 "%s", except.message);
695 BPPY_SET_REQUIRE_VALID ((breakpoint_object *) self);
702 build_bp_list (struct breakpoint *b, void *arg)
704 PyObject *list = arg;
705 PyObject *bp = (PyObject *) b->py_bp_object;
708 /* Not all breakpoints will have a companion Python object.
709 Only breakpoints that were created via bppy_new, or
710 breakpoints that were created externally and are tracked by
711 the Python Scripting API. */
713 iserr = PyList_Append (list, bp);
721 /* Static function to return a tuple holding all breakpoints. */
724 gdbpy_breakpoints (PyObject *self, PyObject *args)
726 PyObject *list, *tuple;
731 list = PyList_New (0);
735 /* If iteratre_over_breakpoints returns non NULL it signals an error
736 condition. In that case abandon building the list and return
738 if (iterate_over_breakpoints (build_bp_list, list) != NULL)
744 tuple = PyList_AsTuple (list);
750 /* Call the "stop" method (if implemented) in the breakpoint
751 class. If the method returns True, the inferior will be
752 stopped at the breakpoint. Otherwise the inferior will be
753 allowed to continue. */
756 gdbpy_should_stop (struct breakpoint_object *bp_obj)
760 PyObject *py_bp = (PyObject *) bp_obj;
761 struct breakpoint *b = bp_obj->bp;
762 struct gdbarch *garch = b->gdbarch ? b->gdbarch : get_current_arch ();
763 struct cleanup *cleanup = ensure_python_env (garch, current_language);
765 if (PyObject_HasAttrString (py_bp, stop_func))
767 PyObject *result = PyObject_CallMethod (py_bp, stop_func, NULL);
771 int evaluate = PyObject_IsTrue (result);
774 gdbpy_print_stack ();
776 /* If the "stop" function returns False that means
777 the Python breakpoint wants GDB to continue. */
784 gdbpy_print_stack ();
786 do_cleanups (cleanup);
791 /* Checks if the "stop" method exists in this breakpoint.
792 Used by condition_command to ensure mutual exclusion of breakpoint
796 gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
799 PyObject *py_bp = (PyObject *) bp_obj;
800 struct gdbarch *garch = bp_obj->bp->gdbarch ? bp_obj->bp->gdbarch :
802 struct cleanup *cleanup = ensure_python_env (garch, current_language);
805 has_func = PyObject_HasAttrString (py_bp, stop_func);
807 do_cleanups (cleanup);
814 /* Event callback functions. */
816 /* Callback that is used when a breakpoint is created. This function
817 will create a new Python breakpoint object. */
819 gdbpy_breakpoint_created (struct breakpoint *bp)
821 breakpoint_object *newbp;
822 PyGILState_STATE state;
824 if (bp->number < 0 && bppy_pending_object == NULL)
827 if (bp->type != bp_breakpoint
828 && bp->type != bp_watchpoint
829 && bp->type != bp_hardware_watchpoint
830 && bp->type != bp_read_watchpoint
831 && bp->type != bp_access_watchpoint)
834 state = PyGILState_Ensure ();
836 if (bppy_pending_object)
838 newbp = bppy_pending_object;
839 bppy_pending_object = NULL;
842 newbp = PyObject_New (breakpoint_object, &breakpoint_object_type);
845 newbp->number = bp->number;
847 newbp->bp->py_bp_object = newbp;
853 PyErr_SetString (PyExc_RuntimeError,
854 _("Error while creating breakpoint from GDB."));
855 gdbpy_print_stack ();
858 PyGILState_Release (state);
861 /* Callback that is used when a breakpoint is deleted. This will
862 invalidate the corresponding Python object. */
864 gdbpy_breakpoint_deleted (struct breakpoint *b)
867 PyGILState_STATE state;
868 struct breakpoint *bp = NULL;
869 breakpoint_object *bp_obj;
871 state = PyGILState_Ensure ();
872 bp = get_breakpoint (num);
875 bp_obj = bp->py_bp_object;
883 PyGILState_Release (state);
888 /* Initialize the Python breakpoint code. */
890 gdbpy_initialize_breakpoints (void)
894 breakpoint_object_type.tp_new = PyType_GenericNew;
895 if (PyType_Ready (&breakpoint_object_type) < 0)
898 Py_INCREF (&breakpoint_object_type);
899 PyModule_AddObject (gdb_module, "Breakpoint",
900 (PyObject *) &breakpoint_object_type);
902 observer_attach_breakpoint_created (gdbpy_breakpoint_created);
903 observer_attach_breakpoint_deleted (gdbpy_breakpoint_deleted);
905 /* Add breakpoint types constants. */
906 for (i = 0; pybp_codes[i].name; ++i)
908 if (PyModule_AddIntConstant (gdb_module,
909 /* Cast needed for Python 2.4. */
910 (char *) pybp_codes[i].name,
911 pybp_codes[i].code) < 0)
915 /* Add watchpoint types constants. */
916 for (i = 0; pybp_watch_types[i].name; ++i)
918 if (PyModule_AddIntConstant (gdb_module,
919 /* Cast needed for Python 2.4. */
920 (char *) pybp_watch_types[i].name,
921 pybp_watch_types[i].code) < 0)
929 /* Helper function that overrides this Python object's
930 PyObject_GenericSetAttr to allow extra validation of the attribute
934 local_setattro (PyObject *self, PyObject *name, PyObject *v)
936 breakpoint_object *obj = (breakpoint_object *) self;
937 char *attr = python_string_to_host_string (name);
942 /* If the attribute trying to be set is the "stop" method,
943 but we already have a condition set in the CLI, disallow this
945 if (strcmp (attr, stop_func) == 0 && obj->bp->cond_string)
948 PyErr_SetString (PyExc_RuntimeError,
949 _("Cannot set 'stop' method. There is an " \
950 "existing GDB condition attached to the " \
957 return PyObject_GenericSetAttr ((PyObject *)self, name, v);
960 static PyGetSetDef breakpoint_object_getset[] = {
961 { "enabled", bppy_get_enabled, bppy_set_enabled,
962 "Boolean telling whether the breakpoint is enabled.", NULL },
963 { "silent", bppy_get_silent, bppy_set_silent,
964 "Boolean telling whether the breakpoint is silent.", NULL },
965 { "thread", bppy_get_thread, bppy_set_thread,
966 "Thread ID for the breakpoint.\n\
967 If the value is a thread ID (integer), then this is a thread-specific breakpoint.\n\
968 If the value is None, then this breakpoint is not thread-specific.\n\
969 No other type of value can be used.", NULL },
970 { "task", bppy_get_task, bppy_set_task,
971 "Thread ID for the breakpoint.\n\
972 If the value is a task ID (integer), then this is an Ada task-specific breakpoint.\n\
973 If the value is None, then this breakpoint is not task-specific.\n\
974 No other type of value can be used.", NULL },
975 { "ignore_count", bppy_get_ignore_count, bppy_set_ignore_count,
976 "Number of times this breakpoint should be automatically continued.",
978 { "number", bppy_get_number, NULL,
979 "Breakpoint's number assigned by GDB.", NULL },
980 { "hit_count", bppy_get_hit_count, bppy_set_hit_count,
981 "Number of times the breakpoint has been hit.\n\
982 Can be set to zero to clear the count. No other value is valid\n\
983 when setting this property.", NULL },
984 { "location", bppy_get_location, NULL,
985 "Location of the breakpoint, as specified by the user.", NULL},
986 { "expression", bppy_get_expression, NULL,
987 "Expression of the breakpoint, as specified by the user.", NULL},
988 { "condition", bppy_get_condition, bppy_set_condition,
989 "Condition of the breakpoint, as specified by the user,\
990 or None if no condition set."},
991 { "commands", bppy_get_commands, NULL,
992 "Commands of the breakpoint, as specified by the user."},
993 { "type", bppy_get_type, NULL,
994 "Type of breakpoint."},
995 { "visible", bppy_get_visibility, NULL,
996 "Whether the breakpoint is visible to the user."},
997 { NULL } /* Sentinel. */
1000 static PyMethodDef breakpoint_object_methods[] =
1002 { "is_valid", bppy_is_valid, METH_NOARGS,
1003 "Return true if this breakpoint is valid, false if not." },
1004 { "delete", bppy_delete_breakpoint, METH_NOARGS,
1005 "Delete the underlying GDB breakpoint." },
1006 { NULL } /* Sentinel. */
1009 static PyTypeObject breakpoint_object_type =
1011 PyObject_HEAD_INIT (NULL)
1013 "gdb.Breakpoint", /*tp_name*/
1014 sizeof (breakpoint_object), /*tp_basicsize*/
1023 0, /*tp_as_sequence*/
1024 0, /*tp_as_mapping*/
1029 (setattrofunc)local_setattro, /*tp_setattro */
1031 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
1032 "GDB breakpoint object", /* tp_doc */
1033 0, /* tp_traverse */
1035 0, /* tp_richcompare */
1036 0, /* tp_weaklistoffset */
1038 0, /* tp_iternext */
1039 breakpoint_object_methods, /* tp_methods */
1041 breakpoint_object_getset, /* tp_getset */
1044 0, /* tp_descr_get */
1045 0, /* tp_descr_set */
1046 0, /* tp_dictoffset */
1047 bppy_init, /* tp_init */