From dde0281261f8a2b4e89ec28a3b602d52ba97e9fd Mon Sep 17 00:00:00 2001 From: Emi Suzuki Date: Thu, 8 Jan 2009 03:58:06 +0000 Subject: [PATCH] * breakpoint.c (do_enable_breakpoint): Use update_watchpoint for watchpoints. --- gdb/ChangeLog | 6 ++++++ gdb/breakpoint.c | 54 ++++++++---------------------------------------------- 2 files changed, 14 insertions(+), 46 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 77301e5..665ae66 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-01-08 Joel Brobecker + Emi Suzuki + + * breakpoint.c (do_enable_breakpoint): Use update_watchpoint for + watchpoints. + 2009-01-07 Doug Evans * top.c (gdb_prompt_string): Delete, unused. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 18d8010..41fefe1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7780,56 +7780,18 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition) bpt->type == bp_read_watchpoint || bpt->type == bp_access_watchpoint) { - struct frame_id saved_frame_id; - - saved_frame_id = get_frame_id (get_selected_frame (NULL)); - if (bpt->exp_valid_block != NULL) + struct gdb_exception e; + + TRY_CATCH (e, RETURN_MASK_ALL) { - struct frame_info *fr = - fr = frame_find_by_id (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); - return; - } - select_frame (fr); + update_watchpoint (bpt, 1 /* reparse */); } - - if (bpt->val) - value_free (bpt->val); - mark = value_mark (); - fetch_watchpoint_value (bpt->exp, &bpt->val, NULL, NULL); - if (bpt->val) - release_value (bpt->val); - bpt->val_valid = 1; - - if (bpt->type == bp_hardware_watchpoint || - bpt->type == bp_read_watchpoint || - bpt->type == bp_access_watchpoint) + if (e.reason < 0) { - int i = hw_watchpoint_used_count (bpt->type, &other_type_used); - int mem_cnt = can_use_hardware_watchpoint (bpt->val); - - /* Hack around 'unused var' error for some targets here */ - (void) mem_cnt, (void) i; - 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); - value_free_to_mark (mark); - return; - } + exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "), + bpt->number); + return; } - - select_frame (frame_find_by_id (saved_frame_id)); - value_free_to_mark (mark); } if (bpt->enable_state != bp_permanent) -- 2.7.4