save_selected_frame = deprecated_selected_frame; save_selected_frame_level = frame_relative_level (deprecated_selected_frame);
do_enable_breakpoint (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)    {      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.");    }  if (bpt->pending)    {      if (bpt->enable_state != bp_enabled)	{	  /* When enabling a pending breakpoint, we need to check if the breakpoint	     is resolvable since shared libraries could have been loaded	     after the breakpoint was disabled.  */	  breakpoints_changed (); 	  if (resolve_pending_breakpoint (bpt) == GDB_RC_OK)	    {	      delete_breakpoint (bpt);	      return;	    }	  bpt->enable_state = bp_enabled;	  bpt->disposition = disposition;	}    }  else  /* Not a pending breakpoint.  */    {      if (bpt->enable_state != bp_permanent)	bpt->enable_state = bp_enabled;      bpt->disposition = disposition;      check_duplicates (bpt);      breakpoints_changed ();            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 =		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);		  bpt->enable_state = bp_disabled;		  return;		}	      	      save_selected_frame = deprecated_selected_frame;	      save_selected_frame_level = frame_relative_level (deprecated_selected_frame);	      select_frame (fr);	    }	  	  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);	      	      /* Hack around 'unused var' error for some targets here */	      (void) mem_cnt, 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);		  bpt->enable_state = bp_disabled;		  value_free_to_mark (mark);		  return;		}	    }	  	  if (save_selected_frame_level >= 0)	    select_frame (save_selected_frame);	  value_free_to_mark (mark);	}    }  if (modify_breakpoint_hook)    modify_breakpoint_hook (bpt);  breakpoint_modify_event (bpt->number);}