summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.h
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-06-22 17:53:43 +0000
committerPedro Alves <pedro@codesourcery.com>2011-06-22 17:53:43 +0000
commit4c86c7593ae509c18ae6fb77f2b70bfd1e2756f5 (patch)
tree956d75dcb479c897c40e3ed7f60fcc8d89f007d9 /gdb/breakpoint.h
parent154b8450272625dd694e94de666d65c2b10a6bdd (diff)
downloadgdb-4c86c7593ae509c18ae6fb77f2b70bfd1e2756f5.tar.gz
2011-06-22 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (bpstat_stop_status): Call the check_status breakpoint_ops method. (print_one_breakpoint_location): Also print the condition for Ada exception catchpoints. (allocate_bp_location): New, factored out from allocate_bp_location. (allocate_bp_location): Adjust. Call the owner breakpoint's allocate_location method, if there is one. (free_bp_location): Call the locations's dtor method, if there is one. (init_raw_breakpoint_without_location): New breakpoint_ops parameter. Use it. (set_raw_breakpoint_without_location): Adjust. (init_raw_breakpoint): New breakpoint_ops parameter. Pass it down. (set_raw_breakpoint): Adjust. (catch_fork_breakpoint_ops, catch_vfork_breakpoint_ops) (catch_syscall_breakpoint_ops): Install NULL allocate_location, re_set and check_status methods. (init_catchpoint): Don't memset, initialize thread, addr_string and enable_state. Pass the ops down to init_raw_breakpoint. (install_catchpoint): Rename to ... (install_breakpoint): ... this, and make extern. (create_fork_vfork_event_catchpoint): Adjust. (catch_exec_breakpoint_ops): Install NULL allocate_location, re_set and check_status methods. (create_syscall_event_catchpoint): Adjust. (ranged_breakpoint_ops, watchpoint_breakpoint_ops) (masked_watchpoint_breakpoint_ops): Install NULL allocate_location, re_set and check_status methods. (catch_exec_command_1): Adjust. (gnu_v3_exception_catchpoint_ops): Install NULL allocate_location, re_set and check_status methods. (create_ada_exception_breakpoint): Rename to ... (init_ada_exception_breakpoint): ... this. Add a struct breakpoint parameter, and delete the exp_string, cond_string and cond parameters. Use init_raw_breakpoint, and don't install or mention the breakpoint yet. Don't clear breakpoint fields that init_raw_breakpoint already clears. (re_set_breakpoint): Delete, split into ... (breakpoint_re_set_default, prepare_re_set_context): ... these new functions. (breakpoint_re_set_one): Call the breakpoint's breakpoint_ops->re_set implementation, if there's one. Adjust. * breakpoint.h: Forward declare struct bpstats and struct bp_location. (struct bp_location_ops): New type. (struct bp_location): New field `ops'. (struct breakpoint_ops): New `allocate_location', `re_set' and `check_status' fields. Make `breakpoint_hit''s description match reality. (init_bp_location): Declare. (breakpoint_re_set_default): Declare. (create_ada_exception_breakpoint): Rename to ... (init_ada_exception_breakpoint): ... this. Add a struct breakpoint parameter, and delete the exp_string, cond_string and cond parameters. (install_breakpoint): Declare. * ada-lang.c: Include exceptions.h. <Ada exceptions description>: Update. (struct ada_catchpoint_location): New type. (ada_catchpoint_location_dtor): New function. (ada_catchpoint_location_ops): New global. (ada_catchpoint): New type. (create_excep_cond_exprs): New function. (dtor_exception, allocate_location_exception, re_set_exception) (should_stop_exception, check_status_exception): New functions. (print_one_exception, print_mention_exception) (print_recreate_exception): Adjust. (dtor_catch_exception, allocate_location_catch_exception) (re_set_catch_exception, check_status_catch_exception): New functions. (catch_exception_breakpoint_ops): Install them. (dtor_catch_exception_unhandled) (allocate_location_catch_exception_unhandled) (re_set_catch_exception_unhandled) (check_status_catch_exception_unhandled): New functions. (catch_exception_unhandled_breakpoint_ops): Install them. (dtor_catch_assert, allocate_location_catch_assert) (re_set_catch_assert, check_status_catch_assert): New functions. (catch_assert_breakpoint_ops): Install them. (ada_exception_catchpoint_p): Delete. (catch_ada_exception_command_split) (ada_exception_catchpoint_cond_string): Rename exp_string parameter to excep_string. Adjust. (ada_parse_catchpoint_condition): Delete. (ada_exception_sal): Rename the exp_string parameter to excep_string. Delete the cond_string and cond parameters. Adjust. (ada_decode_exception_location): Rename the exp_string parameter to excep_string. Delete the cond_string and cond parameters. Adjust. (create_ada_exception_catchpoint): New function. (catch_ada_exception_command, ada_decode_assert_location) (catch_assert_command): Adjust. * ada-lang.h (ada_exception_catchpoint_p): Delete declaration.
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r--gdb/breakpoint.h70
1 files changed, 57 insertions, 13 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 9dbf23b6ad8..6fca4791c6e 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -30,6 +30,8 @@ struct block;
struct breakpoint_object;
struct get_number_or_range_state;
struct thread_info;
+struct bpstats;
+struct bp_location;
/* This is the maximum number of bytes a breakpoint instruction can
take. Feel free to increase it. It's just used in a few places to
@@ -278,12 +280,26 @@ enum bp_loc_type
bp_loc_other /* Miscellaneous... */
};
+/* This structure is a collection of function pointers that, if
+ available, will be called instead of performing the default action
+ for this bp_loc_type. */
+
+struct bp_location_ops
+{
+ /* Destructor. Releases everything from SELF (but not SELF
+ itself). */
+ void (*dtor) (struct bp_location *self);
+};
+
struct bp_location
{
/* Chain pointer to the next breakpoint location for
the same parent breakpoint. */
struct bp_location *next;
+ /* Methods associated with this location. */
+ const struct bp_location_ops *ops;
+
/* The reference count. */
int refc;
@@ -397,6 +413,14 @@ struct breakpoint_ops
itself). */
void (*dtor) (struct breakpoint *self);
+ /* Allocate a location for this breakpoint. */
+ struct bp_location * (*allocate_location) (struct breakpoint *);
+
+ /* Reevaluate a breakpoint. This is necessary after symbols change
+ (e.g., an executable or DSO was loaded, or the inferior just
+ started). */
+ void (*re_set) (struct breakpoint *self);
+
/* Insert the breakpoint or watchpoint or activate the catchpoint.
Return 0 for success, 1 if the breakpoint, watchpoint or catchpoint
type is not supported, -1 for failure. */
@@ -408,11 +432,16 @@ struct breakpoint_ops
-1 for failure. */
int (*remove_location) (struct bp_location *);
- /* Return non-zero if the debugger should tell the user that this
- breakpoint was hit. */
- int (*breakpoint_hit) (const struct bp_location *, struct address_space *,
+ /* Return true if it the target has stopped due to hitting
+ breakpoint location BL. This function does not check if we
+ should stop, only if BL explains the stop. */
+ int (*breakpoint_hit) (const struct bp_location *bl, struct address_space *,
CORE_ADDR);
+ /* Check internal conditions of the breakpoint referred to by BS.
+ If we should not stop for this breakpoint, set BS->stop to 0. */
+ void (*check_status) (struct bpstats *bs);
+
/* Tell how many hardware resources (debug registers) are needed
for this breakpoint. If this function is not provided, then
the breakpoint or watchpoint needs one debug register. */
@@ -937,6 +966,12 @@ extern int breakpoint_thread_match (struct address_space *,
extern void until_break_command (char *, int, int);
+/* Initialize a struct bp_location. */
+
+extern void init_bp_location (struct bp_location *loc,
+ const struct bp_location_ops *ops,
+ struct breakpoint *owner);
+
extern void update_breakpoint_locations (struct breakpoint *b,
struct symtabs_and_lines sals,
struct symtabs_and_lines sals_end);
@@ -945,6 +980,12 @@ extern void breakpoint_re_set (void);
extern void breakpoint_re_set_thread (struct breakpoint *);
+/* The default re_set method, for typical hardware or software
+ breakpoints. Reevaluate the breakpoint and recreate its
+ locations. */
+
+extern void breakpoint_re_set_default (struct breakpoint *);
+
extern struct breakpoint *set_momentary_breakpoint
(struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype);
@@ -1001,18 +1042,21 @@ extern void
void *user_data_catch,
void *user_data_tcatch);
-/* Create a breakpoint struct for Ada exception catchpoints. */
+/* Initialize a breakpoint struct for Ada exception catchpoints. */
extern void
- create_ada_exception_breakpoint (struct gdbarch *gdbarch,
- struct symtab_and_line sal,
- char *addr_string,
- char *exp_string,
- char *cond_string,
- struct expression *cond,
- struct breakpoint_ops *ops,
- int tempflag,
- int from_tty);
+ init_ada_exception_breakpoint (struct breakpoint *b,
+ struct gdbarch *gdbarch,
+ struct symtab_and_line sal,
+ char *addr_string,
+ struct breakpoint_ops *ops,
+ int tempflag,
+ int from_tty);
+
+/* Add breakpoint B on the breakpoint list, and notify the user, the
+ target and breakpoint_created observers of its existence. */
+
+extern void install_breakpoint (struct breakpoint *b);
extern int create_breakpoint (struct gdbarch *gdbarch, char *arg,
char *cond_string, int thread,