cleanup mi error message handling

Pedro Alves
2008-03-24T18:30:49Z

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

I was looking through cleaning up mi/ global state, and noticed
the global mi_error_message used to output ^error,msg=""
messages.

I then noticed that the errors output by the mi/ module are
also duplicated to stderr.

>./gdb -i=mi
~"GNU gdb 6.8.50.20080323-cvs\n"
~"Copyright (C) 2008 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law. Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"x86_64-unknown-linux-gnu\".\n"
~"Setting up the environment for debugging gdb.\n"
&"/home/pedro/gdb/head/build/gdb/.gdbinit:5: Error in sourced command file:\n"
&"No symbol table is loaded. Use the \"file\" command.\n"
(gdb)
-exec-continue
^running
(gdb)
&"The program is not being run.\n"
^error,msg="The program is not being run."
(gdb)

Notice the duplication:
&"The program is not being run.\n"
^error,msg="The program is not being run."

I can't find a valid reason for that.
In fact having them display in gdb's output window in a
frontend doesn't help anyone, especially, since ^error is supposed
to be the error output channel. Furthermore, there are a couple
of cases that weren't using the mechanism correctly, as they
were already calling error.

The attached patch fixes it, and fixes the testsuite to not
expect this duplication.

--
Pedro Alves

[-- Attachment #2: mi_exceptions.diff --]
[-- Type: text/x-diff, Size: 46241 bytes --]

gdb/
2008-03-24 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-03-24 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.

---
gdb/mi/mi-cmds.h | 5
gdb/mi/mi-interp.c | 24 --
gdb/mi/mi-main.c | 251 +++++++++----------------------
gdb/testsuite/gdb.mi/mi-disassemble.exp | 8
gdb/testsuite/gdb.mi/mi-stack.exp | 8
gdb/testsuite/gdb.mi/mi-syn-frame.exp | 7
gdb/testsuite/gdb.mi/mi-var-block.exp | 4
gdb/testsuite/gdb.mi/mi-var-cmd.exp | 10 -
gdb/testsuite/gdb.mi/mi-var-display.exp | 2
gdb/testsuite/gdb.mi/mi2-disassemble.exp | 8
gdb/testsuite/gdb.mi/mi2-stack.exp | 8
gdb/testsuite/gdb.mi/mi2-syn-frame.exp | 6
gdb/testsuite/gdb.mi/mi2-var-block.exp | 4
gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 10 -
gdb/testsuite/gdb.mi/mi2-var-display.exp | 2
15 files changed, 126 insertions(+), 231 deletions(-)

Index: src/gdb/mi/mi-main.c
===================================================================
--- src.orig/gdb/mi/mi-main.c 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/mi/mi-main.c 2008-03-23 20:00:02.000000000 +0000
@@ -96,7 +96,6 @@ static int do_timings = 0;
/* The token of the last asynchronous command. */
static char *last_async_command;
static char *previous_async_command;
-char *mi_error_message;

extern void _initialize_mi_main (void);
static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse);
@@ -109,7 +108,7 @@ static void mi_exec_async_cli_cmd_contin

static int register_changed_p (int regnum, struct regcache *,
struct regcache *);
-static int get_register (int regnum, int format);
+static void get_register (int regnum, int format);

