/* MI Command Set.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
/* Work in progress */
{
gdb_byte raw_buffer[MAX_REGISTER_SIZE];
- if (! frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
+ if (! frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
return -1;
if (memcmp (&old_regs[DEPRECATED_REGISTER_BYTE (regnum)], raw_buffer,
format = (int) argv[0][0];
- if (!target_has_registers)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_list_register_values: No registers.");
- return MI_CMD_ERROR;
- }
-
list_cleanup = make_cleanup_ui_out_list_begin_end (uiout, "register-values");
if (argc == 1) /* No args, beside the format: do all the regs */
if (format == 'N')
format = 0;
- frame_register (deprecated_selected_frame, regnum, &optim, &lval, &addr,
+ frame_register (get_selected_frame (NULL), regnum, &optim, &lval, &addr,
&realnum, buffer);
if (optim)
long word_size;
char word_asize;
char aschar;
- char *mbuf;
+ gdb_byte *mbuf;
int nr_bytes;
long offset = 0;
int optind = 0;
/* Call the "console" interpreter. */
argv[0] = "console";
argv[1] = context->command;
- mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
+ args->rc = mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
- /* If we changed interpreters, DON'T print out anything. */
+ /* If we changed interpreters, DON'T print out anything. */
if (current_interp_named_p (INTERP_MI)
|| current_interp_named_p (INTERP_MI1)
|| current_interp_named_p (INTERP_MI2)
|| current_interp_named_p (INTERP_MI3))
{
- /* print the result */
- /* FIXME: Check for errors here. */
- fputs_unfiltered (context->token, raw_stdout);
- fputs_unfiltered ("^done", raw_stdout);
- mi_out_put (uiout, raw_stdout);
- mi_out_rewind (uiout);
- fputs_unfiltered ("\n", raw_stdout);
- args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
- args->rc = MI_CMD_DONE;
+ if (args->rc == MI_CMD_DONE)
+ {
+ fputs_unfiltered (context->token, raw_stdout);
+ fputs_unfiltered ("^done", raw_stdout);
+ mi_out_put (uiout, raw_stdout);
+ mi_out_rewind (uiout);
+ fputs_unfiltered ("\n", raw_stdout);
+ args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
+ }
+ else if (args->rc == MI_CMD_ERROR)
+ {
+ if (mi_error_message)
+ {
+ fputs_unfiltered (context->token, raw_stdout);
+ fputs_unfiltered ("^error,msg=\"", raw_stdout);
+ fputstr_unfiltered (mi_error_message, '"', raw_stdout);
+ xfree (mi_error_message);
+ fputs_unfiltered ("\"\n", raw_stdout);
+ }
+ mi_out_rewind (uiout);
+ }
+ else
+ mi_out_rewind (uiout);
}
break;
}
if (result.reason < 0)
{
/* The command execution failed and error() was called
- somewhere */
+ somewhere. */
fputs_unfiltered (command->token, raw_stdout);
fputs_unfiltered ("^error,msg=\"", raw_stdout);
fputstr_unfiltered (result.message, '"', raw_stdout);
fputs_unfiltered ("\"\n", raw_stdout);
+ mi_out_rewind (uiout);
}
mi_parse_free (command);
}
static struct timeval last_update;
static char *previous_sect_name = NULL;
int new_section;
+ struct ui_out *saved_uiout;
+
+ /* This function is called through deprecated_show_load_progress
+ which means uiout may not be correct. Fix it for the duration
+ of this function. */
+ saved_uiout = uiout;
- if (!current_interp_named_p (INTERP_MI)
- && !current_interp_named_p (INTERP_MI1))
+ if (current_interp_named_p (INTERP_MI))
+ uiout = mi_out_new (2);
+ else if (current_interp_named_p (INTERP_MI1))
+ uiout = mi_out_new (1);
+ else
return;
update_threshold.tv_sec = 0;
fputs_unfiltered ("\n", raw_stdout);
gdb_flush (raw_stdout);
}
+
+ xfree (uiout);
+ uiout = saved_uiout;
}
void