+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.
+
2008-04-04 Joel Brobecker <brobecker@adacore.com>
* NEWS: Mention new commands set/show multiple-symbols.
/* 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. */
/* 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
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. */
/* 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;
}
}
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;
}
/*
/* 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);
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
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);
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
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]);
{
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, "");
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);
}
{
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;
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;
+ 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];
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);
}
}
{
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];
&realnum, buffer);
if (optim)
- {
- mi_error_message = xstrprintf ("Optimized out");
- return -1;
- }
+ error ("Optimized out");
if (format == 'r')
{
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
}
- return 1;
}
/* Write given values into registers. The registers and values are
+ 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)
{
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;
}
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]);
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. */
/* 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];
nr_bytes = target_read (¤t_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);
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. */
usage_error:
error ("mi_cmd_enable_timings: Usage: %s {yes|no}", command);
- return MI_CMD_ERROR;
+ return MI_CMD_DONE;
}
enum mi_cmd_result
}
error ("-list-features should be passed no arguments");
- return MI_CMD_ERROR;
+ return MI_CMD_DONE;
}
/* Execute a command within a safe environment.
args->rc = mi_cmd_execute (context);
if (do_timings)
- timestamp (&cmd_finished);
+ timestamp (&cmd_finished);
if (!target_can_async_p () || !target_executing)
{
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);
}
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);
}
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_SUPPRESS_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
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_SUPPRESS_PROMPT)
+ /* The command is executing synchronously. Bail out early
+ suppressing the finished prompt. */
+ return;
}
fputs_unfiltered ("(gdb) \n", raw_stdout);
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);
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;
}
}
+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.
+
2008-04-03 Joel Brobecker <brobecker@adacore.com>
* gdb.cp/ovldbreak.cc: Add missing bodies for methods foo::foofunc.
# -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"
}
"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" \
"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" \
"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"
}
"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" \
# 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"
"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
#
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"
mi_create_varobj "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\"" \
"try to create local variable foo"
# step to "foo = 123;"
# 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"
# 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
# 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"
#
###
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" \
# 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=\".*\"\}" \
# 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"
# -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"
}
"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" \
"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" \
"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"
}
"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" \
# 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"
"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
# 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"
mi_create_varobj "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;"
# 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"
# 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
# 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"
#
###
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" \
# 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=\".*\"\}" \
# 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"