- else if (ep_is_exception_catchpoint (bpt->owner))
- {
- /* FIXME drow/2003-09-09: This code sets both a catchpoint and a
- breakpoint. Once again, it would be better if this was represented
- as two bp_locations. */
-
- /* If we get here, we must have a callback mechanism for exception
- events -- with g++ style embedded label support, we insert
- ordinary breakpoints and not catchpoints. */
- val = target_insert_breakpoint (&bpt->target_info);
- if (val)
- {
- /* Couldn't set breakpoint for some reason */
- fprintf_unfiltered (tmp_error_stream,
- "Cannot insert catchpoint %d; disabling it.\n",
- bpt->owner->number);
- fprintf_filtered (tmp_error_stream,
- "Error accessing memory address ");
- deprecated_print_address_numeric (bpt->address, 1, tmp_error_stream);
- fprintf_filtered (tmp_error_stream, ": %s.\n",
- safe_strerror (val));
- bpt->owner->enable_state = bp_disabled;
- }
- else
- {
- /* Bp set, now make sure callbacks are enabled */
- /* Format possible error msg */
- char *message = xstrprintf ("Error inserting catchpoint %d:\n",
- bpt->owner->number);
- struct cleanup *cleanups = make_cleanup (xfree, message);
- int val;
- args_for_catchpoint_enable args;
- args.kind = bpt->owner->type == bp_catch_catch ?
- EX_EVENT_CATCH : EX_EVENT_THROW;
- args.enable_p = 1;
- val = catch_errors (cover_target_enable_exception_callback,
- &args, message, RETURN_MASK_ALL);
- do_cleanups (cleanups);
- if (val != 0 && val != -1)
- bpt->inserted = 1;
-
- /* Check if something went wrong; val == 0 can be ignored */
- if (val == -1)
- {
- /* something went wrong */
- fprintf_unfiltered (tmp_error_stream,
- "Cannot insert catchpoint %d; disabling it.\n",
- bpt->owner->number);
- bpt->owner->enable_state = bp_disabled;
- }
- }
-
- return val;
- }
-