-/* Copyright (C) 1992 Free Software Foundation, Inc.
+/* Data structures associated with breakpoints in GDB.
+ Copyright (C) 1992 Free Software Foundation, Inc.
This file is part of GDB.
Feel free to increase it. It's just used in a few places to size
arrays that should be independent of the target architecture. */
-#define BREAKPOINT_MAX 10
-
-typedef struct bpstat__struct *bpstat;
-
-#ifdef __STDC__ /* Forward declarations for prototypes */
-struct frame_info;
-#endif
-
-extern int
-breakpoint_here_p PARAMS ((CORE_ADDR));
-
-extern void
-until_break_command PARAMS ((char *, int));
-
-extern void
-breakpoint_re_set PARAMS ((void));
-
-extern void
-clear_momentary_breakpoints PARAMS ((void));
-
-/* FIXME: Prototype uses equivalence of "struct frame_info *" and FRAME */
-extern struct breakpoint *
-set_momentary_breakpoint PARAMS ((struct symtab_and_line,
- struct frame_info *,
- enum bptype));
-
-extern void
-set_ignore_count PARAMS ((int, int, int));
-
-extern void
-set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
-
-extern void
-mark_breakpoints_out PARAMS ((void));
-
-extern void
-delete_breakpoint PARAMS ((struct breakpoint *));
-
-extern void
-breakpoint_auto_delete PARAMS ((bpstat));
-
-extern void
-breakpoint_clear_ignore_counts PARAMS ((void));
-
-extern void
-break_command PARAMS ((char *, int));
-
-extern int
-insert_breakpoints PARAMS ((void));
-
-extern int
-remove_breakpoints PARAMS ((void));
-
-/* The following are for displays, which aren't really breakpoints, but
- here is as good a place as any for them. */
-
-extern void
-disable_current_display PARAMS ((void));
-
-extern void
-do_displays PARAMS ((void));
-
-extern void
-disable_display PARAMS ((int));
-
-extern void
-clear_displays PARAMS ((void));
-
+#define BREAKPOINT_MAX 16
\f
/* The follow stuff is an abstract data type "bpstat" ("breakpoint status").
This provides the ability to determine whether we have stopped at a
breakpoint, and what we should do about it. */
+typedef struct bpstat *bpstat;
+
/* Interface: */
/* Clear a bpstat so that it says we are not at any breakpoint.
Also free any storage that is part of a bpstat. */
/* FIXME: prototypes uses equivalence between FRAME_ADDR and CORE_ADDR */
extern bpstat bpstat_stop_status PARAMS ((CORE_ADDR *, CORE_ADDR));
-/* Nonzero if we should print the frame. */
-#define bpstat_should_print(bs) ((bs) != NULL && (bs)->print)
+/* Return values from bpstat_what. */
+enum bpstat_what {
+ /* Perform various other tests; that is, this bpstat does not
+ say to perform any action (e.g. failed watchpoint and nothing
+ else). */
+ BPSTAT_WHAT_KEEP_CHECKING,
+
+ /* Rather than distinguish between noisy and silent stops here, it
+ might be cleaner to have bpstat_print make that decision (also
+ taking into account stop_print_frame and source_only). But the
+ implications are a bit scary (interaction with auto-displays, etc.),
+ so I won't try it. */
+
+ /* Stop silently. */
+ BPSTAT_WHAT_STOP_SILENT,
+
+ /* Stop and print. */
+ BPSTAT_WHAT_STOP_NOISY,
+
+ /* Remove breakpoints, single step once, then put them back in and
+ go back to what we were doing. */
+ BPSTAT_WHAT_SINGLE,
+
+ /* Set longjmp_resume breakpoint, remove all other breakpoints,
+ and continue. The "remove all other breakpoints" part is required
+ if we are also stepping over another breakpoint as well as doing
+ the longjmp handling. */
+ BPSTAT_WHAT_SET_LONGJMP_RESUME,
+
+ /* Clear longjmp_resume breakpoint, then handle as
+ BPSTAT_WHAT_KEEP_CHECKING. */
+ BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
+
+ /* Clear longjmp_resume breakpoint, then handle as BPSTAT_WHAT_SINGLE. */
+ BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE,
+
+ /* This is just used to keep track of how many enums there are. */
+ BPSTAT_WHAT_LAST
+};
-/* Nonzero if we should stop. */
-#define bpstat_stop(bs) ((bs) != NULL && (bs)->stop)
+/* Tell what to do about this bpstat. */
+enum bpstat_what bpstat_what PARAMS ((bpstat));
/* Find the bpstat associated with a breakpoint. NULL otherwise. */
-bpstat bpstat_find_breakpoint(/* bpstat, breakpoint */);
-
-/* Nonzero if we hit a momentary breakpoint. */
-#define bpstat_momentary_breakpoint(bs) ((bs) != NULL && (bs)->momentary)
+bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
/* Nonzero if a signal that we got in wait() was due to circumstances
explained by the BS. */
-/* Currently that is true iff we have hit a breakpoint. */
+/* Currently that is true if we have hit a breakpoint, or if there is
+ a watchpoint enabled. */
#define bpstat_explains_signal(bs) ((bs) != NULL)
/* Nonzero if we should step constantly (e.g. watchpoints on machines
extern void bpstat_clear_actions PARAMS ((bpstat));
/* Implementation: */
-struct bpstat__struct
+struct bpstat
{
/* Linked list because there can be two breakpoints at the
same place, and a bpstat reflects the fact that both have been hit. */
struct command_line *commands;
/* Old value associated with a watchpoint. */
value old_val;
- /* Nonzero if we should print the frame. Only significant for the first
- bpstat in the chain. */
+
+ /* Nonzero if this breakpoint tells us to print the frame. */
char print;
- /* Nonzero if we should stop. Only significant for the first bpstat in
- the chain. */
+
+ /* Nonzero if this breakpoint tells us to stop. */
char stop;
- /* Nonzero if we hit a momentary breakpoint. Only significant for the
- first bpstat in the chain. */
- char momentary;
+
+ /* Function called by bpstat_print to print stuff associated with
+ this element of the bpstat chain. Returns 0 or 1 just like
+ bpstat_print, or -1 if it can't deal with it. */
+ int (*print_it) PARAMS((bpstat bs));
};
\f
/* Type of breakpoint. */
2) step-resume (for 'next'ing over subroutine calls),
3) call-dummy (the breakpoint at the end of a subroutine stub that gdb
uses to call functions in the target).
+
+ I definately agree with (2) and (3); I'm not as sure about (1)
+ (it is a low-level thing, perhaps the best thing is that it looks
+ as much as possible like a single-step to wait_for_inferior)
+ -kingdon, 8 Apr 93.
*/
enum bptype {
bp_finish, /* used by finish command */
bp_watchpoint, /* Watchpoint */
bp_longjmp, /* secret breakpoint to find longjmp() */
- bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
+ bp_longjmp_resume /* secret breakpoint to escape longjmp() */
};
/* States of enablement of breakpoint. */
enum bpdisp {
delete, /* Delete it */
disable, /* Disable it */
- donttouch, /* Leave it alone */
+ donttouch /* Leave it alone */
};
/* Note that the ->silent field is not currently used by any commands
/* String form of the breakpoint condition (malloc'd), or NULL if there
is no condition. */
char *cond_string;
+ /* String form of exp (malloc'd), or NULL if none. */
+ char *exp_string;
/* The expression we are watching, or NULL if not a watchpoint. */
struct expression *exp;
/* Value of the watchpoint the last time we checked it. */
value val;
};
+\f
+/* Prototypes for breakpoint-related functions. */
+
+#ifdef __STDC__ /* Forward declarations for prototypes */
+struct frame_info;
+#endif
+
+extern int
+breakpoint_here_p PARAMS ((CORE_ADDR));
+
+extern void
+until_break_command PARAMS ((char *, int));
+
+extern void
+breakpoint_re_set PARAMS ((void));
+
+extern void
+clear_momentary_breakpoints PARAMS ((void));
+
+/* FIXME: Prototype uses equivalence of "struct frame_info *" and FRAME */
+extern struct breakpoint *
+set_momentary_breakpoint PARAMS ((struct symtab_and_line,
+ struct frame_info *,
+ enum bptype));
+
+extern void
+set_ignore_count PARAMS ((int, int, int));
+
+extern void
+set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
+
+extern void
+mark_breakpoints_out PARAMS ((void));
+
+extern void
+delete_breakpoint PARAMS ((struct breakpoint *));
+
+extern void
+breakpoint_auto_delete PARAMS ((bpstat));
+
+extern void
+breakpoint_clear_ignore_counts PARAMS ((void));
+
+extern void
+break_command PARAMS ((char *, int));
+
+extern int
+insert_breakpoints PARAMS ((void));
+
+extern int
+remove_breakpoints PARAMS ((void));
+
+extern void
+enable_longjmp_breakpoint PARAMS ((void));
+
+extern void
+disable_longjmp_breakpoint PARAMS ((void));
+
+extern void
+set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR, FRAME));
+
+/* The following are for displays, which aren't really breakpoints, but
+ here is as good a place as any for them. */
+
+extern void
+disable_current_display PARAMS ((void));
+
+extern void
+do_displays PARAMS ((void));
+
+extern void
+disable_display PARAMS ((int));
+
+extern void
+clear_displays PARAMS ((void));
#endif /* !defined (BREAKPOINT_H) */