From 0eaaa46a44378fe755b5ce17b6b5cfa75a22287d Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Mon, 29 Mar 1993 21:49:39 +0000 Subject: [PATCH] * breakpoint.{c,h}: Add exp_string to struct breakpoint and use it in breakpoint_re_set. --- gdb/ChangeLog | 7 +++ gdb/breakpoint.c | 12 ++++ gdb/breakpoint.h | 157 +++++++++++++++++++++++++---------------------- 3 files changed, 104 insertions(+), 72 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 302590330f9..1848c433184 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +<<<<<<< ChangeLog +Fri Mar 26 11:29:30 1993 Jim Kingdon (kingdon@cygnus.com) + + * breakpoint.{c,h}: Add exp_string to struct breakpoint and use + it in breakpoint_re_set. +======= Sun Mar 28 11:24:37 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * breakpoint.c (breakpoint_re_set_one): Fix storage leak. @@ -19,6 +25,7 @@ Fri Mar 26 15:25:05 1993 John Gilmore (gnu@cygnus.com) * Makefile.in (TARFILES): Avoid trailing backslash. Fri Mar 26 11:29:30 1993 Jim Kingdon (kingdon@cygnus.com) +>>>>>>> 1.1087 * breakpoint.c (watch_command, enable_breakpoint): Fetch lazy values. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c907f77131d..90e01eec266 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1625,6 +1625,7 @@ watch_command (arg, from_tty) b->val = val; b->cond = 0; b->cond_string = NULL; + b->exp_string = savestring (arg, strlen (arg)); mention (b); } @@ -2143,6 +2144,8 @@ delete_breakpoint (bpt) free ((PTR)bpt->cond_string); if (bpt->addr_string != NULL) free ((PTR)bpt->addr_string); + if (bpt->exp_string != NULL) + free ((PTR)bpt->exp_string); if (xgdb_verbose && bpt->type == bp_breakpoint) printf ("breakpoint #%d deleted\n", bpt->number); @@ -2235,11 +2238,20 @@ breakpoint_re_set_one (bint) break; case bp_watchpoint: + innermost_block = NULL; + b->exp = parse_expression (b->exp_string); + b->exp_valid_block = innermost_block; + b->val = evaluate_expression (b->exp); + release_value (b->val); + if (VALUE_LAZY (b->val)) + value_fetch_lazy (b->val); + if (b->cond_string != NULL) { s = b->cond_string; b->cond = parse_exp_1 (&s, (struct block *)0, 0); } + mention (b); break; default: diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index f32e1d266f9..d05e0e785be 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1,4 +1,5 @@ -/* 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. @@ -26,79 +27,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 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 /* 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. */ @@ -155,7 +91,7 @@ extern void bpstat_do_actions PARAMS ((bpstat *)); 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. */ @@ -193,7 +129,7 @@ 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. */ @@ -205,7 +141,7 @@ enum enable { disabled, enabled}; 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 @@ -266,6 +202,8 @@ struct breakpoint /* 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; @@ -275,5 +213,80 @@ struct breakpoint /* Value of the watchpoint the last time we checked it. */ value val; }; + +/* 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) */ -- 2.30.2