return b;
}
-#if 0
-void
-clear_momentary_breakpoints ()
-{
- register struct breakpoint *b, *temp;
- ALL_BREAKPOINTS_SAFE (b, temp)
- if (b->disposition == delete)
- {
- delete_breakpoint (b);
- break;
- }
-}
-#endif
\f
/* Tell the user we have just set a breakpoint B. */
printf_filtered ("\n");
}
-#if 0
-/* Nobody calls this currently. */
-/* Set a breakpoint from a symtab and line.
- If TEMPFLAG is nonzero, it is a temporary breakpoint.
- ADDR_STRING is a malloc'd string holding the name of where we are
- setting the breakpoint. This is used later to re-set it after the
- program is relinked and symbols are reloaded.
- Print the same confirmation messages that the breakpoint command prints. */
-
-void
-set_breakpoint (s, line, tempflag, addr_string)
- struct symtab *s;
- int line;
- int tempflag;
- char *addr_string;
-{
- register struct breakpoint *b;
- struct symtab_and_line sal;
-
- sal.symtab = s;
- sal.line = line;
- sal.pc = 0;
- resolve_sal_pc (&sal); /* Might error out */
- describe_other_breakpoints (sal.pc);
-
- b = set_raw_breakpoint (sal);
- set_breakpoint_count (breakpoint_count + 1);
- b->number = breakpoint_count;
- b->type = bp_breakpoint;
- b->cond = 0;
- b->addr_string = addr_string;
- b->enable = enabled;
- b->disposition = tempflag ? delete : donttouch;
-
- mention (b);
-}
-#endif /* 0 */
\f
/* Set a breakpoint according to ARG (function, linenum or *address)
flag: first bit : 0 non-temporary, 1 temporary.
}
}
-void
-enable_breakpoint (bpt)
- struct breakpoint *bpt;
-{
- struct frame_info *save_selected_frame = NULL;
- int save_selected_frame_level = -1;
- int target_resources_ok, other_type_used;
- struct value *mark;
-
- if (bpt->type == bp_hardware_breakpoint)
- {
- int i;
- i = hw_breakpoint_used_count();
- target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
- bp_hardware_breakpoint, i+1, 0);
- if (target_resources_ok == 0)
- error ("No hardware breakpoint support in the target.");
- else if (target_resources_ok < 0)
- error ("Hardware breakpoints used exceeds limit.");
- }
- bpt->enable = enabled;
- check_duplicates (bpt->address);
-
- if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint ||
- bpt->type == bp_read_watchpoint || bpt->type == bp_access_watchpoint)
- {
- if (bpt->exp_valid_block != NULL)
- {
- struct frame_info *fr =
- find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
- if (fr == NULL)
- {
- printf_filtered ("\
-Cannot enable watchpoint %d because the block in which its expression\n\
-is valid is not currently in scope.\n", bpt->number);
- bpt->enable = disabled;
- return;
- }
-
- save_selected_frame = selected_frame;
- save_selected_frame_level = selected_frame_level;
- select_frame (fr, -1);
- }
-
- value_free (bpt->val);
- mark = value_mark ();
- bpt->val = evaluate_expression (bpt->exp);
- release_value (bpt->val);
- if (VALUE_LAZY (bpt->val))
- value_fetch_lazy (bpt->val);
-
- if (bpt->type == bp_hardware_watchpoint ||
- bpt->type == bp_read_watchpoint ||
- bpt->type == bp_access_watchpoint)
- {
- int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
- int mem_cnt = can_use_hardware_watchpoint (bpt->val);
-
- target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
- bpt->type, i + mem_cnt, other_type_used);
- /* we can consider of type is bp_hardware_watchpoint, convert to
- bp_watchpoint in the following condition */
- if (target_resources_ok < 0)
- {
- printf_filtered("\
-Cannot enable watchpoint %d because target watch resources\n\
-have been allocated for other watchpoints.\n", bpt->number);
- bpt->enable = disabled;
- value_free_to_mark (mark);
- return;
- }
- }
-
- if (save_selected_frame_level >= 0)
- select_frame (save_selected_frame, save_selected_frame_level);
- value_free_to_mark (mark);
- }
-
- if (modify_breakpoint_hook)
- modify_breakpoint_hook (bpt);
-}
-
-/* ARGSUSED */
-static void
-enable_command (args, from_tty)
- char *args;
- int from_tty;
-{
- struct breakpoint *bpt;
- if (args == 0)
- ALL_BREAKPOINTS (bpt)
- switch (bpt->type)
- {
- case bp_breakpoint:
- case bp_hardware_breakpoint:
- case bp_watchpoint:
- case bp_hardware_watchpoint:
- case bp_read_watchpoint:
- case bp_access_watchpoint:
- enable_breakpoint (bpt);
- default:
- continue;
- }
- else
- map_breakpoint_numbers (args, enable_breakpoint);
-}
-
void
disable_breakpoint (bpt)
struct breakpoint *bpt;
}
static void
-enable_once_breakpoint (bpt)
+do_enable_breakpoint (bpt, disposition)
struct breakpoint *bpt;
+ enum bpdisp disposition;
{
struct frame_info *save_selected_frame = NULL;
int save_selected_frame_level = -1;
int target_resources_ok, other_type_used;
struct value *mark;
- if (bpt->type == bp_hardware_breakpoint)
- {
+ if (bpt->type == bp_hardware_breakpoint)
+ {
int i;
i = hw_breakpoint_used_count();
target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
}
bpt->enable = enabled;
- bpt->disposition = disable;
+ bpt->disposition = disposition;
check_duplicates (bpt->address);
breakpoints_changed ();
bpt->type == bp_access_watchpoint)
{
int i = hw_watchpoint_used_count (bpt->type, &other_type_used);
- int mem_cnt = can_use_hardware_watchpoint(bpt->val);
+ int mem_cnt = can_use_hardware_watchpoint (bpt->val);
+
target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT(
- bpt->type, i+mem_cnt, other_type_used);
+ bpt->type, i + mem_cnt, other_type_used);
/* we can consider of type is bp_hardware_watchpoint, convert to
bp_watchpoint in the following condition */
if (target_resources_ok < 0)
printf_filtered("\
Cannot enable watchpoint %d because target watch resources\n\
have been allocated for other watchpoints.\n", bpt->number);
- bpt->enable = disabled;
- value_free_to_mark (mark);
+ bpt->enable = disabled;
+ value_free_to_mark (mark);
+ return;
}
}
select_frame (save_selected_frame, save_selected_frame_level);
value_free_to_mark (mark);
}
+ if (modify_breakpoint_hook)
+ modify_breakpoint_hook (bpt);
+}
+
+void
+enable_breakpoint (bpt)
+ struct breakpoint *bpt;
+{
+ do_enable_breakpoint (bpt, donttouch);
+}
+
+/* The enable command enables the specified breakpoints (or all defined
+ breakpoints) so they once again become (or continue to be) effective
+ in stopping the inferior. */
+
+/* ARGSUSED */
+static void
+enable_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ register struct breakpoint *bpt;
+ if (args == 0)
+ ALL_BREAKPOINTS (bpt)
+ switch (bpt->type)
+ {
+ case bp_breakpoint:
+ case bp_hardware_breakpoint:
+ case bp_watchpoint:
+ case bp_hardware_watchpoint:
+ case bp_read_watchpoint:
+ case bp_access_watchpoint:
+ enable_breakpoint (bpt);
+ default:
+ continue;
+ }
+ else
+ map_breakpoint_numbers (args, enable_breakpoint);
+}
+
+static void
+enable_once_breakpoint (bpt)
+ struct breakpoint *bpt;
+{
+ do_enable_breakpoint (bpt, disable);
}
/* ARGSUSED */
enable_delete_breakpoint (bpt)
struct breakpoint *bpt;
{
- bpt->enable = enabled;
- bpt->disposition = del;
-
- check_duplicates (bpt->address);
- breakpoints_changed ();
+ do_enable_breakpoint (bpt, del);
}
/* ARGSUSED */