2010-11-11 Phil Muldoon <pmuldoon@redhat.com>

* python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is
	NULL.
	(BPPY_SET_REQUIRE_VALID): Ditto.
	(bpnum_is_valid): Delete function.
	(bppy_get_visibility): New function.
	(bppy_new): Parse for, and validate internal keyword.  Pass
	internal keyword to breakpoint or watchpoint functions.
	(build_bp_list): New function.
	(gdbpy_breakpoints): Rewrite.  Use build_bp_list and
	iterate_over_breakpoints.
	(gdbpy_breakpoint_created): Rewrite.  Do not store breakpoints in a
	look-aside vector.
	(gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management
	to internal breakpoint chain.

	* breakpoint.c (set_breakpoint_number): New function.
	(breakpoint_1): Check if breakpoint number is more than zero.
	(set_raw_breakpoint_without_location): Set py_bp_object to NULL.
	(create_breakpoint_sal): Take a new parameter called internal.
	Call set_breakpoint_number with internal parameter.  Do not
	mention internal breakpoints.  All callers updated.
	(create_breakpoint): Ditto.
	(create_breakpoints_sal): Ditto.
	(watch_command_1): Ditto.
	(watch_command_wrapper): Take a new parameter called internal.
	All callers updated.
	(rwatch_command_wrapper): Ditto.
	(awatch_command_wrapper): Ditto.
	(save_breakpoints): Update breakpoint save condition check.
	(iterate_over_breakpoints): New function.
	* breakpoint.h: Add conditional python includes.  Add py_bp_object
	and comment to struct breakpoint.  Update all callers.
	* defs.h: Add PyObject definition for GDB builds without Python.

2010-11-11  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Breakpoints In Python): Document "internal"
	parameter, and visible attribute.


2010-11-11  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-breakpoint.exp: Add internal watchpoint and
	breakpoint tests.
This commit is contained in:
Phil Muldoon
2010-11-11 14:11:56 +00:00
parent 95a2c8d6f7
commit 84f4c1fe05
12 changed files with 326 additions and 126 deletions

View File

@@ -24,6 +24,11 @@
#include "value.h"
#include "vec.h"
#if HAVE_PYTHON
#include "python/python.h"
#include "python/python-internal.h"
#endif
struct value;
struct block;
@@ -557,7 +562,14 @@ struct breakpoint
breakpoints, we will use this index to try to find the same
marker again. */
int static_trace_marker_id_idx;
};
/* With a Python scripting enabled GDB, store a reference to the
Python object that has been associated with this breakpoint.
This is always NULL for a GDB that is not script enabled. It
can sometimes be NULL for enabled GDBs as not all breakpoint
types are tracked by the Python scripting API. */
PyObject *py_bp_object;
};
typedef struct breakpoint *breakpoint_p;
DEF_VEC_P(breakpoint_p);
@@ -855,9 +867,9 @@ extern void break_command (char *, int);
extern void hbreak_command_wrapper (char *, int);
extern void thbreak_command_wrapper (char *, int);
extern void rbreak_command_wrapper (char *, int);
extern void watch_command_wrapper (char *, int);
extern void awatch_command_wrapper (char *, int);
extern void rwatch_command_wrapper (char *, int);
extern void watch_command_wrapper (char *, int, int);
extern void awatch_command_wrapper (char *, int, int);
extern void rwatch_command_wrapper (char *, int, int);
extern void tbreak_command (char *, int);
extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
@@ -868,7 +880,8 @@ extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
enum auto_boolean pending_break_support,
struct breakpoint_ops *ops,
int from_tty,
int enabled);
int enabled,
int internal);
extern void insert_breakpoints (void);
@@ -1101,4 +1114,15 @@ extern void check_tracepoint_command (char *line, void *closure);
extern void start_rbreak_breakpoints (void);
extern void end_rbreak_breakpoints (void);
/* Breakpoint iterator function.
Calls a callback function once for each breakpoint, so long as the
callback function returns false. If the callback function returns
true, the iteration will end and the current breakpoint will be
returned. This can be useful for implementing a search for a
breakpoint with arbitrary attributes, or for applying an operation
to every breakpoint. */
extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint *,
void *), void *);
#endif /* !defined (BREAKPOINT_H) */