/* Command implementations. FIXME: Is this libgdb? No. This is the MI
layer that calls libgdb. Any operation used in the below should be
@@ -219,10 +218,8 @@ enum mi_cmd_result
mi_cmd_exec_interrupt (char *args, int from_tty)
{
if (!target_executing)
- {
- mi_error_message = xstrprintf ("mi_cmd_exec_interrupt: Inferior not executing.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_exec_interrupt: Inferior not executing.");
+
interrupt_target_command (args, from_tty);
if (last_async_command)
fputs_unfiltered (last_async_command, raw_stdout);
@@ -242,38 +239,40 @@ enum mi_cmd_result
mi_cmd_thread_select (char *command, char **argv, int argc)
{
enum gdb_rc rc;
+ char *mi_error_message;

if (argc != 1)
+ error ("mi_cmd_thread_select: USAGE: threadnum.");
+
+ rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
+
+ if (rc == GDB_RC_FAIL)
{
- mi_error_message = xstrprintf ("mi_cmd_thread_select: USAGE: threadnum.");
- return MI_CMD_ERROR;
+ make_cleanup (xfree, mi_error_message);
+ error ("%s", mi_error_message);
}
- else
- rc = gdb_thread_select (uiout, argv[0], &mi_error_message);

- if (rc == GDB_RC_FAIL)
- return MI_CMD_ERROR;
- else
- return MI_CMD_DONE;
+ return MI_CMD_DONE;
}

enum mi_cmd_result
mi_cmd_thread_list_ids (char *command, char **argv, int argc)
{
enum gdb_rc rc;
+ char *mi_error_message;

if (argc != 0)
+ error ("mi_cmd_thread_list_ids: No arguments required.");
+
+ rc = gdb_list_thread_ids (uiout, &mi_error_message);
+
+ if (rc == GDB_RC_FAIL)
{
- mi_error_message = xstrprintf ("mi_cmd_thread_list_ids: No arguments required.");
- return MI_CMD_ERROR;
+ make_cleanup (xfree, mi_error_message);
+ error ("%s", mi_error_message);
}
- else
- rc = gdb_list_thread_ids (uiout, &mi_error_message);

- if (rc == GDB_RC_FAIL)
- return MI_CMD_ERROR;
- else
- return MI_CMD_DONE;
+ return MI_CMD_DONE;
}

enum mi_cmd_result
@@ -282,10 +281,7 @@ mi_cmd_thread_info (char *command, char
int thread = -1;

if (argc != 0 && argc != 1)
- {
- mi_error_message = xstrprintf ("Invalid MI command");
- return MI_CMD_ERROR;
- }
+ error ("Invalid MI command");

if (argc == 1)
thread = atoi (argv[0]);
@@ -333,11 +329,8 @@ mi_cmd_data_list_register_names (char *c
{
regnum = atoi (argv[i]);
if (regnum < 0 || regnum >= numregs)
- {
- do_cleanups (cleanup);
- mi_error_message = xstrprintf ("bad register number");
- return MI_CMD_ERROR;
- }
+ error ("bad register number");
+
if (gdbarch_register_name (current_gdbarch, regnum) == NULL
|| *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
ui_out_field_string (uiout, NULL, "");
@@ -388,11 +381,7 @@ mi_cmd_data_list_changed_registers (char
continue;
changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
- {
- do_cleanups (cleanup);
- mi_error_message = xstrprintf ("mi_cmd_data_list_changed_registers: Unable to read register contents.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_list_changed_registers: Unable to read register contents.");
else if (changed)
ui_out_field_int (uiout, NULL, regnum);
}
@@ -410,20 +399,12 @@ mi_cmd_data_list_changed_registers (char
{
changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
- {
- do_cleanups (cleanup);
- mi_error_message = xstrprintf ("mi_cmd_data_list_register_change: Unable to read register contents.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_list_register_change: Unable to read register contents.");
else if (changed)
ui_out_field_int (uiout, NULL, regnum);
}
else
- {
- do_cleanups (cleanup);
- mi_error_message = xstrprintf ("bad register number");
- return MI_CMD_ERROR;
- }
+ error ("bad register number");
}
do_cleanups (cleanup);
return MI_CMD_DONE;
@@ -465,7 +446,7 @@ register_changed_p (int regnum, struct r
enum mi_cmd_result
mi_cmd_data_list_register_values (char *command, char **argv, int argc)
{
- int regnum, numregs, format, result;
+ int regnum, numregs, format;
int i;
struct cleanup *list_cleanup, *tuple_cleanup;

@@ -479,10 +460,7 @@ mi_cmd_data_list_register_values (char *
+ gdbarch_num_pseudo_regs (current_gdbarch);

if (argc == 0)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> [<regnum1>...<regnumN>]");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> [<regnum1>...<regnumN>]");

format = (int) argv[0][0];

@@ -499,12 +477,7 @@ mi_cmd_data_list_register_values (char *
continue;
tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
- result = get_register (regnum, format);
- if (result == -1)
- {
- do_cleanups (list_cleanup);
- return MI_CMD_ERROR;
- }
+ get_register (regnum, format);
do_cleanups (tuple_cleanup);
}
}
@@ -521,27 +494,18 @@ mi_cmd_data_list_register_values (char *
{
tuple_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
- result = get_register (regnum, format);
- if (result == -1)
- {
- do_cleanups (list_cleanup);
- return MI_CMD_ERROR;
- }
+ get_register (regnum, format);
do_cleanups (tuple_cleanup);
}
else
- {
- do_cleanups (list_cleanup);
- mi_error_message = xstrprintf ("bad register number");
- return MI_CMD_ERROR;
- }
+ error ("bad register number");
}
do_cleanups (list_cleanup);
return MI_CMD_DONE;
}

/* Output one register's contents in the desired format. */
-static int
+static void
get_register (int regnum, int format)
{
gdb_byte buffer[MAX_REGISTER_SIZE];
@@ -560,10 +524,7 @@ get_register (int regnum, int format)
&realnum, buffer);

