/* NOTE: 1999-04-30 This is the asynchronous version of the command_loop function. The command_loop function will be obsolete when we switch to use the event loop at every execution of gdb. */ static void command_handler (char *command) { int stdin_is_tty = ISATTY (stdin); struct cleanup *stat_chain; clear_quit_flag (); if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); /* If readline returned a NULL command, it means that the connection with the terminal is gone. This happens at the end of a testsuite run, after Expect has hung up but GDB is still alive. In such a case, we just quit gdb killing the inferior program too. */ if (command == 0) { printf_unfiltered ("quit\n"); execute_command ("quit", stdin == instream); } stat_chain = make_command_stats_cleanup (1); execute_command (command, instream == stdin); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (); do_cleanups (stat_chain); }
void command_handler (char *command) { struct cleanup *stat_chain; char *c; clear_quit_flag (); if (instream == stdin) reinitialize_more_filter (); stat_chain = make_command_stats_cleanup (1); /* Do not execute commented lines. */ for (c = command; *c == ' ' || *c == '\t'; c++) ; if (c[0] != '#') { execute_command (command, instream == stdin); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (); } do_cleanups (stat_chain); }
/* TUI readline command. Execute the gdb command bound to the specified key. */ static int tui_rl_command_key (int count, int key) { int i; reinitialize_more_filter (); for (i = 0; tui_commands[i].cmd; i++) { if (tui_commands[i].key == key) { /* Must save the command because it can be modified by execute_command. */ char* cmd = alloca (strlen (tui_commands[i].cmd) + 1); strcpy (cmd, tui_commands[i].cmd); execute_command (cmd, TRUE); return 0; } } return 0; }
void command_handler (const char *command) { struct ui *ui = current_ui; const char *c; if (ui->instream == ui->stdin_stream) reinitialize_more_filter (); scoped_command_stats stat_reporter (true); /* Do not execute commented lines. */ for (c = command; *c == ' ' || *c == '\t'; c++) ; if (c[0] != '#') { execute_command (command, ui->instream == ui->stdin_stream); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (); } }
/* NOTE: 1999-04-30 This is the asynchronous version of the command_loop function. The command_loop function will be obsolete when we switch to use the event loop at every execution of gdb. */ static void command_handler (char *command) { struct cleanup *old_chain; int stdin_is_tty = ISATTY (stdin); struct continuation_arg *arg1; struct continuation_arg *arg2; long time_at_cmd_start; #ifdef HAVE_SBRK long space_at_cmd_start = 0; #endif extern int display_time; extern int display_space; quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); old_chain = make_cleanup (null_cleanup, 0); /* If readline returned a NULL command, it means that the connection with the terminal is gone. This happens at the end of a testsuite run, after Expect has hung up but GDB is still alive. In such a case, we just quit gdb killing the inferior program too. */ if (command == 0) quit_command ((char *) 0, stdin == instream); time_at_cmd_start = get_run_time (); if (display_space) { #ifdef HAVE_SBRK char *lim = (char *) sbrk (0); space_at_cmd_start = lim - lim_at_start; #endif } execute_command (command, instream == stdin); /* Set things up for this function to be compete later, once the execution has completed, if we are doing an execution command, otherwise, just go ahead and finish. */ if (target_can_async_p () && target_executing) { arg1 = (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg)); arg2 = (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg)); arg1->next = arg2; arg2->next = NULL; arg1->data.longint = time_at_cmd_start; #ifdef HAVE_SBRK arg2->data.longint = space_at_cmd_start; #endif add_continuation (command_line_handler_continuation, arg1); } /* Do any commands attached to breakpoint we stopped at. Only if we are always running synchronously. Or if we have just executed a command that doesn't start the target. */ if (!target_can_async_p () || !target_executing) { bpstat_do_actions (&stop_bpstat); do_cleanups (old_chain); if (display_time) { long cmd_time = get_run_time () - time_at_cmd_start; printf_unfiltered (_("Command execution time: %ld.%06ld\n"), cmd_time / 1000000, cmd_time % 1000000); } if (display_space) { #ifdef HAVE_SBRK char *lim = (char *) sbrk (0); long space_now = lim - lim_at_start; long space_diff = space_now - space_at_cmd_start; printf_unfiltered (_("Space used: %ld (%c%ld for this command)\n"), space_now, (space_diff >= 0 ? '+' : '-'), space_diff); #endif } } }
/* NOTE: 1999-04-30 This is the asynchronous version of the command_loop function. The command_loop function will be obsolete when we switch to use the event loop at every execution of gdb. */ static void command_handler (char *command) { int stdin_is_tty = ISATTY (stdin); long time_at_cmd_start; #ifdef HAVE_SBRK long space_at_cmd_start = 0; #endif extern int display_time; extern int display_space; quit_flag = 0; if (instream == stdin && stdin_is_tty) reinitialize_more_filter (); /* If readline returned a NULL command, it means that the connection with the terminal is gone. This happens at the end of a testsuite run, after Expect has hung up but GDB is still alive. In such a case, we just quit gdb killing the inferior program too. */ if (command == 0) { printf_unfiltered ("quit\n"); execute_command ("quit", stdin == instream); } time_at_cmd_start = get_run_time (); if (display_space) { #ifdef HAVE_SBRK char *lim = (char *) sbrk (0); space_at_cmd_start = lim - lim_at_start; #endif } execute_command (command, instream == stdin); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (); if (display_time) { long cmd_time = get_run_time () - time_at_cmd_start; printf_unfiltered (_("Command execution time: %ld.%06ld\n"), cmd_time / 1000000, cmd_time % 1000000); } if (display_space) { #ifdef HAVE_SBRK char *lim = (char *) sbrk (0); long space_now = lim - lim_at_start; long space_diff = space_now - space_at_cmd_start; printf_unfiltered (_("Space used: %ld (%c%ld for this command)\n"), space_now, (space_diff >= 0 ? '+' : '-'), space_diff); #endif } }