1 /* Everything about breakpoints, for GDB.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
4 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5 WARRANTY. No author or distributor accepts responsibility to anyone
6 for the consequences of using it or for whether it serves any
7 particular purpose or works at all, unless he says so in writing.
8 Refer to the GDB General Public License for full details.
10 Everyone is granted permission to copy, modify and redistribute GDB,
11 but only under the conditions described in the GDB General Public
12 License. A copy of this license is supposed to have been given to you
13 along with GDB so you can know your rights and responsibilities. It
14 should be in a file named COPYING. Among other things, the copyright
15 notice and this notice must be preserved on all copies.
17 In other words, go ahead and share GDB, but don't try to stop
18 anyone else from sharing it farther. Help stamp out software hoarding!
28 /* This is the sequence of bytes we insert for a breakpoint. */
30 static char break_insn[] = BREAKPOINT;
32 /* States of enablement of breakpoint.
33 `temporary' means disable when hit.
34 `delete' means delete when hit. */
36 enum enable { disabled, enabled, temporary, delete};
38 /* Not that the ->silent field is not currently used by any commands
39 (though the code is in there if it was to be and set_raw_breakpoint
40 does set it to 0). I implemented it because I thought it would be
41 useful for a hack I had to put in; I'm going to leave it in because
42 I can see how there might be times when it would indeed be useful */
46 struct breakpoint *next;
47 /* Number assigned to distinguish breakpoints. */
49 /* Address to break at. */
51 /* Line number of this address. Redundant. */
53 /* Symtab of file of this address. Redundant. */
54 struct symtab *symtab;
55 /* Zero means disabled; remember the info but don't break here. */
57 /* Non-zero means a silent breakpoint (don't print frame info
60 /* Number of stops at this breakpoint that should
61 be continued automatically before really stopping. */
63 /* "Real" contents of byte where breakpoint has been inserted.
64 Valid only when breakpoints are in the program. */
65 char shadow_contents[sizeof break_insn];
66 /* Nonzero if this breakpoint is now inserted. */
68 /* Nonzero if this is not the first breakpoint in the list
69 for the given address. */
71 /* Chain of command lines to execute when this breakpoint is hit. */
72 struct command_line *commands;
73 /* Stack depth (address of frame). If nonzero, break only if fp
76 /* Conditional. Break only if this expression's value is nonzero. */
77 struct expression *cond;
80 #define ALL_BREAKPOINTS(b) for (b = breakpoint_chain; b; b = b->next)
82 /* Chain of all breakpoints defined. */
84 struct breakpoint *breakpoint_chain;
86 /* Number of last breakpoint made. */
88 static int breakpoint_count;
90 /* Default address, symtab and line to put a breakpoint at
91 for "break" command with no arg.
92 if default_breakpoint_valid is zero, the other three are
93 not valid, and "break" with no arg is an error.
95 This set by print_stack_frame, which calls set_default_breakpoint. */
97 int default_breakpoint_valid;
98 CORE_ADDR default_breakpoint_address;
99 struct symtab *default_breakpoint_symtab;
100 int default_breakpoint_line;
102 /* Remaining commands (not yet executed)
103 of last breakpoint hit. */
105 struct command_line *breakpoint_commands;
107 static void delete_breakpoint ();
108 void clear_momentary_breakpoints ();
109 void breakpoint_auto_delete ();
111 /* condition N EXP -- set break condition of breakpoint N to EXP. */
114 condition_command (arg, from_tty)
118 register struct breakpoint *b;
121 register struct expression *expr;
124 error_no_arg ("breakpoint number");
127 while (*p >= '0' && *p <= '9') p++;
131 if (b->number == bnum)
139 printf ("Breakpoint %d now unconditional.\n", bnum);
143 if (*p != ' ' && *p != '\t')
144 error ("Arguments must be an integer (breakpoint number) and an expression.");
146 /* Find start of expression */
147 while (*p == ' ' || *p == '\t') p++;
150 b->cond = (struct expression *) parse_c_1 (&arg, block_for_pc (b->address), 0);
152 error ("Junk at end of expression");
157 error ("No breakpoint number %d.", bnum);
161 commands_command (arg)
164 register struct breakpoint *b;
165 register char *p, *p1;
167 struct command_line *l;
169 /* If we allowed this, we would have problems with when to
170 free the storage, if we change the commands currently
173 if (breakpoint_commands)
174 error ("Can't use the \"commands\" command among a breakpoint's commands.");
176 /* Allow commands by itself to refer to the last breakpoint. */
178 bnum = breakpoint_count;
182 if (! (*p >= '0' && *p <= '9'))
183 error ("Argument must be integer (a breakpoint number).");
185 while (*p >= '0' && *p <= '9') p++;
187 error ("Unexpected extra arguments following breakpoint number.");
193 if (b->number == bnum)
195 if (input_from_terminal_p ())
197 printf ("Type commands for when breakpoint %d is hit, one per line.\n\
198 End with a line saying just \"end\".\n", bnum);
201 l = read_command_lines ();
202 free_command_lines (&b->commands);
206 error ("No breakpoint number %d.", bnum);
209 /* Called from command loop to execute the commands
210 associated with the breakpoint we just stopped at. */
213 do_breakpoint_commands ()
215 while (breakpoint_commands)
217 char *line = breakpoint_commands->line;
218 breakpoint_commands = breakpoint_commands->next;
219 execute_command (line, 0);
220 /* If command was "cont", breakpoint_commands is now 0,
221 of if we stopped at yet another breakpoint which has commands,
222 it is now the commands for the new breakpoint. */
224 clear_momentary_breakpoints ();
227 /* Used when the program is proceeded, to eliminate any remaining
228 commands attached to the previous breakpoint we stopped at. */
231 clear_breakpoint_commands ()
233 breakpoint_commands = 0;
234 breakpoint_auto_delete (0);
237 /* Functions to get and set the current list of pending
238 breakpoint commands. These are used by run_stack_dummy
239 to preserve the commands around a function call. */
241 struct command_line *
242 get_breakpoint_commands ()
244 return breakpoint_commands;
248 set_breakpoint_commands (cmds)
249 struct command_line *cmds;
251 breakpoint_commands = cmds;
254 /* insert_breakpoints is used when starting or continuing the program.
255 remove_breakpoints is used when the program stops.
256 Both return zero if successful,
257 or an `errno' value if could not write the inferior. */
260 insert_breakpoints ()
262 register struct breakpoint *b;
265 #ifdef BREAKPOINT_DEBUG
266 printf ("Inserting breakpoints.\n");
267 #endif /* BREAKPOINT_DEBUG */
270 if (b->enable != disabled && ! b->inserted && ! b->duplicate)
272 read_memory (b->address, b->shadow_contents, sizeof break_insn);
273 val = write_memory (b->address, break_insn, sizeof break_insn);
276 #ifdef BREAKPOINT_DEBUG
277 printf ("Inserted breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
278 b->address, b->shadow_contents[0], b->shadow_contents[1]);
279 #endif /* BREAKPOINT_DEBUG */
286 remove_breakpoints ()
288 register struct breakpoint *b;
291 #ifdef BREAKPOINT_DEBUG
292 printf ("Removing breakpoints.\n");
293 #endif /* BREAKPOINT_DEBUG */
298 val = write_memory (b->address, b->shadow_contents, sizeof break_insn);
302 #ifdef BREAKPOINT_DEBUG
303 printf ("Removed breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
304 b->address, b->shadow_contents[0], b->shadow_contents[1]);
305 #endif /* BREAKPOINT_DEBUG */
311 /* Clear the "inserted" flag in all breakpoints.
312 This is done when the inferior is loaded. */
315 mark_breakpoints_out ()
317 register struct breakpoint *b;
323 /* breakpoint_here_p (PC) returns 1 if an enabled breakpoint exists at PC.
324 When continuing from a location with a breakpoint,
325 we actually single step once before calling insert_breakpoints. */
328 breakpoint_here_p (pc)
331 register struct breakpoint *b;
334 if (b->enable != disabled && b->address == pc)
340 /* Evaluate the expression EXP and return 1 if value is zero.
341 This is used inside a catch_errors to evaluate the breakpoint condition. */
344 breakpoint_cond_eval (exp)
345 struct expression *exp;
347 return value_zerop (evaluate_expression (exp));
350 /* Return 0 if PC is not the address just after a breakpoint,
351 or -1 if breakpoint says do not stop now,
352 or -2 if breakpoint says it has deleted itself and don't stop,
353 or -3 if hit a breakpoint number -3 (delete when program stops),
354 or else the number of the breakpoint,
355 with 0x1000000 added (or subtracted, for a negative return value) for
356 a silent breakpoint. */
359 breakpoint_stop_status (pc, frame_address)
361 FRAME_ADDR frame_address;
363 register struct breakpoint *b;
364 register int cont = 0;
366 /* Get the address where the breakpoint would have been. */
367 pc -= DECR_PC_AFTER_BREAK;
370 if (b->enable != disabled && b->address == pc)
372 if (b->frame && b->frame != frame_address)
380 = catch_errors (breakpoint_cond_eval, b->cond,
381 "Error occurred in testing breakpoint condition.");
384 if (b->cond && value_zero)
388 else if (b->ignore_count > 0)
395 if (b->enable == temporary)
396 b->enable = disabled;
397 breakpoint_commands = b->commands;
399 || (breakpoint_commands
400 && !strcmp ("silent", breakpoint_commands->line)))
402 if (breakpoint_commands)
403 breakpoint_commands = breakpoint_commands->next;
404 return (b->number > 0 ?
405 0x1000000 + b->number :
406 b->number - 0x1000000);
420 register struct breakpoint *b;
421 register struct command_line *l;
422 register struct symbol *sym;
423 CORE_ADDR last_addr = -1;
426 if (bnum == -1 || bnum == b->number)
428 printf ("#%-3d %c 0x%08x ", b->number,
429 "nyod"[(int) b->enable],
431 last_addr = b->address;
434 sym = find_pc_function (b->address);
436 printf (" in %s (%s line %d)", SYMBOL_NAME (sym),
437 b->symtab->filename, b->line_number);
439 printf ("%s line %d", b->symtab->filename, b->line_number);
444 printf ("\tignore next %d hits\n", b->ignore_count);
446 printf ("\tstop only in stack frame at 0x%x\n", b->frame);
449 printf ("\tbreak only if ");
450 print_expression (b->cond, stdout);
456 printf ("\t%s\n", l->line);
462 set_next_address (last_addr);
466 breakpoints_info (bnum_exp)
472 bnum = parse_and_eval_address (bnum_exp);
473 else if (breakpoint_chain == 0)
474 printf ("No breakpoints.\n");
476 printf ("Breakpoints:\n\
477 Num Enb Address Where\n");
482 /* Print a message describing any breakpoints set at PC. */
485 describe_other_breakpoints (pc)
486 register CORE_ADDR pc;
488 register int others = 0;
489 register struct breakpoint *b;
492 if (b->address == pc)
496 printf ("Note: breakpoint%s ", (others > 1) ? "s" : "");
498 if (b->address == pc)
503 (b->enable == disabled) ? " (disabled)" : "",
504 (others > 1) ? "," : ((others == 1) ? " and" : ""));
506 printf (" also set at pc 0x%x\n", pc);
510 /* Set the default place to put a breakpoint
511 for the `break' command with no arguments. */
514 set_default_breakpoint (valid, addr, symtab, line)
517 struct symtab *symtab;
520 default_breakpoint_valid = valid;
521 default_breakpoint_address = addr;
522 default_breakpoint_symtab = symtab;
523 default_breakpoint_line = line;
526 /* Rescan breakpoints at address ADDRESS,
527 marking the first one as "first" and any others as "duplicates".
528 This is so that the bpt instruction is only inserted once. */
531 check_duplicates (address)
534 register struct breakpoint *b;
535 register int count = 0;
538 if (b->enable != disabled && b->address == address)
541 b->duplicate = count > 1;
545 /* Low level routine to set a breakpoint.
546 Takes as args the three things that every breakpoint must have.
547 Returns the breakpoint object so caller can set other things.
548 Does not set the breakpoint number!
549 Does not print anything. */
551 static struct breakpoint *
552 set_raw_breakpoint (sal)
553 struct symtab_and_line sal;
555 register struct breakpoint *b, *b1;
557 b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
558 bzero (b, sizeof *b);
560 b->symtab = sal.symtab;
561 b->line_number = sal.line;
566 /* Add this breakpoint to the end of the chain
567 so that a list of breakpoints will come out in order
568 of increasing numbers. */
570 b1 = breakpoint_chain;
572 breakpoint_chain = b;
580 check_duplicates (sal.pc);
585 /* Set a breakpoint that will evaporate an end of command
586 at address specified by SAL.
587 Restrict it to frame FRAME if FRAME is nonzero. */
590 set_momentary_breakpoint (sal, frame)
591 struct symtab_and_line sal;
594 register struct breakpoint *b;
595 b = set_raw_breakpoint (sal);
598 b->frame = (frame ? FRAME_FP (frame) : 0);
602 clear_momentary_breakpoints ()
604 register struct breakpoint *b;
608 delete_breakpoint (b);
613 /* Set a breakpoint from a symtab and line.
614 If TEMPFLAG is nonzero, it is a temporary breakpoint.
615 Print the same confirmation messages that the breakpoint command prints. */
618 set_breakpoint (s, line, tempflag)
623 register struct breakpoint *b;
624 struct symtab_and_line sal;
628 sal.pc = find_line_pc (sal.symtab, sal.line);
630 error ("No line %d in file \"%s\".\n", sal.line, sal.symtab->filename);
633 describe_other_breakpoints (sal.pc);
635 b = set_raw_breakpoint (sal);
636 b->number = ++breakpoint_count;
639 b->enable = temporary;
641 printf ("Breakpoint %d at 0x%x", b->number, b->address);
643 printf (": file %s, line %d.", b->symtab->filename, b->line_number);
648 /* Set a breakpoint according to ARG (function, linenum or *address)
649 and make it temporary if TEMPFLAG is nonzero. */
652 break_command_1 (arg, tempflag, from_tty)
654 int tempflag, from_tty;
656 struct symtabs_and_lines sals;
657 struct symtab_and_line sal;
658 register struct expression *cond = 0;
659 register struct breakpoint *b;
667 sal.line = sal.pc = sal.end = 0;
670 /* If no arg given, or if first arg is 'if ', use the default breakpoint. */
672 if (!arg || (arg[0] == 'i' && arg[1] == 'f'
673 && (arg[2] == ' ' || arg[2] == '\t')))
675 if (default_breakpoint_valid)
677 sals.sals = (struct symtab_and_line *)
678 malloc (sizeof (struct symtab_and_line));
679 sal.pc = default_breakpoint_address;
680 sal.line = default_breakpoint_line;
681 sal.symtab = default_breakpoint_symtab;
686 error ("No default breakpoint address now.");
689 if (default_breakpoint_valid)
690 sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
691 default_breakpoint_line);
693 sals = decode_line_1 (&arg, 1, 0, 0);
699 for (i = 0; i < sals.nelts; i++)
702 if (sal.pc == 0 && sal.symtab != 0)
704 pc = find_line_pc (sal.symtab, sal.line);
706 error ("No line %d in file \"%s\".",
707 sal.line, sal.symtab->filename);
714 if (arg[0] == 'i' && arg[1] == 'f'
715 && (arg[2] == ' ' || arg[2] == '\t'))
716 cond = (struct expression *) parse_c_1 ((arg += 2, &arg),
717 block_for_pc (pc), 0);
719 error ("Junk at end of arguments.");
722 sals.sals[i].pc = pc;
725 for (i = 0; i < sals.nelts; i++)
730 describe_other_breakpoints (sal.pc);
732 b = set_raw_breakpoint (sal);
733 b->number = ++breakpoint_count;
736 b->enable = temporary;
738 printf ("Breakpoint %d at 0x%x", b->number, b->address);
740 printf (": file %s, line %d.", b->symtab->filename, b->line_number);
746 printf ("Multiple breakpoints were set.\n");
747 printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
753 break_command (arg, from_tty)
757 break_command_1 (arg, 0, from_tty);
761 tbreak_command (arg, from_tty)
765 break_command_1 (arg, 1, from_tty);
769 * Helper routine for the until_command routine in infcmd.c. Here
770 * because it uses the mechanisms of breakpoints.
773 until_break_command(arg, from_tty)
777 struct symtabs_and_lines sals;
778 struct symtab_and_line sal;
779 FRAME frame = get_current_frame ();
780 FRAME prev_frame = get_prev_frame (frame);
782 /* Set a breakpoint where the user wants it and at return from
785 if (default_breakpoint_valid)
786 sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
787 default_breakpoint_line);
789 sals = decode_line_1 (&arg, 1, 0, 0);
792 error ("Couldn't get information on specified line.");
795 free (sals.sals); /* malloc'd, so freed */
798 error ("Junk at end of arguments.");
800 if (sal.pc == 0 && sal.symtab != 0)
801 sal.pc = find_line_pc (sal.symtab, sal.line);
804 error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
806 set_momentary_breakpoint (sal, 0);
808 /* Keep within the current frame */
812 struct frame_info *fi;
814 fi = get_frame_info (prev_frame);
815 sal = find_pc_line (fi->pc, 0);
817 set_momentary_breakpoint (sal, prev_frame);
824 clear_command (arg, from_tty)
828 register struct breakpoint *b, *b1;
829 struct symtabs_and_lines sals;
830 struct symtab_and_line sal;
831 register struct breakpoint *found;
836 sals = decode_line_spec (arg, 1);
840 sals.sals = (struct symtab_and_line *) malloc (sizeof (struct symtab_and_line));
841 sal.line = default_breakpoint_line;
842 sal.symtab = default_breakpoint_symtab;
845 error ("No source file specified.");
851 for (i = 0; i < sals.nelts; i++)
853 /* If exact pc given, clear bpts at that pc.
854 But if sal.pc is zero, clear all bpts on specified line. */
856 found = (struct breakpoint *) 0;
857 while (breakpoint_chain
858 && (sal.pc ? breakpoint_chain->address == sal.pc
859 : (breakpoint_chain->symtab == sal.symtab
860 && breakpoint_chain->line_number == sal.line)))
862 b1 = breakpoint_chain;
863 breakpoint_chain = b1->next;
870 && (sal.pc ? b->next->address == sal.pc
871 : (b->next->symtab == sal.symtab
872 && b->next->line_number == sal.line)))
881 error ("No breakpoint at %s.", arg);
883 if (found->next) from_tty = 1; /* Always report if deleted more than one */
884 if (from_tty) printf ("Deleted breakpoint%s ", found->next ? "s" : "");
887 if (from_tty) printf ("%d ", found->number);
889 delete_breakpoint (found);
892 if (from_tty) putchar ('\n');
897 /* Delete breakpoint number BNUM if it is a `delete' breakpoint.
898 This is called after breakpoint BNUM has been hit.
899 Also delete any breakpoint numbered -3 unless there are breakpoint
900 commands to be executed. */
903 breakpoint_auto_delete (bnum)
906 register struct breakpoint *b;
909 if (b->number == bnum)
911 if (b->enable == delete)
912 delete_breakpoint (b);
915 if (breakpoint_commands == 0)
916 clear_momentary_breakpoints ();
920 delete_breakpoint (bpt)
921 struct breakpoint *bpt;
923 register struct breakpoint *b;
926 write_memory (bpt->address, bpt->shadow_contents, sizeof break_insn);
928 if (breakpoint_chain == bpt)
929 breakpoint_chain = bpt->next;
938 check_duplicates (bpt->address);
940 free_command_lines (&bpt->commands);
946 static void map_breakpoint_numbers ();
949 delete_command (arg, from_tty)
953 register struct breakpoint *b, *b1;
957 if (!from_tty || query ("Delete all breakpoints? "))
959 /* No arg; clear all breakpoints. */
960 while (breakpoint_chain)
961 delete_breakpoint (breakpoint_chain);
965 map_breakpoint_numbers (arg, delete_breakpoint);
968 /* Delete all breakpoints.
969 Done when new symtabs are loaded, since the break condition expressions
970 may become invalid, and the breakpoints are probably wrong anyway. */
975 delete_command (0, 0);
978 /* Set ignore-count of breakpoint number BPTNUM to COUNT.
979 If from_tty is nonzero, it prints a message to that effect,
980 which ends with a period (no newline). */
983 set_ignore_count (bptnum, count, from_tty)
984 int bptnum, count, from_tty;
986 register struct breakpoint *b;
992 if (b->number == bptnum)
994 b->ignore_count = count;
998 printf ("Will stop next time breakpoint %d is reached.", bptnum);
1000 printf ("Will ignore next crossing of breakpoint %d.", bptnum);
1002 printf ("Will ignore next %d crossings of breakpoint %d.",
1007 error ("No breakpoint number %d.", bptnum);
1010 /* Command to set ignore-count of breakpoint N to COUNT. */
1013 ignore_command (args, from_tty)
1017 register char *p = args;
1021 error_no_arg ("a breakpoint number");
1023 while (*p >= '0' && *p <= '9') p++;
1024 if (*p && *p != ' ' && *p != '\t')
1025 error ("First argument must be a breakpoint number.");
1030 error ("Second argument (specified ignore-count) is missing.");
1032 set_ignore_count (num, parse_and_eval_address (p), from_tty);
1036 /* Call FUNCTION on each of the breakpoints
1037 whose numbers are given in ARGS. */
1040 map_breakpoint_numbers (args, function)
1042 void (*function) ();
1044 register char *p = args;
1047 register struct breakpoint *b;
1050 error_no_arg ("one or more breakpoint numbers");
1055 while (*p1 >= '0' && *p1 <= '9') p1++;
1056 if (*p1 && *p1 != ' ' && *p1 != '\t')
1057 error ("Arguments must be breakpoint numbers.");
1062 if (b->number == num)
1067 printf ("No breakpoint number %d.\n", num);
1070 while (*p == ' ' || *p == '\t') p++;
1075 enable_breakpoint (bpt)
1076 struct breakpoint *bpt;
1078 bpt->enable = enabled;
1080 check_duplicates (bpt->address);
1084 enable_command (args)
1087 map_breakpoint_numbers (args, enable_breakpoint);
1091 disable_breakpoint (bpt)
1092 struct breakpoint *bpt;
1094 bpt->enable = disabled;
1096 check_duplicates (bpt->address);
1100 disable_command (args)
1103 register struct breakpoint *bpt;
1105 ALL_BREAKPOINTS (bpt)
1106 disable_breakpoint (bpt);
1108 map_breakpoint_numbers (args, disable_breakpoint);
1112 enable_once_breakpoint (bpt)
1113 struct breakpoint *bpt;
1115 bpt->enable = temporary;
1117 check_duplicates (bpt->address);
1121 enable_once_command (args)
1124 map_breakpoint_numbers (args, enable_once_breakpoint);
1128 enable_delete_breakpoint (bpt)
1129 struct breakpoint *bpt;
1131 bpt->enable = delete;
1133 check_duplicates (bpt->address);
1137 enable_delete_command (args)
1140 map_breakpoint_numbers (args, enable_delete_breakpoint);
1144 * Use default_breakpoint_'s, or nothing if they aren't valid.
1146 struct symtabs_and_lines
1147 decode_line_spec_1 (string, funfirstline)
1151 struct symtabs_and_lines sals;
1153 error ("Empty line specification.");
1154 if (default_breakpoint_valid)
1155 sals = decode_line_1 (&string, funfirstline,
1156 default_breakpoint_symtab, default_breakpoint_line);
1158 sals = decode_line_1 (&string, funfirstline, 0, 0);
1160 error ("Junk at end of line specification: %s", string);
1165 /* Chain containing all defined enable commands. */
1167 extern struct cmd_list_element
1168 *enablelist, *disablelist,
1169 *deletelist, *enablebreaklist;
1171 extern struct cmd_list_element *cmdlist;
1174 _initialize_breakpoint ()
1176 breakpoint_chain = 0;
1177 breakpoint_count = 0;
1179 add_com ("ignore", class_breakpoint, ignore_command,
1180 "Set ignore-count of breakpoint number N to COUNT.");
1182 add_com ("commands", class_breakpoint, commands_command,
1183 "Set commands to be executed when a breakpoint is hit.\n\
1184 Give breakpoint number as argument after \"commands\".\n\
1185 With no argument, the targeted breakpoint is the last one set.\n\
1186 The commands themselves follow starting on the next line.\n\
1187 Type a line containing \"end\" to indicate the end of them.\n\
1188 Give \"silent\" as the first line to make the breakpoint silent;\n\
1189 then no output is printed when it is hit, except what the commands print.");
1191 add_com ("condition", class_breakpoint, condition_command,
1192 "Specify breakpoint number N to break only if COND is true.\n\
1193 N is an integer; COND is a C expression to be evaluated whenever\n\
1194 breakpoint N is reached. Actually break only when COND is nonzero.");
1196 add_com ("tbreak", class_breakpoint, tbreak_command,
1197 "Set a temporary breakpoint. Args like \"break\" command.\n\
1198 Like \"break\" except the breakpoint is only enabled temporarily,\n\
1199 so it will be disabled when hit. Equivalent to \"break\" followed\n\
1200 by using \"enable once\" on the breakpoint number.");
1202 add_prefix_cmd ("enable", class_breakpoint, enable_command,
1203 "Enable some breakpoints or auto-display expressions.\n\
1204 Give breakpoint numbers (separated by spaces) as arguments.\n\
1205 With no subcommand, breakpoints are enabled until you command otherwise.\n\
1206 This is used to cancel the effect of the \"disable\" command.\n\
1207 With a subcommand you can enable temporarily.\n\
1209 The \"display\" subcommand applies to auto-displays instead of breakpoints.",
1210 &enablelist, "enable ", 1, &cmdlist);
1212 add_abbrev_prefix_cmd ("breakpoints", class_breakpoint, enable_command,
1213 "Enable some breakpoints or auto-display expressions.\n\
1214 Give breakpoint numbers (separated by spaces) as arguments.\n\
1215 With no subcommand, breakpoints are enabled until you command otherwise.\n\
1216 This is used to cancel the effect of the \"disable\" command.\n\
1217 May be abbreviates to simply \"enable\".\n\
1218 With a subcommand you can enable temporarily.",
1219 &enablebreaklist, "enable breakpoints ", 1, &enablelist);
1221 add_cmd ("once", no_class, enable_once_command,
1222 "Enable breakpoints for one hit. Give breakpoint numbers.\n\
1223 If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
1224 See the \"tbreak\" command which sets a breakpoint and enables it once.",
1227 add_cmd ("delete", no_class, enable_delete_command,
1228 "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
1229 If a breakpoint is hit while enabled in this fashion, it is deleted.",
1232 add_cmd ("delete", no_class, enable_delete_command,
1233 "Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
1234 If a breakpoint is hit while enabled in this fashion, it is deleted.",
1237 add_cmd ("once", no_class, enable_once_command,
1238 "Enable breakpoints for one hit. Give breakpoint numbers.\n\
1239 If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
1240 See the \"tbreak\" command which sets a breakpoint and enables it once.",
1243 add_prefix_cmd ("disable", class_breakpoint, disable_command,
1244 "Disable some breakpoints or auto-display expressions.\n\
1245 Arguments are breakpoint numbers with spaces in between.\n\
1246 To disable all breakpoints, give no argument.\n\
1247 A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
1249 The \"display\" subcommand applies to auto-displays instead of breakpoints.",
1250 &disablelist, "disable ", 1, &cmdlist);
1251 add_com_alias ("dis", "disable", class_breakpoint, 1);
1253 add_abbrev_cmd ("breakpoints", class_breakpoint, disable_command,
1254 "Disable some breakpoints or auto-display expressions.\n\
1255 Arguments are breakpoint numbers with spaces in between.\n\
1256 To disable all breakpoints, give no argument.\n\
1257 A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
1258 This command may be abbreviated \"disable\".",
1261 add_prefix_cmd ("delete", class_breakpoint, delete_command,
1262 "Delete some breakpoints or auto-display expressions.\n\
1263 Arguments are breakpoint numbers with spaces in between.\n\
1264 To delete all breakpoints, give no argument.\n\
1266 The \"display\" subcommand applies to auto-displays instead of breakpoints.",
1267 &deletelist, "delete ", 1, &cmdlist);
1268 add_com_alias ("d", "delete", class_breakpoint, 1);
1269 add_com_alias ("unset", "delete", class_breakpoint, 1);
1271 add_abbrev_cmd ("breakpoints", class_breakpoint, delete_command,
1272 "Delete some breakpoints or auto-display expressions.\n\
1273 Arguments are breakpoint numbers with spaces in between.\n\
1274 To delete all breakpoints, give no argument.\n\
1275 This command may be abbreviated \"delete\".",
1278 add_com ("clear", class_breakpoint, clear_command,
1279 "Clear breakpoint at specified line or function.\n\
1280 Argument may be line number, function name, or \"*\" and an address.\n\
1281 If line number is specified, all breakpoints in that line are cleared.\n\
1282 If function is specified, breakpoints at beginning of function are cleared.\n\
1283 If an address is specified, breakpoints at that address are cleared.\n\n\
1284 With no argument, clears all breakpoints in the line that the selected frame\n\
1287 See also the \"delete\" command which clears breakpoints by number.");
1289 add_com ("break", class_breakpoint, break_command,
1290 "Set breakpoint at specified line or function.\n\
1291 Argument may be line number, function name, or \"*\" and an address.\n\
1292 If line number is specified, break at start of code for that line.\n\
1293 If function is specified, break at start of code for that function.\n\
1294 If an address is specified, break at that exact address.\n\
1295 With no arg, uses current execution address of selected stack frame.\n\
1296 This is useful for breaking on return to a stack frame.\n\
1298 Multiple breakpoints at one place are permitted, and useful if conditional.\n\
1300 Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
1301 add_com_alias ("b", "break", class_run, 1);
1302 add_com_alias ("br", "break", class_run, 1);
1303 add_com_alias ("bre", "break", class_run, 1);
1304 add_com_alias ("brea", "break", class_run, 1);
1306 add_info ("breakpoints", breakpoints_info,
1307 "Status of all breakpoints, or breakpoint number NUMBER.\n\
1308 Second column is \"y\" for enabled breakpoint, \"n\" for disabled,\n\
1309 \"o\" for enabled once (disable when hit), \"d\" for enable but delete when hit.\n\
1310 Then come the address and the file/line number.\n\n\
1311 Convenience variable \"$_\" and default examine address for \"x\"\n\
1312 are set to the address of the last breakpoint listed.");