aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-interp.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-04-04 21:59:25 +0000
committerPedro Alves <palves@redhat.com>2008-04-04 21:59:25 +0000
commita13e061a1bfc6ba791d0bf1691e28785c81dea70 (patch)
treeddf2df93d80938bbd6afcdf47e3a307a1792915c /gdb/mi/mi-interp.c
parent4536995d8b201aa1f9846f0c7c7be7df6dbcf4bf (diff)
downloadgdb-a13e061a1bfc6ba791d0bf1691e28785c81dea70.zip
gdb-a13e061a1bfc6ba791d0bf1691e28785c81dea70.tar.gz
gdb-a13e061a1bfc6ba791d0bf1691e28785c81dea70.tar.bz2
gdb/
2008-04-04 Pedro Alves <pedro@codesourcery.com> * mi/mi-cmds.h (enum mi_cmd_result): Delete MI_CMD_ERROR. (mi_error_message): Delete declaration. * mi/mi-interp.c (mi_cmd_interpreter_exec): Call error instead of returning MI_CMD_ERROR. * mi/mi-main.c (mi_error_message): Delete. (mi_cmd_exec_interrupt): (mi_cmd_thread_select, mi_cmd_thread_list_ids) (mi_cmd_thread_info): Call error instead of returning MI_CMD_ERROR. (mi_cmd_data_list_register_values): Call error instead of returning MI_CMD_ERROR. Adapt to new get_register interface. (get_register): Change return typo to void. Call error instead of returning MI_CMD_ERROR. (mi_cmd_data_write_register_values): Call error instead of returning MI_CMD_ERROR. (mi_cmd_list_features): Return MI_CMD_DONE. (captured_mi_execute_command): Remove MI_CMD_ERROR handling. (mi_execute_command): Always print exceptions with -error. gdb/testsuite/ 2008-04-04 Pedro Alves <pedro@codesourcery.com> * gdb.mi/mi-disassemble.exp, gdb.mi/mi-stack.exp, gdb.mi/mi-syn-frame.exp, gdb.mi/mi-var-block.exp, gdb.mi/mi-var-cmd.exp, gdb.mi/mi-var-display.exp, gdb.mi/mi2-disassemble.exp, gdb.mi/mi2-stack.exp, gdb.mi/mi2-syn-frame.exp, gdb.mi/mi2-var-block.exp, gdb.mi/mi2-var-cmd.exp, gdb.mi/mi2-var-display.exp: Update to not expect an mi error duplicated in stderr.
Diffstat (limited to 'gdb/mi/mi-interp.c')
-rw-r--r--gdb/mi/mi-interp.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 05a64d8..c968a8f 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -190,29 +190,21 @@ enum mi_cmd_result
mi_cmd_interpreter_exec (char *command, char **argv, int argc)
{
struct interp *interp_to_use;
- enum mi_cmd_result result = MI_CMD_DONE;
int i;
struct interp_procs *procs;
+ char *mi_error_message = NULL;
+ struct cleanup *old_chain;
if (argc < 2)
- {
- mi_error_message = xstrprintf ("mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command");
interp_to_use = interp_lookup (argv[0]);
if (interp_to_use == NULL)
- {
- mi_error_message = xstrprintf ("mi_cmd_interpreter_exec: could not find interpreter \"%s\"", argv[0]);
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_interpreter_exec: could not find interpreter \"%s\"", argv[0]);
if (!interp_exec_p (interp_to_use))
- {
- mi_error_message = xstrprintf ("mi_cmd_interpreter_exec: interpreter \"%s\" does not support command execution",
- argv[0]);
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_interpreter_exec: interpreter \"%s\" does not support command execution",
+ argv[0]);
/* Insert the MI out hooks, making sure to also call the interpreter's hooks
if it has any. */
@@ -222,13 +214,14 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
/* Now run the code... */
+ old_chain = make_cleanup (null_cleanup, 0);
for (i = 1; i < argc; i++)
{
struct gdb_exception e = interp_exec (interp_to_use, argv[i]);
if (e.reason < 0)
{
mi_error_message = xstrdup (e.message);
- result = MI_CMD_ERROR;
+ make_cleanup (xfree, mi_error_message);
break;
}
}
@@ -246,7 +239,10 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
add_continuation (mi_interpreter_exec_continuation, NULL);
}
- return result;
+ if (mi_error_message != NULL)
+ error ("%s", mi_error_message);
+ do_cleanups (old_chain);
+ return MI_CMD_DONE;
}
/*