if (optim)
- {
- mi_error_message = xstrprintf ("Optimized out");
- return -1;
- }
+ error ("Optimized out");

if (format == 'r')
{
@@ -589,7 +550,6 @@ get_register (int regnum, int format)
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
}
- return 1;
}

/* Write given values into registers. The registers and values are
@@ -611,30 +571,18 @@ mi_cmd_data_write_register_values (char
+ gdbarch_num_pseudo_regs (current_gdbarch);

if (argc == 0)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_write_register_values: Usage: -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_write_register_values: Usage: -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]");

format = (int) argv[0][0];

if (!target_has_registers)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_write_register_values: No registers.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_write_register_values: No registers.");

if (!(argc - 1))
- {
- mi_error_message = xstrprintf ("mi_cmd_data_write_register_values: No regs and values specified.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_write_register_values: No regs and values specified.");

if ((argc - 1) % 2)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_write_register_values: Regs and vals are not in pairs.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_write_register_values: Regs and vals are not in pairs.");

for (i = 1; i < argc; i = i + 2)
{
@@ -653,10 +601,7 @@ mi_cmd_data_write_register_values (char
regcache_cooked_write_signed (get_current_regcache (), regnum, value);
}
else
- {
- mi_error_message = xstrprintf ("bad register number");
- return MI_CMD_ERROR;
- }
+ error ("bad register number");
}
return MI_CMD_DONE;
}
@@ -676,9 +621,8 @@ mi_cmd_data_evaluate_expression (char *c

if (argc != 1)
{
- mi_error_message = xstrprintf ("mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression");
ui_out_stream_delete (stb);
- return MI_CMD_ERROR;
+ error ("mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression");
}

expr = parse_expression (argv[0]);
@@ -808,10 +752,7 @@ mi_cmd_data_read_memory (char *command,
argc -= optind;

if (argc < 5 || argc > 6)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_read_memory: Usage: ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR].");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_read_memory: Usage: ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR].");

/* Extract all the arguments. */

