static int captured_command_loop (void *data) { struct ui *ui = current_ui; /* Top-level execution commands can be run in the background from here on. */ current_ui->async = 1; /* Give the interpreter a chance to print a prompt, if necessary */ if (ui->prompt_state != PROMPT_BLOCKED) interp_pre_command_loop (top_level_interpreter ()); /* Now it's time to start the event loop. */ start_event_loop (); /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton would clean things up (restoring the cleanup chain) to the state they were just prior to the call. Technically, this means that the do_cleanups() below is redundant. Unfortunately, many FUNCs are not that well behaved. do_cleanups should either be replaced with a do_cleanups call (to cover the problem) or an assertion check to detect bad FUNCs code. */ do_cleanups (all_cleanups ()); /* If the command_loop returned, normally (rather than threw an error) we try to quit. If the quit is aborted, catch_errors() which called this catch the signal and restart the command loop. */ quit_command (NULL, ui->instream == ui->stdin_stream); return 1; }
void throw_exception (struct gdb_exception exception) { prepare_to_throw_exception (); do_cleanups (all_cleanups ()); #if GDB_XCPT == GDB_XCPT_SJMP /* Jump to the containing catch_errors() call, communicating REASON to that call via setjmp's return value. Note that REASON can't be zero, by definition in defs.h. */ exceptions_state_mc (CATCH_THROWING); current_catcher->exception = exception; SIGLONGJMP (current_catcher->buf, exception.reason); #else if (exception.reason == RETURN_QUIT) { gdb_exception_RETURN_MASK_QUIT ex; gdb_exception_sliced_copy (&ex, &exception); throw ex; } else if (exception.reason == RETURN_ERROR) { gdb_exception_RETURN_MASK_ERROR ex; gdb_exception_sliced_copy (&ex, &exception); throw ex; } else gdb_assert_not_reached ("invalid return reason"); #endif }
/* * Used by gdb_interface() to catch gdb-related errors, if desired. */ void gdb_error_hook(void) { char buf1[BUFSIZE]; char buf2[BUFSIZE]; int buffers; if (CRASHDEBUG(2)) { sprintf(buf2, "\n"); if (CRASHDEBUG(5) && (buffers = get_embedded())) sprintf(buf2, "(%d buffer%s in use)\n", buffers, buffers > 1 ? "s" : ""); fprintf(stderr, "%s: returned via gdb_error_hook %s", gdb_command_string(pc->cur_gdb_cmd, buf1, TRUE), buf2); console("%s: returned via gdb_error_hook %s", gdb_command_string(pc->cur_gdb_cmd, buf1, TRUE), buf2); } #ifdef GDB_7_6 do_cleanups(all_cleanups()); #else do_cleanups(NULL); #endif longjmp(pc->gdb_interface_env, 1); }
void exception_rethrow (void) { /* Run this scope's cleanups before re-throwing to the next outermost scope. */ do_cleanups (all_cleanups ()); throw; }
void throw_exception_sjlj (struct gdb_exception exception) { do_cleanups (all_cleanups ()); /* Jump to the nearest CATCH_SJLJ block, communicating REASON to that call via setjmp's return value. Note that REASON can't be zero, by definition in common-exceptions.h. */ exceptions_state_mc (CATCH_THROWING); current_catcher->exception = exception; longjmp (current_catcher->buf, exception.reason); }
void throw_exception (struct gdb_exception exception) { clear_quit_flag (); immediate_quit = 0; do_cleanups (all_cleanups ()); /* Jump to the containing catch_errors() call, communicating REASON to that call via setjmp's return value. Note that REASON can't be zero, by definition in defs.h. */ exceptions_state_mc (CATCH_THROWING); *current_catcher->exception = exception; EXCEPTIONS_SIGLONGJMP (current_catcher->buf, exception.reason); }
static ATTRIBUTE_NORETURN void throw_exception_cxx (struct gdb_exception exception) { do_cleanups (all_cleanups ()); if (exception.reason == RETURN_QUIT) { gdb_exception_RETURN_MASK_QUIT ex; gdb_exception_sliced_copy (&ex, &exception); throw ex; } else if (exception.reason == RETURN_ERROR) { gdb_exception_RETURN_MASK_ERROR ex; gdb_exception_sliced_copy (&ex, &exception); throw ex; } else gdb_assert_not_reached ("invalid return reason"); }
static int captured_command_loop (void *data) { /* Top-level execution commands can be run in the background from here on. */ interpreter_async = 1; current_interp_command_loop (); /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton would clean things up (restoring the cleanup chain) to the state they were just prior to the call. Technically, this means that the do_cleanups() below is redundant. Unfortunately, many FUNCs are not that well behaved. do_cleanups should either be replaced with a do_cleanups call (to cover the problem) or an assertion check to detect bad FUNCs code. */ do_cleanups (all_cleanups ()); /* If the command_loop returned, normally (rather than threw an error) we try to quit. If the quit is aborted, catch_errors() which called this catch the signal and restart the command loop. */ quit_command (NULL, instream == stdin); return 1; }