static void python_command (char *arg, int from_tty) { struct cleanup *cleanup; cleanup = ensure_python_env (get_current_arch (), current_language); make_cleanup_restore_integer (&interpreter_async); interpreter_async = 0; while (arg && *arg && isspace (*arg)) ++arg; if (arg && *arg) { if (PyRun_SimpleString (arg)) error (_("Error while executing Python code.")); } else { struct command_line *l = get_command_line (python_control, ""); make_cleanup_free_command_lines (&l); execute_control_command_untraced (l); } do_cleanups (cleanup); }
static void guile_command (char *arg, int from_tty) { struct cleanup *cleanup; cleanup = make_cleanup_restore_integer (&interpreter_async); interpreter_async = 0; arg = skip_spaces (arg); if (arg && *arg) { char *msg = gdbscm_safe_eval_string (arg, 1); if (msg != NULL) { make_cleanup (xfree, msg); error ("%s", msg); } } else { struct command_line *l = get_command_line (guile_control, ""); make_cleanup_free_command_lines (&l); execute_control_command_untraced (l); } do_cleanups (cleanup); }
static void guile_command (char *arg, int from_tty) { arg = skip_spaces (arg); if (arg && *arg) error (_("Guile scripting is not supported in this copy of GDB.")); else { /* Even if Guile isn't enabled, we still have to slurp the command list to the corresponding "end". */ struct command_line *l = get_command_line (guile_control, ""); struct cleanup *cleanups = make_cleanup_free_command_lines (&l); execute_control_command_untraced (l); do_cleanups (cleanups); } }
struct command_line * get_command_line (enum command_control_type type, char *arg) { struct command_line *cmd; struct cleanup *old_chain = NULL; /* Allocate and build a new command line structure. */ cmd = build_command_line (type, arg); old_chain = make_cleanup_free_command_lines (&cmd); /* Read in the body of this command. */ if (recurse_read_control_structure (read_next_line, cmd, 0, 0) == invalid_control) { warning (_("Error reading in canned sequence of commands.")); do_cleanups (old_chain); return NULL; } discard_cleanups (old_chain); return cmd; }