@@ -847,17 +788,13 @@ mi_cmd_data_read_memory (char *command,
/* The number of rows. */
nr_rows = atol (argv[3]);
if (nr_rows <= 0)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_read_memory: invalid number of rows.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_read_memory: invalid number of rows.");
+
/* Number of bytes per row. */
nr_cols = atol (argv[4]);
if (nr_cols <= 0)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_read_memory: invalid number of columns.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_read_memory: invalid number of columns.");
+
/* The un-printable character when printing ascii. */
if (argc == 6)
aschar = *argv[5];
@@ -872,11 +809,7 @@ mi_cmd_data_read_memory (char *command,
nr_bytes = target_read (&current_target, TARGET_OBJECT_MEMORY, NULL,
mbuf, addr, total_bytes);
if (nr_bytes <= 0)
- {
- do_cleanups (cleanups);
- mi_error_message = xstrdup ("Unable to read memory.");
- return MI_CMD_ERROR;
- }
+ error ("Unable to read memory.");

/* Output the header information. */
ui_out_field_core_addr (uiout, "addr", addr);
@@ -1008,10 +941,7 @@ mi_cmd_data_write_memory (char *command,
argc -= optind;

if (argc != 4)
- {
- mi_error_message = xstrprintf ("mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE.");
- return MI_CMD_ERROR;
- }
+ error ("mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE.");

/* Extract all the arguments. */
/* Start address of the memory dump. */
@@ -1060,7 +990,7 @@ mi_cmd_enable_timings (char *command, ch

usage_error:
error ("mi_cmd_enable_timings: Usage: %s {yes|no}", command);
- return MI_CMD_ERROR;
+ return MI_CMD_DONE;
}

enum mi_cmd_result
@@ -1081,7 +1011,7 @@ mi_cmd_list_features (char *command, cha
}

error ("-list-features should be passed no arguments");
- return MI_CMD_ERROR;
+ return MI_CMD_DONE;
}

/* Execute a command within a safe environment.
@@ -1121,7 +1051,7 @@ captured_mi_execute_command (struct ui_o
args->rc = mi_cmd_execute (context);

if (do_timings)
- timestamp (&cmd_finished);
+ timestamp (&cmd_finished);

if (!target_can_async_p () || !target_executing)
{
@@ -1143,19 +1073,6 @@ captured_mi_execute_command (struct ui_o
print_diff (context->cmd_start, &cmd_finished);
fputs_unfiltered ("\n", raw_stdout);
}
- 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);
- mi_error_message = NULL;
- fputs_unfiltered ("\"\n", raw_stdout);
- }
- mi_out_rewind (uiout);
- }
else
mi_out_rewind (uiout);
}
@@ -1196,19 +1113,6 @@ captured_mi_execute_command (struct ui_o
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);
- mi_error_message = NULL;
- fputs_unfiltered ("\"\n", raw_stdout);
- }
- mi_out_rewind (uiout);
- }
else
mi_out_rewind (uiout);
}
@@ -1246,20 +1150,9 @@ mi_execute_command (char *cmd, int from_
timestamp (command->cmd_start);
}

- /* FIXME: cagney/1999-11-04: Can this use of catch_exceptions either
- be pushed even further down or even eliminated? */
args.command = command;
result = catch_exception (uiout, captured_mi_execute_command, &args,
RETURN_MASK_ALL);
- exception_print (gdb_stderr, result);
-
- if (args.action == EXECUTE_COMMAND_SUPRESS_PROMPT)
- {
- /* The command is executing synchronously. Bail out early
- suppressing the finished prompt. */
- mi_parse_free (command);
- return;
- }
if (result.reason < 0)
{
/* The command execution failed and error() was called
@@ -1269,11 +1162,17 @@ mi_execute_command (char *cmd, int from_
if (result.message == NULL)
fputs_unfiltered ("unknown error", raw_stdout);
else
- fputstr_unfiltered (result.message, '"', raw_stdout);
+ fputstr_unfiltered (result.message, '"', raw_stdout);
fputs_unfiltered ("\"\n", raw_stdout);
mi_out_rewind (uiout);
}
+
mi_parse_free (command);
+
+ if (args.action == EXECUTE_COMMAND_SUPRESS_PROMPT)
+ /* The command is executing synchronously. Bail out early
+ suppressing the finished prompt. */
+ return;
}

fputs_unfiltered ("(gdb) \n", raw_stdout);
@@ -1311,13 +1210,15 @@ mi_cmd_execute (struct mi_parse *parse)
previous_async_command = xstrdup (last_async_command);
if (strcmp (parse->command, "exec-interrupt"))
{
- fputs_unfiltered (parse->token, raw_stdout);
- fputs_unfiltered ("^error,msg=\"", raw_stdout);
- fputs_unfiltered ("Cannot execute command ", raw_stdout);
- fputstr_unfiltered (parse->command, '"', raw_stdout);
- fputs_unfiltered (" while target running", raw_stdout);
- fputs_unfiltered ("\"\n", raw_stdout);
- return MI_CMD_ERROR;
+ struct ui_file *stb;
+ stb = mem_fileopen ();
+
+ fputs_unfiltered ("Cannot execute command ", stb);
+ fputstr_unfiltered (parse->command, '"', stb);
+ fputs_unfiltered (" while target running", stb);
+
+ make_cleanup_ui_file_delete (stb);
+ error_stream (stb);
}
}
last_async_command = xstrdup (parse->token);
@@ -1339,13 +1240,19 @@ mi_cmd_execute (struct mi_parse *parse)
else
{
/* FIXME: DELETE THIS. */
- fputs_unfiltered (parse->token, raw_stdout);
- fputs_unfiltered ("^error,msg=\"", raw_stdout);
- fputs_unfiltered ("Undefined mi command: ", raw_stdout);
- fputstr_unfiltered (parse->command, '"', raw_stdout);
- fputs_unfiltered (" (missing implementation)", raw_stdout);
- fputs_unfiltered ("\"\n", raw_stdout);
- return MI_CMD_ERROR;
+ struct ui_file *stb;
+
+ stb = mem_fileopen ();
+
+ fputs_unfiltered ("Undefined mi command: ", stb);
+ fputstr_unfiltered (parse->command, '"', stb);
+ fputs_unfiltered (" (missing implementation)", stb);
+
+ make_cleanup_ui_file_delete (stb);
+ error_stream (stb);
+
+ /* unreacheable */
+ return MI_CMD_DONE;
}
}

