diff options
author | Fred Fish <fnf@specifix.com> | 1996-05-08 23:34:34 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1996-05-08 23:34:34 +0000 |
commit | 3f37b6961216048f92b5fa82d8f33d395e27c05b (patch) | |
tree | 150668eaa46d574171ec49d8ccc57fd047924e61 /gdb/breakpoint.c | |
parent | db1e2aa7e44fea30f7a7c8c0308fedb5c763790b (diff) | |
download | gdb-3f37b6961216048f92b5fa82d8f33d395e27c05b.zip gdb-3f37b6961216048f92b5fa82d8f33d395e27c05b.tar.gz gdb-3f37b6961216048f92b5fa82d8f33d395e27c05b.tar.bz2 |
* breakpoint.c (clear_momentary_breakpoints): Remove dead code
that is referenced nowhere else.
(set_breakpoint): Ditto.
(do_enable_breakpoint): Created from enable_once_breakpoint
with a couple of changes.
(enable_breakpoint): Call do_enable_breakpoint with an appropriate
bpdisp enum value to set disposition of breakpoint.
(enable_once_breakpoint): Ditto.
(enable_delete_breakpoint): Ditto.
* breakpoint.h (clear_momentary_breakpoints): Remove prototype.
* symtab.c (find_pc_line): Improve comments.
* gdbtk.c: Fix a couple of misspellings.
* xcoffread.c: Ditto.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 227 |
1 files changed, 57 insertions, 170 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f01e685..d9960ed 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2209,19 +2209,6 @@ set_momentary_breakpoint (sal, frame, type) 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 /* Tell the user we have just set a breakpoint B. */ @@ -2290,43 +2277,6 @@ mention (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 */ /* Set a breakpoint according to ARG (function, linenum or *address) flag: first bit : 0 non-temporary, 1 temporary. @@ -3674,113 +3624,6 @@ map_breakpoint_numbers (args, function) } 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; { @@ -3824,16 +3667,17 @@ disable_command (args, from_tty) } 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( @@ -3845,7 +3689,7 @@ enable_once_breakpoint (bpt) } bpt->enable = enabled; - bpt->disposition = disable; + bpt->disposition = disposition; check_duplicates (bpt->address); breakpoints_changed (); @@ -3882,9 +3726,10 @@ is valid is not currently in scope.\n", bpt->number); 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) @@ -3892,8 +3737,9 @@ is valid is not currently in scope.\n", bpt->number); 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; } } @@ -3901,6 +3747,51 @@ have been allocated for other watchpoints.\n", bpt->number); 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 */ @@ -3916,11 +3807,7 @@ static void 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 */ |