breakpoint.h revision 46283
119370Spst/* Data structures associated with breakpoints in GDB.
246283Sdfr   Copyright (C) 1992, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
319370Spst
419370SpstThis file is part of GDB.
519370Spst
619370SpstThis program is free software; you can redistribute it and/or modify
719370Spstit under the terms of the GNU General Public License as published by
819370Spstthe Free Software Foundation; either version 2 of the License, or
919370Spst(at your option) any later version.
1019370Spst
1119370SpstThis program is distributed in the hope that it will be useful,
1219370Spstbut WITHOUT ANY WARRANTY; without even the implied warranty of
1319370SpstMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1419370SpstGNU General Public License for more details.
1519370Spst
1619370SpstYou should have received a copy of the GNU General Public License
1719370Spstalong with this program; if not, write to the Free Software
1819370SpstFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1919370Spst
2019370Spst#if !defined (BREAKPOINT_H)
2119370Spst#define BREAKPOINT_H 1
2219370Spst
2319370Spst#include "frame.h"
2419370Spst#include "value.h"
2519370Spst
2619370Spst/* This is the maximum number of bytes a breakpoint instruction can take.
2719370Spst   Feel free to increase it.  It's just used in a few places to size
2819370Spst   arrays that should be independent of the target architecture.  */
2919370Spst
3019370Spst#define	BREAKPOINT_MAX	16
3119370Spst
3219370Spst/* Type of breakpoint. */
3319370Spst/* FIXME In the future, we should fold all other breakpoint-like things into
3419370Spst   here.  This includes:
3519370Spst
3619370Spst   * single-step (for machines where we have to simulate single stepping)
3719370Spst      (probably, though perhaps it is better for it to look as much as
3819370Spst      possible like a single-step to wait_for_inferior).  */
3919370Spst
4019370Spstenum bptype {
4146283Sdfr  bp_none = 0,                  /* Eventpoint has been deleted. */
4219370Spst  bp_breakpoint,		/* Normal breakpoint */
4319370Spst  bp_hardware_breakpoint,	/* Hardware assisted breakpoint */
4419370Spst  bp_until,			/* used by until command */
4519370Spst  bp_finish,			/* used by finish command */
4619370Spst  bp_watchpoint,		/* Watchpoint */
4719370Spst  bp_hardware_watchpoint,	/* Hardware assisted watchpoint */
4819370Spst  bp_read_watchpoint,		/* read watchpoint, (hardware assisted) */
4919370Spst  bp_access_watchpoint,		/* access watchpoint, (hardware assisted) */
5019370Spst  bp_longjmp,			/* secret breakpoint to find longjmp() */
5119370Spst  bp_longjmp_resume,		/* secret breakpoint to escape longjmp() */
5219370Spst
5319370Spst  /* Used by wait_for_inferior for stepping over subroutine calls, for
5419370Spst     stepping over signal handlers, and for skipping prologues.  */
5519370Spst  bp_step_resume,
5619370Spst
5719370Spst  /* Used by wait_for_inferior for stepping over signal handlers.  */
5819370Spst  bp_through_sigtramp,
5919370Spst
6019370Spst  /* Used to detect when a watchpoint expression has gone out of
6119370Spst     scope.  These breakpoints are usually not visible to the user.
6219370Spst
6319370Spst     This breakpoint has some interesting properties:
6419370Spst
6519370Spst       1) There's always a 1:1 mapping between watchpoints
6619370Spst       on local variables and watchpoint_scope breakpoints.
6719370Spst
6819370Spst       2) It automatically deletes itself and the watchpoint it's
6919370Spst       associated with when hit.
7019370Spst
7119370Spst       3) It can never be disabled.  */
7219370Spst  bp_watchpoint_scope,
7319370Spst
7419370Spst  /* The breakpoint at the end of a call dummy.  */
7519370Spst  /* FIXME: What if the function we are calling longjmp()s out of the
7619370Spst     call, or the user gets out with the "return" command?  We currently
7719370Spst     have no way of cleaning up the breakpoint in these (obscure) situations.
7819370Spst     (Probably can solve this by noticing longjmp, "return", etc., it's
7919370Spst     similar to noticing when a watchpoint on a local variable goes out
8019370Spst     of scope (with hardware support for watchpoints)).  */
8119370Spst  bp_call_dummy,
8219370Spst
8319370Spst  /* Some dynamic linkers (HP, maybe Solaris) can arrange for special
8419370Spst     code in the inferior to run when significant events occur in the
8519370Spst     dynamic linker (for example a library is loaded or unloaded).
8619370Spst
8719370Spst     By placing a breakpoint in this magic code GDB will get control
8819370Spst     when these significant events occur.  GDB can then re-examine
8919370Spst     the dynamic linker's data structures to discover any newly loaded
9019370Spst     dynamic libraries.  */
9146283Sdfr  bp_shlib_event,
9246283Sdfr
9346283Sdfr  /* These breakpoints are used to implement the "catch load" command
9446283Sdfr     on platforms whose dynamic linkers support such functionality.  */
9546283Sdfr  bp_catch_load,
9646283Sdfr
9746283Sdfr  /* These breakpoints are used to implement the "catch unload" command
9846283Sdfr     on platforms whose dynamic linkers support such functionality.  */
9946283Sdfr  bp_catch_unload,
10046283Sdfr
10146283Sdfr  /* These are not really breakpoints, but are catchpoints that
10246283Sdfr     implement the "catch fork", "catch vfork" and "catch exec" commands
10346283Sdfr     on platforms whose kernel support such functionality.  (I.e.,
10446283Sdfr     kernels which can raise an event when a fork or exec occurs, as
10546283Sdfr     opposed to the debugger setting breakpoints on functions named
10646283Sdfr     "fork" or "exec".) */
10746283Sdfr  bp_catch_fork,
10846283Sdfr  bp_catch_vfork,
10946283Sdfr  bp_catch_exec,
11046283Sdfr
11146283Sdfr  /* These are catchpoints to implement "catch catch" and "catch throw"
11246283Sdfr     commands for C++ exception handling. */
11346283Sdfr  bp_catch_catch,
11446283Sdfr  bp_catch_throw
11546283Sdfr
11619370Spst};
11719370Spst
11819370Spst/* States of enablement of breakpoint. */
11919370Spst
12046283Sdfrenum enable {
12146283Sdfr  disabled,           /* The eventpoint is inactive, and cannot trigger. */
12246283Sdfr  enabled,            /* The eventpoint is active, and can trigger. */
12346283Sdfr  shlib_disabled,     /* The eventpoint's address is within an unloaded solib.
12446283Sdfr                         The eventpoint will be automatically enabled & reset
12546283Sdfr                         when that solib is loaded. */
12646283Sdfr  call_disabled       /* The eventpoint has been disabled while a call into
12746283Sdfr                         the inferior is "in flight", because some eventpoints
12846283Sdfr                         interfere with the implementation of a call on some
12946283Sdfr                         targets.  The eventpoint will be automatically enabled
13046283Sdfr                         & reset when the call "lands" (either completes, or
13146283Sdfr                         stops at another eventpoint). */
13246283Sdfr};
13319370Spst
13446283Sdfr
13519370Spst/* Disposition of breakpoint.  Ie: what to do after hitting it. */
13619370Spst
13719370Spstenum bpdisp {
13819370Spst  del,				/* Delete it */
13946283Sdfr  del_at_next_stop,		/* Delete at next stop, whether hit or not */
14019370Spst  disable,			/* Disable it */
14119370Spst  donttouch			/* Leave it alone */
14219370Spst};
14319370Spst
14419370Spst/* Note that the ->silent field is not currently used by any commands
14519370Spst   (though the code is in there if it was to be, and set_raw_breakpoint
14619370Spst   does set it to 0).  I implemented it because I thought it would be
14719370Spst   useful for a hack I had to put in; I'm going to leave it in because
14819370Spst   I can see how there might be times when it would indeed be useful */
14919370Spst
15019370Spst/* This is for a breakpoint or a watchpoint.  */
15119370Spst
15219370Spststruct breakpoint
15319370Spst{
15419370Spst  struct breakpoint *next;
15519370Spst  /* Type of breakpoint. */
15619370Spst  enum bptype type;
15719370Spst  /* Zero means disabled; remember the info but don't break here.  */
15819370Spst  enum enable enable;
15919370Spst  /* What to do with this breakpoint after we hit it. */
16019370Spst  enum bpdisp disposition;
16119370Spst  /* Number assigned to distinguish breakpoints.  */
16219370Spst  int number;
16319370Spst
16419370Spst  /* Address to break at, or NULL if not a breakpoint.  */
16519370Spst  CORE_ADDR address;
16619370Spst
16719370Spst  /* Line number of this address.  Only matters if address is
16819370Spst     non-NULL.  */
16919370Spst
17019370Spst  int line_number;
17119370Spst
17219370Spst  /* Source file name of this address.  Only matters if address is
17319370Spst     non-NULL.  */
17419370Spst
17519370Spst  char *source_file;
17619370Spst
17719370Spst  /* Non-zero means a silent breakpoint (don't print frame info
17819370Spst     if we stop here). */
17919370Spst  unsigned char silent;
18019370Spst  /* Number of stops at this breakpoint that should
18119370Spst     be continued automatically before really stopping.  */
18219370Spst  int ignore_count;
18319370Spst  /* "Real" contents of byte where breakpoint has been inserted.
18419370Spst     Valid only when breakpoints are in the program.  Under the complete
18519370Spst     control of the target insert_breakpoint and remove_breakpoint routines.
18619370Spst     No other code should assume anything about the value(s) here.  */
18719370Spst  char shadow_contents[BREAKPOINT_MAX];
18819370Spst  /* Nonzero if this breakpoint is now inserted.  Only matters if address
18919370Spst     is non-NULL.  */
19019370Spst  char inserted;
19119370Spst  /* Nonzero if this is not the first breakpoint in the list
19219370Spst     for the given address.  Only matters if address is non-NULL.  */
19319370Spst  char duplicate;
19419370Spst  /* Chain of command lines to execute when this breakpoint is hit.  */
19519370Spst  struct command_line *commands;
19619370Spst  /* Stack depth (address of frame).  If nonzero, break only if fp
19719370Spst     equals this.  */
19819370Spst  CORE_ADDR frame;
19919370Spst  /* Conditional.  Break only if this expression's value is nonzero.  */
20019370Spst  struct expression *cond;
20119370Spst
20219370Spst  /* String we used to set the breakpoint (malloc'd).  Only matters if
20319370Spst     address is non-NULL.  */
20419370Spst  char *addr_string;
20519370Spst  /* Language we used to set the breakpoint.  */
20619370Spst  enum language language;
20719370Spst  /* Input radix we used to set the breakpoint.  */
20819370Spst  int input_radix;
20919370Spst  /* String form of the breakpoint condition (malloc'd), or NULL if there
21019370Spst     is no condition.  */
21119370Spst  char *cond_string;
21219370Spst  /* String form of exp (malloc'd), or NULL if none.  */
21319370Spst  char *exp_string;
21419370Spst
21519370Spst  /* The expression we are watching, or NULL if not a watchpoint.  */
21619370Spst  struct expression *exp;
21719370Spst  /* The largest block within which it is valid, or NULL if it is
21819370Spst     valid anywhere (e.g. consists just of global symbols).  */
21919370Spst  struct block *exp_valid_block;
22019370Spst  /* Value of the watchpoint the last time we checked it.  */
22119370Spst  value_ptr val;
22219370Spst
22319370Spst  /* Holds the value chain for a hardware watchpoint expression.  */
22419370Spst  value_ptr val_chain;
22519370Spst
22619370Spst  /* Holds the address of the related watchpoint_scope breakpoint
22719370Spst     when using watchpoints on local variables (might the concept
22819370Spst     of a related breakpoint be useful elsewhere, if not just call
22919370Spst     it the watchpoint_scope breakpoint or something like that. FIXME).  */
23019370Spst  struct breakpoint *related_breakpoint;
23119370Spst
23219370Spst  /* Holds the frame address which identifies the frame this watchpoint
23319370Spst     should be evaluated in, or NULL if the watchpoint should be evaluated
23419370Spst     on the outermost frame.  */
23519370Spst  CORE_ADDR watchpoint_frame;
23619370Spst
23719370Spst  /* Thread number for thread-specific breakpoint, or -1 if don't care */
23819370Spst  int thread;
23919370Spst
24019370Spst  /* Count of the number of times this breakpoint was taken, dumped
24119370Spst     with the info, but not used for anything else.  Useful for
24219370Spst     seeing how many times you hit a break prior to the program
24319370Spst     aborting, so you can back up to just before the abort.  */
24419370Spst  int hit_count;
24519370Spst
24646283Sdfr  /* Filename of a dynamically-linked library (dll), used for bp_catch_load
24746283Sdfr     and bp_catch_unload (malloc'd), or NULL if any library is significant.  */
24846283Sdfr  char *  dll_pathname;
24946283Sdfr
25046283Sdfr  /* Filename of a dll whose state change (e.g., load or unload)
25146283Sdfr     triggered this catchpoint.  This field is only vaid immediately
25246283Sdfr     after this catchpoint has triggered.  */
25346283Sdfr  char *  triggered_dll_pathname;
25446283Sdfr
25546283Sdfr  /* Process id of a child process whose forking triggered this catchpoint.
25646283Sdfr     This field is only vaid immediately after this catchpoint has triggered.  */
25746283Sdfr  int  forked_inferior_pid;
25846283Sdfr
25946283Sdfr  /* Filename of a program whose exec triggered this catchpoint.  This
26046283Sdfr     field is only vaid immediately after this catchpoint has triggered.  */
26146283Sdfr  char *  exec_pathname;
26246283Sdfr
26346283Sdfr  asection *section;
26419370Spst};
26519370Spst
26619370Spst/* The following stuff is an abstract data type "bpstat" ("breakpoint status").
26719370Spst   This provides the ability to determine whether we have stopped at a
26819370Spst   breakpoint, and what we should do about it.  */
26919370Spst
27019370Spsttypedef struct bpstats *bpstat;
27119370Spst
27219370Spst/* Interface:  */
27319370Spst/* Clear a bpstat so that it says we are not at any breakpoint.
27419370Spst   Also free any storage that is part of a bpstat.  */
27519370Spstextern void bpstat_clear PARAMS ((bpstat *));
27619370Spst
27719370Spst/* Return a copy of a bpstat.  Like "bs1 = bs2" but all storage that
27819370Spst   is part of the bpstat is copied as well.  */
27919370Spstextern bpstat bpstat_copy PARAMS ((bpstat));
28019370Spst
28119370Spstextern bpstat bpstat_stop_status PARAMS ((CORE_ADDR *, int));
28219370Spst
28319370Spst/* This bpstat_what stuff tells wait_for_inferior what to do with a
28419370Spst   breakpoint (a challenging task).  */
28519370Spst
28619370Spstenum bpstat_what_main_action {
28719370Spst  /* Perform various other tests; that is, this bpstat does not
28819370Spst     say to perform any action (e.g. failed watchpoint and nothing
28919370Spst     else).  */
29019370Spst  BPSTAT_WHAT_KEEP_CHECKING,
29119370Spst
29219370Spst  /* Rather than distinguish between noisy and silent stops here, it
29319370Spst     might be cleaner to have bpstat_print make that decision (also
29419370Spst     taking into account stop_print_frame and source_only).  But the
29519370Spst     implications are a bit scary (interaction with auto-displays, etc.),
29619370Spst     so I won't try it.  */
29719370Spst
29819370Spst  /* Stop silently.  */
29919370Spst  BPSTAT_WHAT_STOP_SILENT,
30019370Spst
30119370Spst  /* Stop and print.  */
30219370Spst  BPSTAT_WHAT_STOP_NOISY,
30319370Spst
30419370Spst  /* Remove breakpoints, single step once, then put them back in and
30519370Spst     go back to what we were doing.  It's possible that this should be
30619370Spst     removed from the main_action and put into a separate field, to more
30719370Spst     cleanly handle BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE.  */
30819370Spst  BPSTAT_WHAT_SINGLE,
30919370Spst
31019370Spst  /* Set longjmp_resume breakpoint, remove all other breakpoints,
31119370Spst     and continue.  The "remove all other breakpoints" part is required
31219370Spst     if we are also stepping over another breakpoint as well as doing
31319370Spst     the longjmp handling.  */
31419370Spst  BPSTAT_WHAT_SET_LONGJMP_RESUME,
31519370Spst
31619370Spst  /* Clear longjmp_resume breakpoint, then handle as
31719370Spst     BPSTAT_WHAT_KEEP_CHECKING.  */
31819370Spst  BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
31919370Spst
32019370Spst  /* Clear longjmp_resume breakpoint, then handle as BPSTAT_WHAT_SINGLE.  */
32119370Spst  BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE,
32219370Spst
32319370Spst  /* Clear step resume breakpoint, and keep checking.  */
32419370Spst  BPSTAT_WHAT_STEP_RESUME,
32519370Spst
32619370Spst  /* Clear through_sigtramp breakpoint, muck with trap_expected, and keep
32719370Spst     checking.  */
32819370Spst  BPSTAT_WHAT_THROUGH_SIGTRAMP,
32919370Spst
33019370Spst  /* Check the dynamic linker's data structures for new libraries, then
33119370Spst     keep checking.  */
33219370Spst  BPSTAT_WHAT_CHECK_SHLIBS,
33319370Spst
33446283Sdfr  /* Check the dynamic linker's data structures for new libraries, then
33546283Sdfr     resume out of the dynamic linker's callback, stop and print.  */
33646283Sdfr  BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK,
33746283Sdfr
33819370Spst  /* This is just used to keep track of how many enums there are.  */
33919370Spst  BPSTAT_WHAT_LAST
34019370Spst};
34119370Spst
34219370Spststruct bpstat_what {
34319370Spst  enum bpstat_what_main_action main_action;
34419370Spst
34519370Spst  /* Did we hit a call dummy breakpoint?  This only goes with a main_action
34619370Spst     of BPSTAT_WHAT_STOP_SILENT or BPSTAT_WHAT_STOP_NOISY (the concept of
34719370Spst     continuing from a call dummy without popping the frame is not a
34819370Spst     useful one).  */
34919370Spst  int call_dummy;
35019370Spst};
35119370Spst
35219370Spst/* Tell what to do about this bpstat.  */
35319370Spststruct bpstat_what bpstat_what PARAMS ((bpstat));
35419370Spst
35519370Spst/* Find the bpstat associated with a breakpoint.  NULL otherwise. */
35619370Spstbpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
35719370Spst
35846283Sdfr/* Find a step_resume breakpoint associated with this bpstat.
35946283Sdfr   (If there are multiple step_resume bp's on the list, this function
36046283Sdfr   will arbitrarily pick one.)
36146283Sdfr
36246283Sdfr   It is an error to use this function if BPSTAT doesn't contain a
36346283Sdfr   step_resume breakpoint.
36446283Sdfr
36546283Sdfr   See wait_for_inferior's use of this function.
36646283Sdfr   */
36746283Sdfrextern struct breakpoint *
36846283Sdfrbpstat_find_step_resume_breakpoint PARAMS ((bpstat));
36946283Sdfr
37019370Spst/* Nonzero if a signal that we got in wait() was due to circumstances
37119370Spst   explained by the BS.  */
37219370Spst/* Currently that is true if we have hit a breakpoint, or if there is
37319370Spst   a watchpoint enabled.  */
37419370Spst#define bpstat_explains_signal(bs) ((bs) != NULL)
37519370Spst
37619370Spst/* Nonzero if we should step constantly (e.g. watchpoints on machines
37719370Spst   without hardware support).  This isn't related to a specific bpstat,
37819370Spst   just to things like whether watchpoints are set.  */
37919370Spstextern int bpstat_should_step PARAMS ((void));
38019370Spst
38146283Sdfr/* Nonzero if there are enabled hardware watchpoints. */
38246283Sdfrextern int bpstat_have_active_hw_watchpoints PARAMS ((void));
38346283Sdfr
38419370Spst/* Print a message indicating what happened.  Returns nonzero to
38519370Spst   say that only the source line should be printed after this (zero
38619370Spst   return means print the frame as well as the source line).  */
38719370Spstextern int bpstat_print PARAMS ((bpstat));
38819370Spst
38919370Spst/* Return the breakpoint number of the first breakpoint we are stopped
39019370Spst   at.  *BSP upon return is a bpstat which points to the remaining
39119370Spst   breakpoints stopped at (but which is not guaranteed to be good for
39219370Spst   anything but further calls to bpstat_num).
39319370Spst   Return 0 if passed a bpstat which does not indicate any breakpoints.  */
39419370Spstextern int bpstat_num PARAMS ((bpstat *));
39519370Spst
39619370Spst/* Perform actions associated with having stopped at *BSP.  Actually, we just
39719370Spst   use this for breakpoint commands.  Perhaps other actions will go here
39819370Spst   later, but this is executed at a late time (from the command loop).  */
39919370Spstextern void bpstat_do_actions PARAMS ((bpstat *));
40019370Spst
40119370Spst/* Modify BS so that the actions will not be performed.  */
40219370Spstextern void bpstat_clear_actions PARAMS ((bpstat));
40319370Spst
40446283Sdfr/* Given a bpstat that records zero or more triggered eventpoints, this
40546283Sdfr   function returns another bpstat which contains only the catchpoints
40646283Sdfr   on that first list, if any.
40746283Sdfr   */
40846283Sdfrextern void bpstat_get_triggered_catchpoints PARAMS ((bpstat, bpstat *));
40946283Sdfr
41019370Spst/* Implementation:  */
41119370Spststruct bpstats
41219370Spst{
41319370Spst  /* Linked list because there can be two breakpoints at the
41419370Spst     same place, and a bpstat reflects the fact that both have been hit.  */
41519370Spst  bpstat next;
41619370Spst  /* Breakpoint that we are at.  */
41719370Spst  struct breakpoint *breakpoint_at;
41819370Spst  /* Commands left to be done.  */
41919370Spst  struct command_line *commands;
42019370Spst  /* Old value associated with a watchpoint.  */
42119370Spst  value_ptr old_val;
42219370Spst
42319370Spst  /* Nonzero if this breakpoint tells us to print the frame.  */
42419370Spst  char print;
42519370Spst
42619370Spst  /* Nonzero if this breakpoint tells us to stop.  */
42719370Spst  char stop;
42819370Spst
42919370Spst  /* Function called by bpstat_print to print stuff associated with
43019370Spst     this element of the bpstat chain.  Returns 0 or 1 just like
43119370Spst     bpstat_print, or -1 if it can't deal with it.  */
43219370Spst  int (*print_it) PARAMS((bpstat bs));
43319370Spst};
43446283Sdfr
43546283Sdfrenum inf_context
43646283Sdfr{
43746283Sdfr  inf_starting,
43846283Sdfr  inf_running,
43946283Sdfr  inf_exited
44046283Sdfr};
44146283Sdfr
44219370Spst
44319370Spst/* Prototypes for breakpoint-related functions.  */
44419370Spst
44519370Spst#ifdef __STDC__		/* Forward declarations for prototypes */
44619370Spststruct frame_info;
44719370Spst#endif
44819370Spst
44919370Spstextern int breakpoint_here_p PARAMS ((CORE_ADDR));
45019370Spst
45146283Sdfrextern int breakpoint_inserted_here_p PARAMS ((CORE_ADDR));
45246283Sdfr
45319370Spstextern int frame_in_dummy PARAMS ((struct frame_info *));
45419370Spst
45519370Spstextern int breakpoint_thread_match PARAMS ((CORE_ADDR, int));
45619370Spst
45719370Spstextern void until_break_command PARAMS ((char *, int));
45819370Spst
45919370Spstextern void breakpoint_re_set PARAMS ((void));
46019370Spst
46146283Sdfrextern void breakpoint_re_set_thread PARAMS ((struct breakpoint *));
46219370Spst
46346283Sdfrextern int ep_is_exception_catchpoint PARAMS ((struct breakpoint *));
46446283Sdfr
46519370Spstextern struct breakpoint *set_momentary_breakpoint
46619370Spst  PARAMS ((struct symtab_and_line, struct frame_info *, enum bptype));
46719370Spst
46819370Spstextern void set_ignore_count PARAMS ((int, int, int));
46919370Spst
47019370Spstextern void set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
47119370Spst
47219370Spstextern void mark_breakpoints_out PARAMS ((void));
47319370Spst
47446283Sdfrextern void breakpoint_init_inferior PARAMS ((enum inf_context));
47519370Spst
47619370Spstextern void delete_breakpoint PARAMS ((struct breakpoint *));
47719370Spst
47819370Spstextern void breakpoint_auto_delete PARAMS ((bpstat));
47919370Spst
48019370Spstextern void breakpoint_clear_ignore_counts PARAMS ((void));
48119370Spst
48219370Spstextern void break_command PARAMS ((char *, int));
48319370Spst
48446283Sdfrextern void tbreak_command PARAMS ((char *, int));
48546283Sdfr
48619370Spstextern int insert_breakpoints PARAMS ((void));
48719370Spst
48819370Spstextern int remove_breakpoints PARAMS ((void));
48919370Spst
49046283Sdfr/* This function can be used to physically insert eventpoints from the
49146283Sdfr   specified traced inferior process, without modifying the breakpoint
49246283Sdfr   package's state.  This can be useful for those targets which support
49346283Sdfr   following the processes of a fork() or vfork() system call, when both
49446283Sdfr   of the resulting two processes are to be followed.  */
49546283Sdfrextern int reattach_breakpoints PARAMS ((int));
49646283Sdfr
49746283Sdfr/* This function can be used to update the breakpoint package's state
49846283Sdfr   after an exec() system call has been executed.
49946283Sdfr
50046283Sdfr   This function causes the following:
50146283Sdfr
50246283Sdfr     - All eventpoints are marked "not inserted".
50346283Sdfr     - All eventpoints with a symbolic address are reset such that
50446283Sdfr       the symbolic address must be reevaluated before the eventpoints
50546283Sdfr       can be reinserted.
50646283Sdfr     - The solib breakpoints are explicitly removed from the breakpoint
50746283Sdfr       list.
50846283Sdfr     - A step-resume breakpoint, if any, is explicitly removed from the
50946283Sdfr       breakpoint list.
51046283Sdfr     - All eventpoints without a symbolic address are removed from the
51146283Sdfr       breakpoint list. */
51246283Sdfrextern void update_breakpoints_after_exec PARAMS ((void));
51346283Sdfr
51446283Sdfr/* This function can be used to physically remove hardware breakpoints
51546283Sdfr   and watchpoints from the specified traced inferior process, without
51646283Sdfr   modifying the breakpoint package's state.  This can be useful for
51746283Sdfr   those targets which support following the processes of a fork() or
51846283Sdfr   vfork() system call, when one of the resulting two processes is to
51946283Sdfr   be detached and allowed to run free.
52046283Sdfr
52146283Sdfr   It is an error to use this function on the process whose id is
52246283Sdfr   inferior_pid.  */
52346283Sdfrextern int detach_breakpoints PARAMS ((int));
52446283Sdfr
52519370Spstextern void enable_longjmp_breakpoint PARAMS ((void));
52619370Spst
52719370Spstextern void disable_longjmp_breakpoint PARAMS ((void));
52819370Spst
52919370Spstextern void set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR,
53019370Spst						   struct frame_info *));
53146283Sdfr/* These functions respectively disable or reenable all currently
53246283Sdfr   enabled watchpoints.  When disabled, the watchpoints are marked
53346283Sdfr   call_disabled.  When reenabled, they are marked enabled.
53446283Sdfr
53546283Sdfr   The intended client of these functions is infcmd.c\run_stack_dummy.
53646283Sdfr
53746283Sdfr   The inferior must be stopped, and all breakpoints removed, when
53846283Sdfr   these functions are used.
53946283Sdfr
54046283Sdfr   The need for these functions is that on some targets (e.g., HP-UX),
54146283Sdfr   gdb is unable to unwind through the dummy frame that is pushed as
54246283Sdfr   part of the implementation of a call command.  Watchpoints can
54346283Sdfr   cause the inferior to stop in places where this frame is visible,
54446283Sdfr   and that can cause execution control to become very confused.
54546283Sdfr
54646283Sdfr   Note that if a user sets breakpoints in an interactively call
54746283Sdfr   function, the call_disabled watchpoints will have been reenabled
54846283Sdfr   when the first such breakpoint is reached.  However, on targets
54946283Sdfr   that are unable to unwind through the call dummy frame, watches
55046283Sdfr   of stack-based storage may then be deleted, because gdb will
55146283Sdfr   believe that their watched storage is out of scope.  (Sigh.) */
55246283Sdfrextern void
55346283Sdfrdisable_watchpoints_before_interactive_call_start PARAMS ((void));
55446283Sdfr
55546283Sdfrextern void
55646283Sdfrenable_watchpoints_after_interactive_call_stop PARAMS ((void));
55746283Sdfr
55819370Spst
55919370Spstextern void clear_breakpoint_hit_counts PARAMS ((void));
56019370Spst
56119370Spst/* The following are for displays, which aren't really breakpoints, but
56219370Spst   here is as good a place as any for them.  */
56319370Spst
56419370Spstextern void disable_current_display PARAMS ((void));
56519370Spst
56619370Spstextern void do_displays PARAMS ((void));
56719370Spst
56819370Spstextern void disable_display PARAMS ((int));
56919370Spst
57019370Spstextern void clear_displays PARAMS ((void));
57119370Spst
57219370Spstextern void disable_breakpoint PARAMS ((struct breakpoint *));
57319370Spst
57419370Spstextern void enable_breakpoint PARAMS ((struct breakpoint *));
57519370Spst
57619370Spstextern void create_solib_event_breakpoint PARAMS ((CORE_ADDR));
57719370Spst
57819370Spstextern void remove_solib_event_breakpoints PARAMS ((void));
57919370Spst
58046283Sdfrextern void disable_breakpoints_in_shlibs PARAMS ((int silent));
58146283Sdfr
58219370Spstextern void re_enable_breakpoints_in_shlibs PARAMS ((void));
58319370Spst
58446283Sdfrextern void create_solib_load_event_breakpoint PARAMS ((char *, int, char *, char *));
58546283Sdfr
58646283Sdfrextern void create_solib_unload_event_breakpoint PARAMS ((char *, int, char *, char *));
58746283Sdfr
58846283Sdfrextern void create_fork_event_catchpoint PARAMS ((int, char *));
58946283Sdfr
59046283Sdfrextern void create_vfork_event_catchpoint PARAMS ((int, char *));
59146283Sdfr
59246283Sdfrextern void create_exec_event_catchpoint PARAMS ((int, char *));
59346283Sdfr
59446283Sdfr/* This function returns TRUE if ep is a catchpoint. */
59546283Sdfrextern int ep_is_catchpoint PARAMS ((struct breakpoint *));
59646283Sdfr
59746283Sdfr/* This function returns TRUE if ep is a catchpoint of a
59846283Sdfr   shared library (aka dynamically-linked library) event,
59946283Sdfr   such as a library load or unload. */
60046283Sdfrextern int ep_is_shlib_catchpoint PARAMS ((struct breakpoint *));
60146283Sdfr
60246283Sdfrextern struct breakpoint *set_breakpoint_sal PARAMS ((struct symtab_and_line));
60346283Sdfr
60419370Spst#endif /* !defined (BREAKPOINT_H) */
605