Index: src/gdb/mi/mi-cmds.h
===================================================================
--- src.orig/gdb/mi/mi-cmds.h 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/mi/mi-cmds.h 2008-03-23 19:56:36.000000000 +0000
@@ -33,10 +33,6 @@ enum mi_cmd_result
/* The command is still running in the forground. Main loop should
display the completion prompt. */
MI_CMD_FORGROUND,
- /* An error condition was detected and an error message was
- asprintf'd into the mi_error_message buffer. The main loop will
- display the error message and the completion prompt. */
- MI_CMD_ERROR,
/* The MI command has already displayed its completion message.
Main loop will not display a completion message but will display
the completion prompt. */
@@ -156,7 +152,6 @@ extern int mi_debug_p;
/* Raw console output - FIXME: should this be a parameter? */
extern struct ui_file *raw_stdout;

-extern char *mi_error_message;
extern void mi_execute_command (char *cmd, int from_tty);

#endif
Index: src/gdb/mi/mi-interp.c
===================================================================
--- src.orig/gdb/mi/mi-interp.c 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/mi/mi-interp.c 2008-03-23 19:56:36.000000000 +0000
@@ -190,29 +190,20 @@ 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;

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. */
@@ -228,7 +219,6 @@ mi_cmd_interpreter_exec (char *command,
if (e.reason < 0)
{
mi_error_message = xstrdup (e.message);
- result = MI_CMD_ERROR;
break;
}
}
@@ -246,7 +236,9 @@ mi_cmd_interpreter_exec (char *command,
add_continuation (mi_interpreter_exec_continuation, NULL);
}

- return result;
+ if (mi_error_message != NULL)
+ error ("%s", mi_error_message);
+ return MI_CMD_DONE;
}

