1 /* Everything about breakpoints, for GDB.
2 Copyright (C) 1986, 1987, 1989, 1990 Free Software Foundation, Inc.
4 This file is part of GDB.
6 GDB is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GDB is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
26 #include "breakpoint.h"
27 #include "expression.h"
37 extern int addressprint; /* Print machine addresses? */
38 extern int demangle; /* Print de-mangled symbol names? */
40 extern int catch_errors ();
41 extern void set_next_address (); /* ...for x/ command */
43 /* Are we executing breakpoint commands? */
44 static int executing_breakpoint_commands;
46 /* States of enablement of breakpoint.
47 `temporary' means disable when hit.
48 `delete' means delete when hit. */
50 enum enable { disabled, enabled, temporary, delete};
52 /* Not that the ->silent field is not currently used by any commands
53 (though the code is in there if it was to be and set_raw_breakpoint
54 does set it to 0). I implemented it because I thought it would be
55 useful for a hack I had to put in; I'm going to leave it in because
56 I can see how there might be times when it would indeed be useful */
58 /* This is for a breakpoint or a watchpoint. */
62 struct breakpoint *next;
63 /* Number assigned to distinguish breakpoints. */
65 /* Address to break at, or NULL if not a breakpoint. */
67 /* Line number of this address. Redundant. Only matters if address
70 /* Symtab of file of this address. Redundant. Only matters if address
72 struct symtab *symtab;
73 /* Zero means disabled; remember the info but don't break here. */
75 /* Non-zero means a silent breakpoint (don't print frame info
78 /* Number of stops at this breakpoint that should
79 be continued automatically before really stopping. */
81 /* "Real" contents of byte where breakpoint has been inserted.
82 Valid only when breakpoints are in the program. Under the complete
83 control of the target insert_breakpoint and remove_breakpoint routines.
84 No other code should assume anything about the value(s) here. */
85 char shadow_contents[BREAKPOINT_MAX];
86 /* Nonzero if this breakpoint is now inserted. Only matters if address
89 /* Nonzero if this is not the first breakpoint in the list
90 for the given address. Only matters if address is non-NULL. */
92 /* Chain of command lines to execute when this breakpoint is hit. */
93 struct command_line *commands;
94 /* Stack depth (address of frame). If nonzero, break only if fp
97 /* Conditional. Break only if this expression's value is nonzero. */
98 struct expression *cond;
100 /* String we used to set the breakpoint (malloc'd). Only matters if
101 address is non-NULL. */
103 /* String form of the breakpoint condition (malloc'd), or NULL if there
107 /* The expression we are watching, or NULL if not a watchpoint. */
108 struct expression *exp;
109 /* The largest block within which it is valid, or NULL if it is
110 valid anywhere (e.g. consists just of global symbols). */
111 struct block *exp_valid_block;
112 /* Value of the watchpoint the last time we checked it. */
116 #define ALL_BREAKPOINTS(b) for (b = breakpoint_chain; b; b = b->next)
118 /* Chain of all breakpoints defined. */
120 struct breakpoint *breakpoint_chain;
122 /* Number of last breakpoint made. */
124 static int breakpoint_count;
126 /* Set breakpoint count to NUM. */
128 set_breakpoint_count (num)
131 breakpoint_count = num;
132 set_internalvar (lookup_internalvar ("bpnum"),
133 value_from_long (builtin_type_int, (LONGEST) num));
136 /* Default address, symtab and line to put a breakpoint at
137 for "break" command with no arg.
138 if default_breakpoint_valid is zero, the other three are
139 not valid, and "break" with no arg is an error.
141 This set by print_stack_frame, which calls set_default_breakpoint. */
143 int default_breakpoint_valid;
144 CORE_ADDR default_breakpoint_address;
145 struct symtab *default_breakpoint_symtab;
146 int default_breakpoint_line;
148 static void delete_breakpoint ();
149 void breakpoint_auto_delete ();
151 /* Flag indicating extra verbosity for xgdb. */
152 extern int xgdb_verbose;
154 /* *PP is a string denoting a breakpoint. Get the number of the breakpoint.
155 Advance *PP after the string and any trailing whitespace.
157 Currently the string can either be a number or "$" followed by the name
158 of a convenience variable. Making it an expression wouldn't work well
159 for map_breakpoint_numbers (e.g. "4 + 5 + 6"). */
168 /* Empty line means refer to the last breakpoint. */
169 return breakpoint_count;
172 /* Make a copy of the name, so we can null-terminate it
173 to pass to lookup_internalvar(). */
178 while (isalnum (*p) || *p == '_')
180 varname = (char *) alloca (p - start + 1);
181 strncpy (varname, start, p - start);
182 varname[p - start] = '\0';
183 val = value_of_internalvar (lookup_internalvar (varname));
184 if (TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_INT)
186 "Convenience variables used to specify breakpoints must have integer values."
188 retval = (int) value_as_long (val);
192 while (*p >= '0' && *p <= '9')
195 /* There is no number here. (e.g. "cond a == b"). */
196 error_no_arg ("breakpoint number");
199 if (!(isspace (*p) || *p == '\0'))
200 error ("breakpoint number expected");
207 /* condition N EXP -- set break condition of breakpoint N to EXP. */
210 condition_command (arg, from_tty)
214 register struct breakpoint *b;
219 error_no_arg ("breakpoint number");
222 bnum = get_number (&p);
225 if (b->number == bnum)
232 if (b->cond_string != NULL)
233 free (b->cond_string);
238 b->cond_string = NULL;
240 printf ("Breakpoint %d now unconditional.\n", bnum);
245 /* I don't know if it matters whether this is the string the user
246 typed in or the decompiled expression. */
247 b->cond_string = savestring (arg, strlen (arg));
248 b->cond = parse_c_1 (&arg, block_for_pc (b->address), 0);
250 error ("Junk at end of expression");
255 error ("No breakpoint number %d.", bnum);
259 commands_command (arg, from_tty)
263 register struct breakpoint *b;
266 struct command_line *l;
268 /* If we allowed this, we would have problems with when to
269 free the storage, if we change the commands currently
272 if (executing_breakpoint_commands)
273 error ("Can't use the \"commands\" command among a breakpoint's commands.");
276 bnum = get_number (&p);
278 error ("Unexpected extra arguments following breakpoint number.");
281 if (b->number == bnum)
283 if (input_from_terminal_p ())
285 printf ("Type commands for when breakpoint %d is hit, one per line.\n\
286 End with a line saying just \"end\".\n", bnum);
289 l = read_command_lines ();
290 free_command_lines (&b->commands);
294 error ("No breakpoint number %d.", bnum);
297 /* insert_breakpoints is used when starting or continuing the program.
298 remove_breakpoints is used when the program stops.
299 Both return zero if successful,
300 or an `errno' value if could not write the inferior. */
303 insert_breakpoints ()
305 register struct breakpoint *b;
307 int disabled_breaks = 0;
310 if (b->address != NULL
311 && b->enable != disabled
315 val = target_insert_breakpoint(b->address, b->shadow_contents);
318 /* Can't set the breakpoint. */
319 #if defined (DISABLE_UNSETTABLE_BREAK)
320 if (DISABLE_UNSETTABLE_BREAK (b->address))
323 b->enable = disabled;
324 if (!disabled_breaks)
327 "Cannot insert breakpoint %d:\n", b->number);
328 printf_filtered ("Disabling shared library breakpoints:\n");
331 printf_filtered ("%d ", b->number);
336 fprintf (stderr, "Cannot insert breakpoint %d:\n", b->number);
337 memory_error (val, b->address); /* which bombs us out */
344 printf_filtered ("\n");
349 remove_breakpoints ()
351 register struct breakpoint *b;
354 #ifdef BREAKPOINT_DEBUG
355 printf ("Removing breakpoints.\n");
356 #endif /* BREAKPOINT_DEBUG */
359 if (b->address != NULL && b->inserted)
361 val = target_remove_breakpoint(b->address, b->shadow_contents);
365 #ifdef BREAKPOINT_DEBUG
366 printf ("Removed breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
367 b->address, b->shadow_contents[0], b->shadow_contents[1]);
368 #endif /* BREAKPOINT_DEBUG */
374 /* Clear the "inserted" flag in all breakpoints.
375 This is done when the inferior is loaded. */
378 mark_breakpoints_out ()
380 register struct breakpoint *b;
386 /* breakpoint_here_p (PC) returns 1 if an enabled breakpoint exists at PC.
387 When continuing from a location with a breakpoint,
388 we actually single step once before calling insert_breakpoints. */
391 breakpoint_here_p (pc)
394 register struct breakpoint *b;
397 if (b->enable != disabled && b->address == pc)
403 /* bpstat stuff. External routines' interfaces are documented
418 if (p->old_val != NULL)
419 value_free (p->old_val);
437 for (; bs != NULL; bs = bs->next)
439 tmp = (bpstat) xmalloc (sizeof (*tmp));
440 bcopy (bs, tmp, sizeof (*tmp));
442 /* This is the first thing in the chain. */
456 struct breakpoint *b;
459 return 0; /* No more breakpoint values */
462 b = (*bsp)->breakpoint_at;
465 return -1; /* breakpoint that's been deleted since */
467 return b->number; /* We have its number */
472 bpstat_clear_actions (bs)
475 for (; bs != NULL; bs = bs->next)
478 if (bs->old_val != NULL)
480 value_free (bs->old_val);
486 /* Execute all the commands associated with all the breakpoints at this
487 location. Any of these commands could cause the process to proceed
488 beyond this point, etc. We look out for such changes by checking
489 the global "breakpoint_proceeded" after each command. */
491 bpstat_do_actions (bsp)
499 executing_breakpoint_commands = 1;
500 breakpoint_proceeded = 0;
501 for (; bs != NULL; bs = bs->next)
505 char *line = bs->commands->line;
506 bs->commands = bs->commands->next;
507 execute_command (line, 0);
508 /* If the inferior is proceeded by the command, bomb out now.
509 The bpstat chain has been blown away by wait_for_inferior.
510 But since execution has stopped again, there is a new bpstat
511 to look at, so start over. */
512 if (breakpoint_proceeded)
516 clear_momentary_breakpoints ();
518 executing_breakpoint_commands = 0;
525 /* bs->breakpoint_at can be NULL if it was a momentary breakpoint
526 which has since been deleted. */
527 if (bs == NULL || bs->breakpoint_at == NULL)
530 /* If bpstat_stop_status says don't print, OK, we won't. An example
531 circumstance is when we single-stepped for both a watchpoint and
532 for a "stepi" instruction. The bpstat says that the watchpoint
533 explains the stop, but we shouldn't print because the watchpoint's
534 value didn't change -- and the real reason we are stopping here
535 rather than continuing to step (as the watchpoint would've had us do)
536 is because of the "stepi". */
540 if (bs->breakpoint_at->address != NULL)
542 /* I think the user probably only wants to see one breakpoint
543 number, not all of them. */
544 printf_filtered ("\nBreakpoint %d, ", bs->breakpoint_at->number);
548 if (bs->old_val != NULL)
550 printf_filtered ("\nWatchpoint %d, ", bs->breakpoint_at->number);
551 print_expression (bs->breakpoint_at->exp, stdout);
552 printf_filtered ("\nOld value = ");
553 value_print (bs->old_val, stdout, 0, Val_pretty_default);
554 printf_filtered ("\nNew value = ");
555 value_print (bs->breakpoint_at->val, stdout, 0,
557 printf_filtered ("\n");
558 value_free (bs->old_val);
563 fprintf_filtered (stderr, "gdb internal error: in bpstat_print\n");
567 /* Evaluate the expression EXP and return 1 if value is zero.
568 This is used inside a catch_errors to evaluate the breakpoint condition.
569 The argument is a "struct expression *" that has been cast to int to
570 make it pass through catch_errors. */
573 breakpoint_cond_eval (exp)
576 return value_zerop (evaluate_expression ((struct expression *)exp));
579 /* Allocate a new bpstat and chain it to the current one. */
582 bpstat_alloc (b, cbs)
583 register struct breakpoint *b;
584 bpstat cbs; /* Current "bs" value */
588 bs = (bpstat) xmalloc (sizeof (*bs));
590 bs->breakpoint_at = b;
591 /* If the condition is false, etc., don't do the commands. */
593 bs->momentary = b->number == -3;
598 /* Determine whether we stopped at a breakpoint, etc, or whether we
599 don't understand this stop. Result is a chain of bpstat's such that:
601 if we don't understand the stop, the result is a null pointer.
603 if we understand why we stopped, the result is not null, and
604 the first element of the chain contains summary "stop" and
605 "print" flags for the whole chain.
607 Each element of the chain refers to a particular breakpoint or
608 watchpoint at which we have stopped. (We may have stopped for
611 Each element of the chain has valid next, breakpoint_at,
612 commands, FIXME??? fields.
618 bpstat_stop_status (pc, frame_address)
620 FRAME_ADDR frame_address;
622 register struct breakpoint *b;
626 /* True if we've hit a breakpoint (as opposed to a watchpoint). */
627 int real_breakpoint = 0;
628 /* Root of the chain of bpstat's */
629 struct bpstat__struct root_bs[1];
630 /* Pointer to the last thing in the chain currently. */
633 /* Get the address where the breakpoint would have been. */
634 bp_addr = *pc - DECR_PC_AFTER_BREAK;
641 if (b->enable == disabled)
643 if (b->address != NULL && b->address != bp_addr)
646 bs = bpstat_alloc (b, bs); /* Alloc a bpstat to explain stop */
651 if (b->exp != NULL) /* Watchpoint */
653 int within_current_scope;
654 if (b->exp_valid_block != NULL)
655 within_current_scope =
656 contained_in (get_selected_block (), b->exp_valid_block);
658 within_current_scope = 1;
660 if (within_current_scope)
662 value new_val = evaluate_expression (b->exp);
663 release_value (new_val);
664 if (!value_equal (b->val, new_val))
666 bs->old_val = b->val;
668 /* We will stop here */
672 /* Nothing changed, don't do anything. */
673 value_free (new_val);
675 /* We won't stop here */
680 /* This seems like the only logical thing to do because
681 if we temporarily ignored the watchpoint, then when
682 we reenter the block in which it is valid it contains
683 garbage (in the case of a function, it may have two
684 garbage values, one before and one after the prologue).
685 So we can't even detect the first assignment to it and
686 watch after that (since the garbage may or may not equal
687 the first value assigned). */
688 b->enable = disabled;
690 Watchpoint %d disabled because the program has left the block in\n\
691 which its expression is valid.\n", b->number);
692 /* We won't stop here */
693 /* FIXME, maybe we should stop here!!! */
700 if (b->frame && b->frame != frame_address)
708 /* Need to select the frame, with all that implies
709 so that the conditions will have the right context. */
710 select_frame (get_current_frame (), 0);
712 = catch_errors (breakpoint_cond_eval, (int)(b->cond),
713 "Error occurred in testing breakpoint condition.");
716 if (b->cond && value_zero)
720 else if (b->ignore_count > 0)
727 /* We will stop here */
728 if (b->enable == temporary)
729 b->enable = disabled;
730 bs->commands = b->commands;
733 if (bs->commands && !strcmp ("silent", bs->commands->line))
735 bs->commands = bs->commands->next;
746 bs->next = NULL; /* Terminate the chain */
747 bs = root_bs->next; /* Re-grab the head of the chain */
752 #if DECR_PC_AFTER_BREAK != 0 || defined (SHIFT_INST_REGS)
756 #if defined (SHIFT_INST_REGS)
758 CORE_ADDR pc = read_register (PC_REGNUM);
759 CORE_ADDR npc = read_register (NPC_REGNUM);
762 write_register (NNPC_REGNUM, npc);
763 write_register (NPC_REGNUM, pc);
766 #else /* No SHIFT_INST_REGS. */
768 #endif /* No SHIFT_INST_REGS. */
770 #endif /* DECR_PC_AFTER_BREAK != 0. */
776 bpstat_should_step ()
778 struct breakpoint *b;
780 if (b->enable != disabled && b->exp != NULL)
785 /* Print information on breakpoint number BNUM, or -1 if all.
786 If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS
787 is nonzero, process only watchpoints. */
790 breakpoint_1 (bnum, watchpoints)
794 register struct breakpoint *b;
795 register struct command_line *l;
796 register struct symbol *sym;
797 CORE_ADDR last_addr = (CORE_ADDR)-1;
798 int header_printed = 0;
801 if (bnum == -1 || bnum == b->number)
803 if (b->address == NULL && !watchpoints)
807 error ("That is a watchpoint, not a breakpoint.");
809 if (b->address != NULL && watchpoints)
813 error ("That is a breakpoint, not a watchpoint.");
819 printf_filtered (" Enb Expression\n");
820 else if (addressprint)
821 printf_filtered (" Enb Address Where\n");
823 printf_filtered (" Enb Where\n");
827 printf_filtered ("#%-3d %c ", b->number, "nyod"[(int) b->enable]);
828 if (b->address == NULL)
829 print_expression (b->exp, stdout);
833 printf_filtered (" 0x%08x ", b->address);
835 last_addr = b->address;
838 sym = find_pc_function (b->address);
841 fputs_filtered (" in ", stdout);
842 fputs_demangled (SYMBOL_NAME (sym), stdout, 1);
843 fputs_filtered (" at ", stdout);
845 fputs_filtered (b->symtab->filename, stdout);
846 printf_filtered (":%d", b->line_number);
849 print_address_symbolic (b->address, stdout, demangle);
852 printf_filtered ("\n");
855 printf_filtered ("\tstop only in stack frame at 0x%x\n", b->frame);
858 printf_filtered ("\tstop only if ");
859 print_expression (b->cond, stdout);
860 printf_filtered ("\n");
863 printf_filtered ("\tignore next %d hits\n", b->ignore_count);
864 if ((l = b->commands))
867 fputs_filtered ("\t", stdout);
868 fputs_filtered (l->line, stdout);
869 fputs_filtered ("\n", stdout);
876 char *which = watchpoints ? "watch" : "break";
878 printf_filtered ("No %spoints.\n", which);
880 printf_filtered ("No %spoint numbered %d.\n", which, bnum);
883 /* Compare against (CORE_ADDR)-1 in case some compiler decides
884 that a comparison of an unsigned with -1 is always false. */
885 if (last_addr != (CORE_ADDR)-1)
886 set_next_address (last_addr);
890 breakpoints_info (bnum_exp, from_tty)
897 bnum = parse_and_eval_address (bnum_exp);
899 breakpoint_1 (bnum, 0);
903 watchpoints_info (bnum_exp, from_tty)
910 bnum = parse_and_eval_address (bnum_exp);
912 breakpoint_1 (bnum, 1);
915 /* Print a message describing any breakpoints set at PC. */
918 describe_other_breakpoints (pc)
919 register CORE_ADDR pc;
921 register int others = 0;
922 register struct breakpoint *b;
925 if (b->address == pc)
929 printf ("Note: breakpoint%s ", (others > 1) ? "s" : "");
931 if (b->address == pc)
936 (b->enable == disabled) ? " (disabled)" : "",
937 (others > 1) ? "," : ((others == 1) ? " and" : ""));
939 printf ("also set at pc 0x%x.\n", pc);
943 /* Set the default place to put a breakpoint
944 for the `break' command with no arguments. */
947 set_default_breakpoint (valid, addr, symtab, line)
950 struct symtab *symtab;
953 default_breakpoint_valid = valid;
954 default_breakpoint_address = addr;
955 default_breakpoint_symtab = symtab;
956 default_breakpoint_line = line;
959 /* Rescan breakpoints at address ADDRESS,
960 marking the first one as "first" and any others as "duplicates".
961 This is so that the bpt instruction is only inserted once. */
964 check_duplicates (address)
967 register struct breakpoint *b;
968 register int count = 0;
971 if (b->enable != disabled && b->address == address)
974 b->duplicate = count > 1;
978 /* Low level routine to set a breakpoint.
979 Takes as args the three things that every breakpoint must have.
980 Returns the breakpoint object so caller can set other things.
981 Does not set the breakpoint number!
982 Does not print anything. */
984 static struct breakpoint *
985 set_raw_breakpoint (sal)
986 struct symtab_and_line sal;
988 register struct breakpoint *b, *b1;
990 b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
991 bzero (b, sizeof *b);
993 b->symtab = sal.symtab;
994 b->line_number = sal.line;
1002 /* Add this breakpoint to the end of the chain
1003 so that a list of breakpoints will come out in order
1004 of increasing numbers. */
1006 b1 = breakpoint_chain;
1008 breakpoint_chain = b;
1016 check_duplicates (sal.pc);
1021 /* Set a breakpoint that will evaporate an end of command
1022 at address specified by SAL.
1023 Restrict it to frame FRAME if FRAME is nonzero. */
1026 set_momentary_breakpoint (sal, frame)
1027 struct symtab_and_line sal;
1030 register struct breakpoint *b;
1031 b = set_raw_breakpoint (sal);
1034 b->frame = (frame ? FRAME_FP (frame) : 0);
1038 clear_momentary_breakpoints ()
1040 register struct breakpoint *b;
1042 if (b->number == -3)
1044 delete_breakpoint (b);
1049 /* Tell the user we have just set a breakpoint B. */
1052 struct breakpoint *b;
1056 printf_filtered ("Watchpoint %d: ", b->number);
1057 print_expression (b->exp, stdout);
1061 printf_filtered ("Breakpoint %d at 0x%x", b->number, b->address);
1063 printf_filtered (": file %s, line %d.",
1064 b->symtab->filename, b->line_number);
1066 printf_filtered ("\n");
1070 /* Nobody calls this currently. */
1071 /* Set a breakpoint from a symtab and line.
1072 If TEMPFLAG is nonzero, it is a temporary breakpoint.
1073 ADDR_STRING is a malloc'd string holding the name of where we are
1074 setting the breakpoint. This is used later to re-set it after the
1075 program is relinked and symbols are reloaded.
1076 Print the same confirmation messages that the breakpoint command prints. */
1079 set_breakpoint (s, line, tempflag, addr_string)
1085 register struct breakpoint *b;
1086 struct symtab_and_line sal;
1090 sal.pc = find_line_pc (sal.symtab, sal.line);
1092 error ("No line %d in file \"%s\".\n", sal.line, sal.symtab->filename);
1095 describe_other_breakpoints (sal.pc);
1097 b = set_raw_breakpoint (sal);
1098 set_breakpoint_count (breakpoint_count + 1);
1099 b->number = breakpoint_count;
1101 b->addr_string = addr_string;
1103 b->enable = temporary;
1110 /* Set a breakpoint according to ARG (function, linenum or *address)
1111 and make it temporary if TEMPFLAG is nonzero. */
1114 break_command_1 (arg, tempflag, from_tty)
1116 int tempflag, from_tty;
1118 struct symtabs_and_lines sals;
1119 struct symtab_and_line sal;
1120 register struct expression *cond = 0;
1121 register struct breakpoint *b;
1123 /* Pointers in arg to the start, and one past the end, of the condition. */
1124 char *cond_start = NULL;
1126 /* Pointers in arg to the start, and one past the end,
1127 of the address part. */
1128 char *addr_start = NULL;
1137 sal.line = sal.pc = sal.end = 0;
1140 /* If no arg given, or if first arg is 'if ', use the default breakpoint. */
1142 if (!arg || (arg[0] == 'i' && arg[1] == 'f'
1143 && (arg[2] == ' ' || arg[2] == '\t')))
1145 if (default_breakpoint_valid)
1147 sals.sals = (struct symtab_and_line *)
1148 xmalloc (sizeof (struct symtab_and_line));
1149 sal.pc = default_breakpoint_address;
1150 sal.line = default_breakpoint_line;
1151 sal.symtab = default_breakpoint_symtab;
1156 error ("No default breakpoint address now.");
1162 /* Force almost all breakpoints to be in terms of the
1163 current_source_symtab (which is decode_line_1's default). This
1164 should produce the results we want almost all of the time while
1165 leaving default_breakpoint_* alone. */
1166 if (default_breakpoint_valid
1167 && (!current_source_symtab
1168 || (arg && (*arg == '+' || *arg == '-'))))
1169 sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
1170 default_breakpoint_line);
1172 sals = decode_line_1 (&arg, 1, (struct symtab *)NULL, 0);
1180 for (i = 0; i < sals.nelts; i++)
1183 if (sal.pc == 0 && sal.symtab != 0)
1185 pc = find_line_pc (sal.symtab, sal.line);
1187 error ("No line %d in file \"%s\".",
1188 sal.line, sal.symtab->filename);
1195 if (arg[0] == 'i' && arg[1] == 'f'
1196 && (arg[2] == ' ' || arg[2] == '\t'))
1200 cond = parse_c_1 (&arg, block_for_pc (pc), 0);
1204 error ("Junk at end of arguments.");
1206 sals.sals[i].pc = pc;
1209 for (i = 0; i < sals.nelts; i++)
1214 describe_other_breakpoints (sal.pc);
1216 b = set_raw_breakpoint (sal);
1217 set_breakpoint_count (breakpoint_count + 1);
1218 b->number = breakpoint_count;
1222 b->addr_string = savestring (addr_start, addr_end - addr_start);
1224 b->cond_string = savestring (cond_start, cond_end - cond_start);
1227 b->enable = temporary;
1234 printf ("Multiple breakpoints were set.\n");
1235 printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
1241 break_command (arg, from_tty)
1245 break_command_1 (arg, 0, from_tty);
1249 tbreak_command (arg, from_tty)
1253 break_command_1 (arg, 1, from_tty);
1257 watch_command (arg, from_tty)
1261 struct breakpoint *b;
1262 struct symtab_and_line sal;
1268 b = set_raw_breakpoint (sal);
1269 set_breakpoint_count (breakpoint_count + 1);
1270 b->number = breakpoint_count;
1271 innermost_block = NULL;
1272 b->exp = parse_c_expression (arg);
1273 b->exp_valid_block = innermost_block;
1274 b->val = evaluate_expression (b->exp);
1275 release_value (b->val);
1277 b->cond_string = NULL;
1282 * Helper routine for the until_command routine in infcmd.c. Here
1283 * because it uses the mechanisms of breakpoints.
1286 until_break_command (arg, from_tty)
1290 struct symtabs_and_lines sals;
1291 struct symtab_and_line sal;
1292 FRAME prev_frame = get_prev_frame (selected_frame);
1294 clear_proceed_status ();
1296 /* Set a breakpoint where the user wants it and at return from
1299 if (default_breakpoint_valid)
1300 sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
1301 default_breakpoint_line);
1303 sals = decode_line_1 (&arg, 1, (struct symtab *)NULL, 0);
1305 if (sals.nelts != 1)
1306 error ("Couldn't get information on specified line.");
1309 free (sals.sals); /* malloc'd, so freed */
1312 error ("Junk at end of arguments.");
1314 if (sal.pc == 0 && sal.symtab != 0)
1315 sal.pc = find_line_pc (sal.symtab, sal.line);
1318 error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
1320 set_momentary_breakpoint (sal, selected_frame);
1322 /* Keep within the current frame */
1326 struct frame_info *fi;
1328 fi = get_frame_info (prev_frame);
1329 sal = find_pc_line (fi->pc, 0);
1331 set_momentary_breakpoint (sal, prev_frame);
1334 proceed (-1, -1, 0);
1337 /* Set a breakpoint at the catch clause for NAME. */
1339 catch_breakpoint (name)
1345 disable_catch_breakpoint ()
1350 delete_catch_breakpoint ()
1355 enable_catch_breakpoint ()
1361 struct sal_chain *next;
1362 struct symtab_and_line sal;
1365 /* For each catch clause identified in ARGS, run FUNCTION
1366 with that clause as an argument. */
1367 static struct symtabs_and_lines
1368 map_catch_names (args, function)
1372 register char *p = args;
1374 struct symtabs_and_lines sals;
1375 struct sal_chain *sal_chain = 0;
1378 error_no_arg ("one or more catch names");
1386 /* Don't swallow conditional part. */
1387 if (p1[0] == 'i' && p1[1] == 'f'
1388 && (p1[2] == ' ' || p1[2] == '\t'))
1394 while (isalnum (*p1) || *p1 == '_' || *p1 == '$')
1398 if (*p1 && *p1 != ' ' && *p1 != '\t')
1399 error ("Arguments must be catch names.");
1405 struct sal_chain *next
1406 = (struct sal_chain *)alloca (sizeof (struct sal_chain));
1407 next->next = sal_chain;
1408 next->sal = get_catch_sal (p);
1413 printf ("No catch clause for exception %s.\n", p);
1416 while (*p == ' ' || *p == '\t') p++;
1420 /* This shares a lot of code with `print_frame_label_vars' from stack.c. */
1422 static struct symtabs_and_lines
1423 get_catch_sals (this_level_only)
1424 int this_level_only;
1426 extern struct blockvector *blockvector_for_pc ();
1427 register struct blockvector *bl;
1428 register struct block *block = get_frame_block (selected_frame);
1429 int index, have_default = 0;
1430 struct frame_info *fi = get_frame_info (selected_frame);
1431 CORE_ADDR pc = fi->pc;
1432 struct symtabs_and_lines sals;
1433 struct sal_chain *sal_chain = 0;
1434 char *blocks_searched;
1440 error ("No symbol table info available.\n");
1442 bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
1443 blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
1444 bzero (blocks_searched, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
1448 CORE_ADDR end = BLOCK_END (block) - 4;
1451 if (bl != blockvector_for_pc (end, &index))
1452 error ("blockvector blotch");
1453 if (BLOCKVECTOR_BLOCK (bl, index) != block)
1454 error ("blockvector botch");
1455 last_index = BLOCKVECTOR_NBLOCKS (bl);
1458 /* Don't print out blocks that have gone by. */
1459 while (index < last_index
1460 && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < pc)
1463 while (index < last_index
1464 && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < end)
1466 if (blocks_searched[index] == 0)
1468 struct block *b = BLOCKVECTOR_BLOCK (bl, index);
1471 register struct symbol *sym;
1473 nsyms = BLOCK_NSYMS (b);
1475 for (i = 0; i < nsyms; i++)
1477 sym = BLOCK_SYM (b, i);
1478 if (! strcmp (SYMBOL_NAME (sym), "default"))
1484 if (SYMBOL_CLASS (sym) == LOC_LABEL)
1486 struct sal_chain *next = (struct sal_chain *)
1487 alloca (sizeof (struct sal_chain));
1488 next->next = sal_chain;
1489 next->sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
1493 blocks_searched[index] = 1;
1499 if (sal_chain && this_level_only)
1502 /* After handling the function's top-level block, stop.
1503 Don't continue to its superblock, the block of
1504 per-file symbols. */
1505 if (BLOCK_FUNCTION (block))
1507 block = BLOCK_SUPERBLOCK (block);
1512 struct sal_chain *tmp_chain;
1514 /* Count the number of entries. */
1515 for (index = 0, tmp_chain = sal_chain; tmp_chain;
1516 tmp_chain = tmp_chain->next)
1520 sals.sals = (struct symtab_and_line *)
1521 xmalloc (index * sizeof (struct symtab_and_line));
1522 for (index = 0; sal_chain; sal_chain = sal_chain->next, index++)
1523 sals.sals[index] = sal_chain->sal;
1529 /* Commands to deal with catching exceptions. */
1532 catch_command_1 (arg, tempflag, from_tty)
1537 /* First, translate ARG into something we can deal with in terms
1540 struct symtabs_and_lines sals;
1541 struct symtab_and_line sal;
1542 register struct expression *cond = 0;
1543 register struct breakpoint *b;
1548 sal.line = sal.pc = sal.end = 0;
1551 /* If no arg given, or if first arg is 'if ', all active catch clauses
1552 are breakpointed. */
1554 if (!arg || (arg[0] == 'i' && arg[1] == 'f'
1555 && (arg[2] == ' ' || arg[2] == '\t')))
1557 /* Grab all active catch clauses. */
1558 sals = get_catch_sals (0);
1562 /* Grab selected catch clauses. */
1563 error ("catch NAME not implemeneted");
1564 sals = map_catch_names (arg, catch_breakpoint);
1571 for (i = 0; i < sals.nelts; i++)
1574 if (sal.pc == 0 && sal.symtab != 0)
1576 pc = find_line_pc (sal.symtab, sal.line);
1578 error ("No line %d in file \"%s\".",
1579 sal.line, sal.symtab->filename);
1586 if (arg[0] == 'i' && arg[1] == 'f'
1587 && (arg[2] == ' ' || arg[2] == '\t'))
1588 cond = (struct expression *) parse_c_1 ((arg += 2, &arg),
1589 block_for_pc (pc), 0);
1591 error ("Junk at end of arguments.");
1594 sals.sals[i].pc = pc;
1597 for (i = 0; i < sals.nelts; i++)
1602 describe_other_breakpoints (sal.pc);
1604 b = set_raw_breakpoint (sal);
1605 b->number = ++breakpoint_count;
1608 b->enable = temporary;
1610 printf ("Breakpoint %d at 0x%x", b->number, b->address);
1612 printf (": file %s, line %d.", b->symtab->filename, b->line_number);
1618 printf ("Multiple breakpoints were set.\n");
1619 printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
1624 /* Disable breakpoints on all catch clauses described in ARGS. */
1626 disable_catch (args)
1629 /* Map the disable command to catch clauses described in ARGS. */
1632 /* Enable breakpoints on all catch clauses described in ARGS. */
1637 /* Map the disable command to catch clauses described in ARGS. */
1640 /* Delete breakpoints on all catch clauses in the active scope. */
1645 /* Map the delete command to catch clauses described in ARGS. */
1649 catch_command (arg, from_tty)
1653 catch_command_1 (arg, 0, from_tty);
1657 clear_command (arg, from_tty)
1661 register struct breakpoint *b, *b1;
1662 struct symtabs_and_lines sals;
1663 struct symtab_and_line sal;
1664 register struct breakpoint *found;
1669 sals = decode_line_spec (arg, 1);
1673 sals.sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line));
1674 sal.line = default_breakpoint_line;
1675 sal.symtab = default_breakpoint_symtab;
1677 if (sal.symtab == 0)
1678 error ("No source file specified.");
1684 for (i = 0; i < sals.nelts; i++)
1686 /* If exact pc given, clear bpts at that pc.
1687 But if sal.pc is zero, clear all bpts on specified line. */
1689 found = (struct breakpoint *) 0;
1690 while (breakpoint_chain
1691 && (sal.pc ? breakpoint_chain->address == sal.pc
1692 : (breakpoint_chain->symtab == sal.symtab
1693 && breakpoint_chain->line_number == sal.line)))
1695 b1 = breakpoint_chain;
1696 breakpoint_chain = b1->next;
1703 && b->next->address != NULL
1704 && (sal.pc ? b->next->address == sal.pc
1705 : (b->next->symtab == sal.symtab
1706 && b->next->line_number == sal.line)))
1717 error ("No breakpoint at %s.", arg);
1719 error ("No breakpoint at this line.");
1722 if (found->next) from_tty = 1; /* Always report if deleted more than one */
1723 if (from_tty) printf ("Deleted breakpoint%s ", found->next ? "s" : "");
1726 if (from_tty) printf ("%d ", found->number);
1728 delete_breakpoint (found);
1731 if (from_tty) putchar ('\n');
1736 /* Delete breakpoint in BS if they are `delete' breakpoints.
1737 This is called after any breakpoint is hit, or after errors. */
1740 breakpoint_auto_delete (bs)
1743 for (; bs; bs = bs->next)
1744 if (bs->breakpoint_at && bs->breakpoint_at->enable == delete)
1745 delete_breakpoint (bs->breakpoint_at);
1748 /* Delete a breakpoint and clean up all traces of it in the data structures. */
1751 delete_breakpoint (bpt)
1752 struct breakpoint *bpt;
1754 register struct breakpoint *b;
1758 target_remove_breakpoint(bpt->address, bpt->shadow_contents);
1760 if (breakpoint_chain == bpt)
1761 breakpoint_chain = bpt->next;
1766 b->next = bpt->next;
1770 check_duplicates (bpt->address);
1772 free_command_lines (&bpt->commands);
1775 if (bpt->cond_string != NULL)
1776 free (bpt->cond_string);
1777 if (bpt->addr_string != NULL)
1778 free (bpt->addr_string);
1780 if (xgdb_verbose && bpt->number >=0)
1781 printf ("breakpoint #%d deleted\n", bpt->number);
1783 /* Be sure no bpstat's are pointing at it after it's been freed. */
1784 /* FIXME, how can we find all bpstat's? We just check stop_bpstat for now. */
1785 for (bs = stop_bpstat; bs; bs = bs->next)
1786 if (bs->breakpoint_at == bpt)
1787 bs->breakpoint_at = NULL;
1791 static void map_breakpoint_numbers ();
1794 delete_command (arg, from_tty)
1801 /* Ask user only if there are some breakpoints to delete. */
1803 || (breakpoint_chain && query ("Delete all breakpoints? ", 0, 0)))
1805 /* No arg; clear all breakpoints. */
1806 while (breakpoint_chain)
1807 delete_breakpoint (breakpoint_chain);
1811 map_breakpoint_numbers (arg, delete_breakpoint);
1815 breakpoint_re_set_one (bint)
1818 struct breakpoint *b = (struct breakpoint *)bint; /* get past catch_errs */
1820 struct symtabs_and_lines sals;
1821 struct symtab_and_line sal;
1824 if (b->address != NULL && b->addr_string != NULL)
1827 sals = decode_line_1 (&s, 1, (struct symtab *)NULL, 0);
1828 for (i = 0; i < sals.nelts; i++)
1832 b->symtab = sal.symtab;
1833 b->line_number = sal.line;
1834 if (sal.pc == 0 && sal.symtab != 0)
1836 sal.pc = find_line_pc (sal.symtab, sal.line);
1838 error ("No line %d in file \"%s\".",
1839 sal.line, sal.symtab->filename);
1841 b->address = sal.pc;
1843 if (b->cond_string != NULL)
1846 b->cond = parse_c_1 (&s, block_for_pc (sal.pc), 0);
1849 check_duplicates (b->address);
1857 /* Anything without a string can't be re-set. */
1858 delete_breakpoint (b);
1862 /* Re-set all breakpoints after symbols have been re-loaded. */
1864 breakpoint_re_set ()
1866 struct breakpoint *b;
1870 b->symtab = 0; /* Be sure we don't point to old dead symtab */
1871 (void) catch_errors (breakpoint_re_set_one, (int) b,
1872 "Error in re-setting breakpoint");
1875 /* Blank line to finish off all those mention() messages we just printed. */
1876 printf_filtered ("\n");
1879 /* Set ignore-count of breakpoint number BPTNUM to COUNT.
1880 If from_tty is nonzero, it prints a message to that effect,
1881 which ends with a period (no newline). */
1884 set_ignore_count (bptnum, count, from_tty)
1885 int bptnum, count, from_tty;
1887 register struct breakpoint *b;
1893 if (b->number == bptnum)
1895 b->ignore_count = count;
1898 else if (count == 0)
1899 printf ("Will stop next time breakpoint %d is reached.", bptnum);
1900 else if (count == 1)
1901 printf ("Will ignore next crossing of breakpoint %d.", bptnum);
1903 printf ("Will ignore next %d crossings of breakpoint %d.",
1908 error ("No breakpoint number %d.", bptnum);
1911 /* Clear the ignore counts of all breakpoints. */
1913 breakpoint_clear_ignore_counts ()
1915 struct breakpoint *b;
1918 b->ignore_count = 0;
1921 /* Command to set ignore-count of breakpoint N to COUNT. */
1924 ignore_command (args, from_tty)
1932 error_no_arg ("a breakpoint number");
1934 num = get_number (&p);
1937 error ("Second argument (specified ignore-count) is missing.");
1939 set_ignore_count (num, parse_and_eval_address (p), from_tty);
1943 /* Call FUNCTION on each of the breakpoints
1944 whose numbers are given in ARGS. */
1947 map_breakpoint_numbers (args, function)
1949 void (*function) ();
1951 register char *p = args;
1954 register struct breakpoint *b;
1957 error_no_arg ("one or more breakpoint numbers");
1963 num = get_number (&p1);
1966 if (b->number == num)
1971 printf ("No breakpoint number %d.\n", num);
1978 enable_breakpoint (bpt)
1979 struct breakpoint *bpt;
1981 bpt->enable = enabled;
1983 if (xgdb_verbose && bpt->number >= 0)
1984 printf ("breakpoint #%d enabled\n", bpt->number);
1986 check_duplicates (bpt->address);
1987 if (bpt->val != NULL)
1989 value_free (bpt->val);
1991 bpt->val = evaluate_expression (bpt->exp);
1992 release_value (bpt->val);
1997 enable_command (args, from_tty)
2001 struct breakpoint *bpt;
2003 ALL_BREAKPOINTS (bpt)
2004 enable_breakpoint (bpt);
2006 map_breakpoint_numbers (args, enable_breakpoint);
2010 disable_breakpoint (bpt)
2011 struct breakpoint *bpt;
2013 bpt->enable = disabled;
2015 if (xgdb_verbose && bpt->number >= 0)
2016 printf ("breakpoint #%d disabled\n", bpt->number);
2018 check_duplicates (bpt->address);
2022 disable_command (args, from_tty)
2026 register struct breakpoint *bpt;
2028 ALL_BREAKPOINTS (bpt)
2029 disable_breakpoint (bpt);
2031 map_breakpoint_numbers (args, disable_breakpoint);
2035 enable_once_breakpoint (bpt)
2036 struct breakpoint *bpt;
2038 bpt->enable = temporary;
2040 check_duplicates (bpt->address);
2044 enable_once_command (args, from_tty)
2048 map_breakpoint_numbers (args, enable_once_breakpoint);
2052 enable_delete_breakpoint (bpt)
2053 struct breakpoint *bpt;
2055 bpt->enable = delete;
2057 check_duplicates (bpt->address);
2061 enable_delete_command (args, from_tty)
2065 map_breakpoint_numbers (args, enable_delete_breakpoint);
2069 * Use default_breakpoint_'s, or nothing if they aren't valid.
2071 struct symtabs_and_lines
2072 decode_line_spec_1 (string, funfirstline)
2076 struct symtabs_and_lines sals;
2078 error ("Empty line specification.");
2079 if (default_breakpoint_valid)
2080 sals = decode_line_1 (&string, funfirstline,
2081 default_breakpoint_symtab, default_breakpoint_line);
2083 sals = decode_line_1 (&string, funfirstline, (struct symtab *)NULL, 0);
2085 error ("Junk at end of line specification: %s", string);
2090 /* Chain containing all defined enable commands. */
2092 extern struct cmd_list_element
2093 *enablelist, *disablelist,
2094 *deletelist, *enablebreaklist;
2096 extern struct cmd_list_element *cmdlist;
2099 _initialize_breakpoint ()
2101 breakpoint_chain = 0;
2102 /* Don't bother to call set_breakpoint_count. $bpnum isn't useful
2103 before a breakpoint is set. */
2104 breakpoint_count = 0;
2106 add_com ("ignore", class_breakpoint, ignore_command,
2107 "Set ignore-count of breakpoint number N to COUNT.");
2109 add_com ("commands", class_breakpoint, commands_command,
2110 "Set commands to be executed when a breakpoint is hit.\n\
2111 Give breakpoint number as argument after \"commands\".\n\
2112 With no argument, the targeted breakpoint is the last one set.\n\
2113 The commands themselves follow starting on the next line.\n\
2114 Type a line containing \"end\" to indicate the end of them.\n\
2115 Give \"silent\" as the first line to make the breakpoint silent;\n\
2116 then no output is printed when it is hit, except what the commands print.");
2118 add_com ("condition", class_breakpoint, condition_command,
2119 "Specify breakpoint number N to break only if COND is true.\n\
2120 N is an integer; COND is a C expression to be evaluated whenever\n\
2121 breakpoint N is reached. Actually break only when COND is nonzero.");
2123 add_com ("tbreak", class_breakpoint, tbreak_command,
2124 "Set a temporary breakpoint. Args like \"break\" command.\n\
2125 Like \"break\" except the breakpoint is only enabled temporarily,\n\
2126 so it will be disabled when hit. Equivalent to \"break\" followed\n\
2127 by using \"enable once\" on the breakpoint number.");
2129 add_prefix_cmd ("enable", class_breakpoint, enable_command,
2130 "Enable some breakpoints.\n\
2131 Give breakpoint numbers (separated by spaces) as arguments.\n\
2132 With no subcommand, breakpoints are enabled until you command otherwise.\n\
2133 This is used to cancel the effect of the \"disable\" command.\n\
2134 With a subcommand you can enable temporarily.",
2135 &enablelist, "enable ", 1, &cmdlist);
2137 add_abbrev_prefix_cmd ("breakpoints", class_breakpoint, enable_command,
2138 "Enable some breakpoints.\n\
2139 Give breakpoint numbers (separated by spaces) as arguments.\n\
2140 This is used to cancel the effect of the \"disable\" command.\n\
2141 May be abbreviated to simply \"enable\".\n",
2142 &enablebreaklist, "enable breakpoints ", 1, &enablelist);
2144 add_cmd ("once", no_class, enable_once_command,
2145 "Enable breakpoints for one hit. Give breakpoint numbers.\n\
2146 If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
2147 See the \"tbreak\" command which sets a breakpoint and enables it once.",
2150 add_cmd ("delete", no_class, enable_delete_command,
2151 "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
2152 If a breakpoint is hit while enabled in this fashion, it is deleted.",
2155 add_cmd ("delete", no_class, enable_delete_command,
2156 "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
2157 If a breakpoint is hit while enabled in this fashion, it is deleted.",
2160 add_cmd ("once", no_class, enable_once_command,
2161 "Enable breakpoints for one hit. Give breakpoint numbers.\n\
2162 If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
2163 See the \"tbreak\" command which sets a breakpoint and enables it once.",
2166 add_prefix_cmd ("disable", class_breakpoint, disable_command,
2167 "Disable some breakpoints.\n\
2168 Arguments are breakpoint numbers with spaces in between.\n\
2169 To disable all breakpoints, give no argument.\n\
2170 A disabled breakpoint is not forgotten, but has no effect until reenabled.",
2171 &disablelist, "disable ", 1, &cmdlist);
2172 add_com_alias ("dis", "disable", class_breakpoint, 1);
2173 add_com_alias ("disa", "disable", class_breakpoint, 1);
2175 add_cmd ("breakpoints", class_alias, disable_command,
2176 "Disable some breakpoints.\n\
2177 Arguments are breakpoint numbers with spaces in between.\n\
2178 To disable all breakpoints, give no argument.\n\
2179 A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
2180 This command may be abbreviated \"disable\".",
2183 add_prefix_cmd ("delete", class_breakpoint, delete_command,
2184 "Delete some breakpoints or auto-display expressions.\n\
2185 Arguments are breakpoint numbers with spaces in between.\n\
2186 To delete all breakpoints, give no argument.\n\
2188 Also a prefix command for deletion of other GDB objects.\n\
2189 The \"unset\" command is also an alias for \"delete\".",
2190 &deletelist, "delete ", 1, &cmdlist);
2191 add_com_alias ("d", "delete", class_breakpoint, 1);
2192 add_com_alias ("unset", "delete", class_alias, 1);
2194 add_cmd ("breakpoints", class_alias, delete_command,
2195 "Delete some breakpoints or auto-display expressions.\n\
2196 Arguments are breakpoint numbers with spaces in between.\n\
2197 To delete all breakpoints, give no argument.\n\
2198 This command may be abbreviated \"delete\".",
2201 add_com ("clear", class_breakpoint, clear_command,
2202 "Clear breakpoint at specified line or function.\n\
2203 Argument may be line number, function name, or \"*\" and an address.\n\
2204 If line number is specified, all breakpoints in that line are cleared.\n\
2205 If function is specified, breakpoints at beginning of function are cleared.\n\
2206 If an address is specified, breakpoints at that address are cleared.\n\n\
2207 With no argument, clears all breakpoints in the line that the selected frame\n\
2210 See also the \"delete\" command which clears breakpoints by number.");
2212 add_com ("break", class_breakpoint, break_command,
2213 "Set breakpoint at specified line or function.\n\
2214 Argument may be line number, function name, or \"*\" and an address.\n\
2215 If line number is specified, break at start of code for that line.\n\
2216 If function is specified, break at start of code for that function.\n\
2217 If an address is specified, break at that exact address.\n\
2218 With no arg, uses current execution address of selected stack frame.\n\
2219 This is useful for breaking on return to a stack frame.\n\
2221 Multiple breakpoints at one place are permitted, and useful if conditional.\n\
2223 Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
2224 add_com_alias ("b", "break", class_run, 1);
2225 add_com_alias ("br", "break", class_run, 1);
2226 add_com_alias ("bre", "break", class_run, 1);
2227 add_com_alias ("brea", "break", class_run, 1);
2229 add_info ("breakpoints", breakpoints_info,
2230 "Status of all breakpoints, or breakpoint number NUMBER.\n\
2231 Second column is \"y\" for enabled breakpoint, \"n\" for disabled,\n\
2232 \"o\" for enabled once (disable when hit), \"d\" for enable but delete when hit.\n\
2233 Then come the address and the file/line number.\n\n\
2234 Convenience variable \"$_\" and default examine address for \"x\"\n\
2235 are set to the address of the last breakpoint listed.\n\n\
2236 Convenience variable \"$bpnum\" contains the number of the last\n\
2239 add_com ("catch", class_breakpoint, catch_command,
2240 "Set breakpoints to catch exceptions that are raised.\n\
2241 Argument may be a single exception to catch, multiple exceptions\n\
2242 to catch, or the default exception \"default\". If no arguments\n\
2243 are given, breakpoints are set at all exception handlers catch clauses\n\
2244 within the current scope.\n\
2246 A condition specified for the catch applies to all breakpoints set\n\
2247 with this command\n\
2249 Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
2251 add_com ("watch", class_breakpoint, watch_command,
2252 "Set a watchpoint for an expression.\n\
2253 A watchpoint stops execution of your program whenever the value of\n\
2254 an expression changes.");
2256 add_info ("watchpoints", watchpoints_info,
2257 "Status of all watchpoints, or watchpoint number NUMBER.\n\
2258 Second column is \"y\" for enabled watchpoints, \"n\" for disabled.");