/*
Index: src/gdb/testsuite/gdb.mi/mi-disassemble.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-disassemble.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-disassemble.exp 2008-03-23 19:56:36.000000000 +0000
@@ -160,19 +160,19 @@ proc test_disassembly_bogus_args {} {
# -data-disassembly -f basics.c -l 32 -- 9

mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"

mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
- "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+ "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
"data-disassemble bogus address"

mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"

mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
- "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+ "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"

}
Index: src/gdb/testsuite/gdb.mi/mi-stack.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-stack.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-stack.exp 2008-03-23 19:56:36.000000000 +0000
@@ -69,7 +69,7 @@ proc test_stack_frame_listing {} {
"stack frame listing 1 3"

mi_gdb_test "234-stack-list-frames 1" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
"stack frame listing wrong"

mi_gdb_test "235-stack-info-frame" \
@@ -120,7 +120,7 @@ proc test_stack_args_listing {} {
"stack args listing 1 1 3"

mi_gdb_test "234-stack-list-arguments" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
"stack args listing wrong"

mi_gdb_test "235-stack-list-arguments 1 1 300" \
@@ -151,7 +151,7 @@ proc test_stack_info_depth {} {
"stack info-depth 99"

mi_gdb_test "231-stack-info-depth 99 99" \
- "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+ "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
"stack info-depth wrong usage"
}

@@ -190,7 +190,7 @@ gdb_expect {
"stack locals listing, simple types: names and values, complex type: names and types"

mi_gdb_test "234-stack-list-locals" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"

mi_gdb_test "232-stack-select-frame 1" \
Index: src/gdb/testsuite/gdb.mi/mi-var-block.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-var-block.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-var-block.exp 2008-03-23 19:56:36.000000000 +0000
@@ -49,7 +49,7 @@ mi_gdb_test "-var-create cb * cb" \
"create local variable cb"

mi_gdb_test "-var-create foo * foo" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create local variable foo"

# step to "foo = 123;"
@@ -60,7 +60,7 @@ mi_step_to "do_block_tests" "" "var-cmd.

# Be paranoid and assume 3.2 created foo
mi_gdb_test "-var-delete foo" \
- "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
+ "\\^error,msg=\"Variable object not found\"" \
"delete var foo"

Index: src/gdb/testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-var-cmd.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-var-cmd.exp 2008-03-23 19:56:36.000000000 +0000
@@ -58,14 +58,14 @@ mi_gdb_test "111-var-create global_simpl
# Desc: Create non-existent variable

mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create non-existent variable"

# Test: c_variable-1.3
# Desc: Create out of scope variable

mi_gdb_test "113-var-create argc * argc" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create out of scope variable"

mi_runto do_locals_tests
@@ -154,7 +154,7 @@ mi_gdb_test "-var-create lsimple.integer
# Type names (like int, long, etc..) are all proper expressions to gdb.
# make sure variable code does not allow users to create variables, though.
mi_gdb_test "-var-create int * int" \
- "&\"Attempt to use a type name as an expression.\\\\n\".*&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create int"

@@ -275,7 +275,7 @@ mi_gdb_test "-var-update *" \
#
###
mi_gdb_test "-var-assign global_simple 0" \
- "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
+ "\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
"assign to global_simple"

mi_gdb_test "-var-assign linteger 3333" \
@@ -449,7 +449,7 @@ mi_gdb_test "-var-create l * l" \
# Test: c_variable-2.11
# Desc: create do_locals_tests local in subroutine1
mi_gdb_test "-var-create linteger * linteger" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create linteger"

mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
Index: src/gdb/testsuite/gdb.mi/mi-var-display.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-var-display.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-var-display.exp 2008-03-23 19:56:36.000000000 +0000
@@ -544,7 +544,7 @@ clear_xfail "*-*-*"
# Test: c_variable-7.70
# Desc: create anone
mi_gdb_test "-var-create anone * anone" \
- "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \
+ "\\^error,msg=\"Duplicate variable object name\"" \
"create duplicate local variable anone"

Index: src/gdb/testsuite/gdb.mi/mi2-disassemble.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-disassemble.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-disassemble.exp 2008-03-23 19:56:36.000000000 +0000
@@ -160,19 +160,19 @@ proc test_disassembly_bogus_args {} {
# -data-disassembly -f basics.c -l 32 -- 9

mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"

mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
- "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+ "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
"data-disassemble bogus address"

mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"

mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
- "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+ "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"

}
Index: src/gdb/testsuite/gdb.mi/mi2-stack.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-stack.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-stack.exp 2008-03-23 19:56:36.000000000 +0000
@@ -69,7 +69,7 @@ proc test_stack_frame_listing {} {
"stack frame listing 1 3"

mi_gdb_test "234-stack-list-frames 1" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
"stack frame listing wrong"

mi_gdb_test "235-stack-info-frame" \
@@ -120,7 +120,7 @@ proc test_stack_args_listing {} {
"stack args listing 1 1 3"

mi_gdb_test "234-stack-list-arguments" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
"stack args listing wrong"

mi_gdb_test "235-stack-list-arguments 1 1 300" \
@@ -151,7 +151,7 @@ proc test_stack_info_depth {} {
"stack info-depth 99"

mi_gdb_test "231-stack-info-depth 99 99" \
- "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+ "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
"stack info-depth wrong usage"
}

@@ -190,7 +190,7 @@ gdb_expect {
"stack locals listing, simple types: names and values, complex type: names and types"

mi_gdb_test "234-stack-list-locals" \
- "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+ "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"

mi_gdb_test "232-stack-select-frame 1" \
Index: src/gdb/testsuite/gdb.mi/mi2-var-block.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-var-block.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-var-block.exp 2008-03-23 19:56:36.000000000 +0000
@@ -49,7 +49,7 @@ mi_gdb_test "-var-create cb * cb" \
"create local variable cb"

mi_gdb_test "-var-create foo * foo" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create local variable foo"

# step to "foo = 123;"
@@ -60,7 +60,7 @@ mi_step_to "do_block_tests" "" "var-cmd.

# Be paranoid and assume 3.2 created foo
mi_gdb_test "-var-delete foo" \
- "&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
+ "\\^error,msg=\"Variable object not found\"" \
"delete var foo"

Index: src/gdb/testsuite/gdb.mi/mi2-var-cmd.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-var-cmd.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-var-cmd.exp 2008-03-23 19:56:36.000000000 +0000
@@ -58,14 +58,14 @@ mi_gdb_test "111-var-create global_simpl
# Desc: Create non-existent variable

mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create non-existent variable"

# Test: c_variable-1.3
# Desc: Create out of scope variable

mi_gdb_test "113-var-create argc * argc" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create out of scope variable"

mi_runto do_locals_tests
@@ -154,7 +154,7 @@ mi_gdb_test "-var-create lsimple.integer
# Type names (like int, long, etc..) are all proper expressions to gdb.
# make sure variable code does not allow users to create variables, though.
mi_gdb_test "-var-create int * int" \
- "&\"Attempt to use a type name as an expression.\\\\n\".*&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create int"

@@ -275,7 +275,7 @@ mi_gdb_test "-var-update *" \
#
###
mi_gdb_test "-var-assign global_simple 0" \
- "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
+ "\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
"assign to global_simple"

mi_gdb_test "-var-assign linteger 3333" \
@@ -412,7 +412,7 @@ mi_gdb_test "-var-create l * l" \
# Test: c_variable-2.11
# Desc: create do_locals_tests local in subroutine1
mi_gdb_test "-var-create linteger * linteger" \
- "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
+ "\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
"create linteger"

mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
Index: src/gdb/testsuite/gdb.mi/mi2-var-display.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-var-display.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-var-display.exp 2008-03-23 19:56:36.000000000 +0000
@@ -544,7 +544,7 @@ clear_xfail "*-*-*"
# Test: c_variable-7.70
# Desc: create anone
mi_gdb_test "-var-create anone * anone" \
- "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \
+ "\\^error,msg=\"Duplicate variable object name\"" \
"create duplicate local variable anone"

Index: src/gdb/testsuite/gdb.mi/mi-syn-frame.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-syn-frame.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi-syn-frame.exp 2008-03-23 19:56:36.000000000 +0000
@@ -48,7 +48,8 @@ mi_gdb_test "400-break-insert foo" \
# Call foo() by hand, where we'll hit a breakpoint.
#

-mi_gdb_test "401-data-evaluate-expression foo()" "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(foo\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.*\"" "call inferior's function with a breakpoint set in it"
+mi_gdb_test "401-data-evaluate-expression foo()" "401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
+

mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"

@@ -75,7 +76,7 @@ mi_gdb_test "405-break-insert subroutine
"insert breakpoint subroutine"

mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
- "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+ "406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
"data evaluate expression"

# We should have both a signal handler and a call dummy frame
@@ -99,7 +100,7 @@ mi_gdb_test "409-stack-list-frames 0 0"
#

mi_gdb_test "410-data-evaluate-expression bar()" \
- "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
+ "410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
"call inferior function which raises exception"

mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
Index: src/gdb/testsuite/gdb.mi/mi2-syn-frame.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-syn-frame.exp 2008-03-23 19:56:34.000000000 +0000
+++ src/gdb/testsuite/gdb.mi/mi2-syn-frame.exp 2008-03-23 19:56:36.000000000 +0000
@@ -50,7 +50,7 @@ mi_gdb_test "400-break-insert foo" \
# Call foo() by hand, where we'll hit a breakpoint.
#

-mi_gdb_test "401-data-evaluate-expression foo()" "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(foo\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.*\"" "call inferior's function with a breakpoint set in it"
+mi_gdb_test "401-data-evaluate-expression foo()" "401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"

mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"

@@ -82,7 +82,7 @@ mi_gdb_test "405-break-insert subroutine
"insert breakpoint subroutine"

mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
- "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+ "406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
"evaluate expression have_a_very_merry_interrupt"

# We should have both a signal handler and a call dummy frame
@@ -111,7 +111,7 @@ mi_gdb_test "409-stack-list-frames 0 0"
# Call bar() by hand, which should get an exception while running.
#

-mi_gdb_test "410-data-evaluate-expression bar()" "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
+mi_gdb_test "410-data-evaluate-expression bar()" "410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"

mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"