# CLI sub directory definitons
#
SUBDIR_CLI_OBS = \
- cli-dump.o cli-decode.o \
- cli-interp.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o
+ cli-dump.o \
+ cli-decode.o cli-script.o cli-cmds.o \
+ cli-interp.o \
+ cli-setshow.o cli-utils.o
SUBDIR_CLI_SRCS = \
- cli/cli-dump.c cli/cli-decode.c \
- cli/cli-interp.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c \
+ cli/cli-dump.c \
+ cli/cli-decode.c cli/cli-script.c cli/cli-cmds.c \
+ cli/cli-interp.c \
+ cli/cli-setshow.c \
cli/cli-utils.c
SUBDIR_CLI_DEPS =
SUBDIR_CLI_INITS = \
mi-out.o mi-console.o \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
mi-cmd-disas.o \
- mi-events.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
mi/mi-cmd-disas.c \
- mi/mi-events.c \
mi/mi-interp.c \
mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
frame-unwind.c \
gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
hpacc-abi.c \
- inf-loop.c infcmd.c inflow.c infrun.c interps.c \
+ inf-loop.c infcmd.c inflow.c infrun.c \
+ interps.c \
jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
kod.c kod-cisco.c \
language.c linespec.c \
# gdb/mi/ headers
#
+mi_h = $(srcdir)/mi/mi.h
mi_cmds_h = $(srcdir)/mi/mi-cmds.h
mi_console_h = $(srcdir)/mi/mi-console.h
mi_getopt_h = $(srcdir)/mi/mi-getopt.h
source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
expprint.o environ.o stack.o thread.o \
+ interps.o \
macrotab.o macrocmd.o macroexp.o macroscope.o \
event-loop.o event-top.o inf-loop.o completer.o \
gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o $(DEPFILES) \
dbxread.o coffread.o elfread.o \
dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
c-lang.o f-lang.o \
- ui-out.o cli-out.o interps.o \
+ ui-out.o cli-out.o \
varobj.o wrapper.o \
jv-lang.o jv-valprint.o jv-typeprint.o \
m2-lang.o p-lang.o p-typeprint.o p-valprint.o \
$(value_h) $(expression_h) $(target_h) $(frame_h) $(language_h) \
$(f_lang_h) $(cp_abi_h)
event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \
- $(gdb_string_h) $(interps_h)
+ $(gdb_string_h)
event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
- $(terminal_h) $(event_loop_h) $(event_top_h) $(gdbcmd_h) \
- $(readline_h) $(interps_h)
+ $(terminal_h) $(event_loop_h) $(event_top_h) $(gdbcmd_h) $(readline_h)
exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
$(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
$(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h) \
$(command_h) $(gdbcmd_h) $(floatformat_h) $(buildsym_h) \
$(i387_tdep_h) $(i386_tdep_h) $(value_h) $(regcache_h) \
$(gdb_string_h)
-interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
- $(event_top_h) $(interps_h) $(gdb_h) $(wrapper_h) $(gdb_events_h)
h8300-tdep.o: h8300-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(dis_asm_h) \
$(gdbcmd_h) $(gdbtypes_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \
$(regcache_h)
$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h)
infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbcore_h)
+interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
+ $(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
+ $(gdb_events_h)
irix4-nat.o: irix4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) \
$(gregset_h)
irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
$(bcache_h) $(complaints_h)
main.o: main.c $(defs_h) $(top_h) $(target_h) $(inferior_h) $(symfile_h) \
$(gdbcore_h) $(getopt_h) $(gdb_stat_h) $(gdb_string_h) \
- $(event_loop_h) $(ui_out_h) $(main_h) $(interps_h)
+ $(event_loop_h) $(ui_out_h) $(main_h)
maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \
$(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \
$(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h)
$(cli_decode_h) $(cli_cmds_h) $(value_h) $(completer_h) \
$(cli_dump_h) $(gdb_assert_h) $(target_h) $(readline_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-dump.c
-cli-interp.o: $(srcdir)/cli/cli-interp.c $(defs_h) $(value_h) \
- $(wrapper_h) $(event_top_h) $(ui_out_h) $(cli_out_h) $(top_h)
+cli-interp.o: $(srcdir)/cli/cli-interp.c $(defs_h) $(interps_h) $(wrapper_h) \
+ $(event_top_h) $(ui_out_h) $(cli_out_h) $(top_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-interp.c
cli-script.o: $(srcdir)/cli/cli-script.c $(defs_h) $(value_h) $(language_h) \
$(ui_out_h) $(gdb_string_h) $(top_h) $(cli_cmds_h) $(cli_decode_h) \
mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \
$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
- $(mi_getopt_h) $(gdb_events_h) $(gdb_h) $(interps_h)
+ $(mi_getopt_h) $(gdb_events_h) $(gdb_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
$(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h)
mi-console.o: $(srcdir)/mi/mi-console.c $(defs_h) $(mi_console_h) \
$(gdb_string_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-console.c
-mi-events.o: $(srcdir)/mi/mi-events.c $(defs_h) $(ui_out_h) $(interps_h) \
- $(gdb_h) $(breakpoint_h) $(mi_h)
- $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-events.c
mi-getopt.o: $(srcdir)/mi/mi-getopt.c $(defs_h) $(mi_getopt_h) \
$(gdb_string_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-getopt.c
-mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(interps_h) \
- $(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) \
- $(top_h) $(mi_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h)
+mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(gdb_string_h) $(interps_h) \
+ $(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) $(top_h) \
+ $(mi_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c
mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_h) \
$(gdb_string_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) $(mi_parse_h) \
$(mi_getopt_h) $(mi_console_h) $(ui_out_h) $(mi_out_h) \
$(event_loop_h) $(event_top_h) $(gdbcore_h) $(value_h) $(regcache_h) \
- $(gdb_h) $(frame_h) $(interps_h)
+ $(gdb_h) $(frame_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-main.c
mi-out.o: $(srcdir)/mi/mi-out.c $(defs_h) $(ui_out_h) $(mi_out_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-out.c
b = set_raw_breakpoint (sal, type);
b->number = internal_breakpoint_number--;
b->disposition = disp_donttouch;
- breakpoint_create_event (b->number);
return b;
}
}
mention (b);
- breakpoint_create_event (b->number);
do_cleanups (old_chain);
}
b->forked_inferior_pid = 0;
mention (b);
- breakpoint_create_event (b->number);
}
void
b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
- breakpoint_create_event (b->number);
}
static int
if (in_thread_list (inferior_ptid))
b->thread = pid_to_thread_id (inferior_ptid);
- breakpoint_create_event (b->number);
return b;
}
\f
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
+ /* FIXME: This is misplaced; mention() is called by things (like hitting a
+ watchpoint) other than breakpoint creation. It should be possible to
+ clean this up and at the same time replace the random calls to
+ breakpoint_changed with this hook, as has already been done for
+ delete_breakpoint_hook and so on. */
+ if (create_breakpoint_hook)
+ create_breakpoint_hook (b);
+ breakpoint_create_event (b->number);
+
switch (b->type)
{
case bp_none:
b->enable_state = bp_enabled;
b->disposition = disposition;
mention (b);
- breakpoint_create_event (b->number);
}
}
}
/* The scope breakpoint is related to the watchpoint. We
will need to act on them together. */
b->related_breakpoint = scope_breakpoint;
-
- breakpoint_create_event (scope_breakpoint->number);
}
}
value_free_to_mark (mark);
- breakpoint_create_event (b->number);
mention (b);
}
b->enable_state = bp_enabled;
b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
- breakpoint_create_event (b->number);
}
/* Deal with "catch catch" and "catch throw" commands */
b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
- breakpoint_create_event (b->number);
}
if (sals.nelts > 1)
b->number = breakpoint_count;
b->cond = 0;
b->thread = -1;
- breakpoint_create_event (b->number);
return b;
}
#define CLI_OUT_H
extern struct ui_out *cli_out_new (struct ui_file *stream);
+
extern struct ui_file *cli_out_set_stream (struct ui_out *uiout,
struct ui_file *stream);
+
#endif
extern int (*ui_load_progress_hook) (const char *section, unsigned long num);
+
/* Inhibit window interface if non-zero. */
extern int use_windows;
#*:void:warning_hook:const char *string, va_list args:string, args
#*:void:target_output_hook:char *b:b
#*:void:interactive_hook:void
+#*:void:registers_changed_hook:void
#*:void:readline_begin_hook:char *format, ...:format
#*:char *:readline_hook:char *prompt:prompt
#*:void:readline_end_hook:void
#*:int:gdb_load_progress_hook:char *section, unsigned long num:section, num
#*:void:pre_add_symbol_hook:char *name:name
#*:void:post_add_symbol_hook:void
+#*:void:selected_frame_level_changed_hook:int level:level
#*:int:gdb_loop_hook:int signo:signo
##*:void:solib_create_inferior_hook:void
##*:void:xcoff_relocate_symtab_hook:unsigned int
#include "mi-getopt.h"
#include "gdb-events.h"
#include "gdb.h"
-#include "interps.h"
enum
{
static void
breakpoint_notify (int b)
{
- if (b > 0)
- gdb_breakpoint_query (uiout, b);
+ gdb_breakpoint_query (uiout, b);
}
int ignore_count = 0;
char *condition = NULL;
enum gdb_rc rc;
- struct gdb_events *old_hooks = NULL;
+ struct gdb_events *old_hooks;
enum opt
{
HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT,
error ("mi_cmd_break_insert: Garbage following <location>");
address = argv[optind];
- /* Save the current event handlers so that we can insert our own. This
- allows us to capture the breakpoint information as the breakpoint
- is created. Unfortunately, it also overrides any existing event
- handlers, so we won't get any event notifications sent out to the
- client. MI3+ does NOT send breakpoint information with the -break-insert
- command for this reason. */
- if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
- || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
- old_hooks = set_gdb_event_hooks (&breakpoint_hooks);
-
/* Now we have what we need, let's insert the breakpoint! */
+ old_hooks = set_gdb_event_hooks (&breakpoint_hooks);
switch (type)
{
case REG_BP:
internal_error (__FILE__, __LINE__,
"mi_cmd_break_insert: Bad switch.");
}
-
- if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
- || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
- set_gdb_event_hooks (old_hooks);
+ set_gdb_event_hooks (old_hooks);
if (rc == GDB_RC_FAIL)
return MI_CMD_CAUGHT_ERROR;
default:
error ("mi_cmd_break_watch: Unknown watchpoint type.");
}
-
- /* Ugh. This is a hack. mention and print_one_breakpoint in
- breakpoint.c are so overloaded, that watchpoints and breakpoints
- cannot use the same printing mechanisms. So for MI3+, we simply
- rewind MI's uiout so that we can prevent GDB from printing
- any information about the watchpoint we just inserted. */
- if (!gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
- && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
- mi_out_rewind (uiout);
-
return MI_CMD_DONE;
}
enum mi_cmd_result
{
/* Report the command as ``done''. Display both the ``NNN^done''
- message and the completion prompt. */
+ message and the completion prompt. */
MI_CMD_DONE = 0,
/* The command is still running in the forground. Main loop should
display the completion prompt. */
extern char *mi_error_message;
extern void mi_error_last_message (void);
extern void mi_execute_command (char *cmd, int from_tty);
+
#endif
/* Replace all the hooks that we know about. There really needs to
be a better way of doing this... */
clear_interpreter_hooks ();
- set_gdb_event_hooks (&mi_event_handlers);
show_load_progress = mi_load_progress;
extern struct gdb_interpreter *mi_interp;
extern struct gdb_interpreter *mi1_interp;
-extern struct gdb_events mi_event_handlers;
extern struct ui_file *mi_event_channel;
extern void mi_setup_architecture_data (void);
+2003-02-03 Andrew Cagney <ac131313@redhat.com>
+
+ * mi-cli.exp: Remove patterns checking for events. Better handle
+ continuations.
+
2002-08-21 Keith Seitz <keiths@redhat.com>
* mi-cli.exp: Use "target_changed" instead of "register-update".
-# Copyright 1999, 2002 Free Software Foundation, Inc.
+# Copyright 1999 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# -break-list
mi_gdb_test "222-break-insert -t main" \
- "=breakpoint-create,number=\"1\"\r\n222\\^done" \
+ "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
"break-insert -t operation"
mi_gdb_test "333-break-insert -t basics.c:callee2" \
- "=breakpoint-create,number=\"2\"\r\n333\\^done" \
+ "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:callee2"
mi_gdb_test "444-break-insert -t basics.c:15" \
- "=breakpoint-create,number=\"3\"\r\n444\\^done" \
+ "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
"insert temp breakpoint at basics.c:15 (callee3)"
# Getting the quoting right is tricky. That is "\"<file>\":6"
mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":6\"" \
- "=breakpoint-create,number=\"4\"\r\n555\\^done" \
+ "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
"insert temp breakpoint at \"<fullfilename>\":6 (callee4)"
mi_gdb_test "666-break-list" \
"&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \
"-interpreter-exec console bogus"
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
+# {(=.*)+\^done} \
+# "-interpreter-exec console \"file \$binfile\""
mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
- {(=.*)+\^done} \
+ {\^done} \
"-interpreter-exec console \"file \$binfile\""
mi_run_to_main
{\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \
"-interpreter-exec console \"show args\""
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"break callee4\"" \
+# {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-create,number="2".*\^done} \
+# "-interpreter-exec console \"break callee4\""
mi_gdb_test "-interpreter-exec console \"break callee4\"" \
- {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-create,number="2".*\^done} \
+ {(&.*)*.*~"Breakpoint 2 at.*\\n".*\^done} \
"-interpreter-exec console \"break callee4\""
mi_gdb_test "-interpreter-exec console \"info break\"" \
{.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
"-interpreter-exec console \"list\""
-mi_gdb_test "-exec-continue" \
- {.*\*stopped,reason="breakpoint-hit",.*func="callee4".*file=".*basics.c",line="8"\}} \
- "-interpreter-exec console \"continue to callee4\""
+# # NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-exec-continue" \
+# {.*\*stopped,reason="breakpoint-hit",.*func="callee4".*file=".*basics.c",line="8"\}} \
+# "-interpreter-exec console \"continue to callee4\""
+send_gdb "999-exec-continue\n"
+gdb_expect {
+ -re "999\\^running\[\r\n\]+$mi_gdb_prompt.*999\\*stopped,reason=.breakpoint-hit.*$mi_gdb_prompt$" {
+ pass "continue to callee4"
+ }
+ timeout {
+ fail "continue to callee4 (timeout)"
+ }
+}
-mi_gdb_test "-interpreter-exec console \"delete 2\"" \
- {.*=breakpoint-delete,number=\"2\".*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
+# {.*=breakpoint-delete,number=\"2\".*\^done} \
+# "-interpreter-exec console \"delete 2\""
+mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
+ {100\^done} \
"-interpreter-exec console \"delete 2\""
-mi_gdb_test "-interpreter-exec console \"up\"" \
- {.*=selected-frame-level-changed,level="1".*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "200-interpreter-exec console \"up\"" \
+# {.*=selected-frame-level-changed,level="1".*\^done} \
+# "-interpreter-exec console \"up\""
+mi_gdb_test "200-interpreter-exec console \"up\"" \
+ {200\^done} \
"-interpreter-exec console \"up\""
-mi_gdb_test "-interpreter-exec console \"down\"" \
- {.*=selected-frame-level-changed,level="0".*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "300-interpreter-exec console \"down\"" \
+# {.*=selected-frame-level-changed,level="0".*\^done} \
+# "-interpreter-exec console \"down\""
+mi_gdb_test "300-interpreter-exec console \"down\"" \
+ {300\^done} \
"-interpreter-exec console \"down\""
-mi_gdb_test "-interpreter-exec console \"frame 2\"" \
- {.*=selected-frame-level-changed,level="2".*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"frame 2\"" \
+# {.*=selected-frame-level-changed,level="2".*\^done} \
+# "-interpreter-exec console \"frame 2\""
+mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
+ {400\^done} \
"-interpreter-exec console \"frame 2\""
-mi_gdb_test "-stack-select-frame 0" \
- {.*=selected-frame-level-changed,level="0".*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-stack-select-frame 0" \
+# {.*=selected-frame-level-changed,level="0".*\^done} \
+# "-stack-select-frame 0"
+mi_gdb_test "500-stack-select-frame 0" \
+ {500\^done} \
"-stack-select-frame 0"
-mi_gdb_test "-break-insert -t basics.c:35" \
- {.*=breakpoint-create,number="3".*\^done} \
- "-break-insert -t basics.c:35"
-
-mi_gdb_test "-exec-continue" \
- {.*\*stopped.*,file=".*basics.c",line="35"\}} \
- "-exec-continue to line 35"
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-break-insert -t basics.c:35" \
+# {.*=breakpoint-create,number="3".*\^done} \
+# "-break-insert -t basics.c:35"
+mi_gdb_test "600-break-insert -t basics.c:35" \
+ {600\^done,bkpt=.number="3",type="breakpoint".*\}} \
+ "-break-insert -t basics.c:35"
+
+# mi_gdb_test "-exec-continue" \
+# {.*\*stopped.*,file=".*basics.c",line="35"\}} \
+# "-exec-continue to line 35"
+send_gdb "700-exec-continue\n"
+gdb_expect {
+ -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.35.*$mi_gdb_prompt$" {
+ pass "-exec-continue to line 35"
+ }
+ timeout {
+ fail "-exec-continue to line 35"
+ }
+}
-mi_gdb_test "-exec-next" \
- {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
- "-exec-next to line 37"
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-exec-next" \
+# {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
+# "-exec-next to line 37"
+send_gdb "800-exec-next\n"
+gdb_expect {
+ -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.37.*$mi_gdb_prompt$" {
+ pass "-exec-next to line 37"
+ }
+ timeout {
+ fail "-exec-next to line 37"
+ }
+}
mi_gdb_test "-interpreter-exec console \"list\"" \
{\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
{\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
"-interpreter-exec console \"help set args\""
-mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
- {.*=target-changed.*\^done} \
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
+# {.*=target-changed.*\^done} \
+# "-interpreter-exec console \"set \$pc=0x0\""
+mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
+ {888\^done} \
"-interpreter-exec console \"set \$pc=0x0\""
#mi_gdb_test "-interpreter-exec console \"\"" \
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
-# This file tests that GDB's console can be accessed via the MI.
-# Specifically, we are testing the "interpreter-exec" command and that
-# the commands that are executed via this command are properly executed.
-# Console commands executed via MI should use MI output wrappers, MI event
-# handlers, etc.
+# This file tests MI thread commands.
+# Specifically, we are testing the MI command set and the console (in MI)
+# command set ("interpreter-exec") and that the commands that are executed
+# via these command pathways are properly executed. Console commands
+# executed via MI should use MI output wrappers, MI event handlers, etc.
# This only works with native configurations
if {![isnative]} {
continue
}
+# The procs below dealing with parsing cli/mi output for the threadlist
+# is duplicated in gdb669.exp. Any changes here will probably need to
+# be made there as well.
+
proc get_mi_thread_list {name} {
global expect_out
# ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N"
# (gdb)
mi_gdb_test "-thread-list-ids" \
- {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \
+ {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
"-thread_list_ids ($name)"
+ set output {}
+ if {[info exists expect_out(buffer)]} {
+ set output $expect_out(buffer)
+ }
+
set thread_list {}
- if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $expect_out(buffer) threads]} {
+ if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
fail "finding threads in MI output ($name)"
} else {
pass "finding threads in MI output ($name)"
global expect_out
mi_gdb_test "-thread-list-ids" \
- {\^done,thread-ids=\{(thread-id="[0-9]+"(,)*)+\},number-of-threads="[0-9]+"} \
+ {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
"-thread-list-ids ($name)"
- set mi_output $expect_out(buffer)
+ set mi_output {}
+ if {[info exists expect_out(buffer)]} {
+ set mi_output $expect_out(buffer)
+ }
# GDB will return a list of thread ids and some more info:
#
# ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1"
# ~" 2 Thread 2049 (LWP 7732) 0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63"
# ~"* 1 Thread 1024 (LWP 7731) main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160"
- mi_gdb_test {-interpreter-exec console "info threads"} \
+ # FIXME: kseitz/2002-09-05: Don't use the hack-cli method.
+ mi_gdb_test "info threads" \
{.*(~".*"[\r\n]*)+.*} \
"info threads ($name)"
- set console_output $expect_out(buffer)
+ set console_output {}
+ if {[info exists $expect_out(buffer)]} {
+ set console_output $expect_out(buffer)
+ }
# Make a list of all known threads to console (gdb's thread IDs)
set console_thread_list {}
}
}
-# This procedure checks for the bug gdb/669, where the console
-# command "info threads" and the MI command "-thread-list-ids"
-# return different threads in the system.
-proc check_for_gdb669_bug {} {
- mi_run_to_main
- check_mi_and_console_threads "at main"
-
- for {set i 0} {$i < 4} {incr i} {
- mi_next "next, try $i"
- check_mi_and_console_threads "try $i"
- }
-}
-
# This procedure tests the various thread commands in MI.
proc check_mi_thread_command_set {} {
# many of the threads are blocked in libc calls,
# and many people have libc's with no symbols.
mi_gdb_test "-thread-select $thread" \
- "=context-changed,thread=\"$thread\"\r\n\\^done,new-thread-id=\"$thread\",frame={.*},line=\"(-)?\[0-9\]+\",file=\".*\"" \
+ "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
"check_mi_thread_command_set: -thread-select $thread"
}
}
-# This procedure checks that the console and MI don't get out
-# of sync with each other.
-proc check_console_thread_commands {} {
-
- # Assumed that we're at done_making_threads
- set thread_list [get_mi_thread_list "in check_console_thread_commands"]
- foreach thread $thread_list {
- mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
- "(\\~\".*\"\r\n)*=context-changed,thread=\"$thread\"\r\n\\^done" \
- "-interpreter-exec console \"thread $thread\""
- }
-}
-
#
# Start here
#
mi_gdb_load $binfile
check_mi_thread_command_set
-check_console_thread_commands
-check_for_gdb669_bug
mi_gdb_exit
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+
proc test_return_simple {} {
global mi_gdb_prompt
global hex
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# -break-info
mi_gdb_test "200-break-insert main" \
- "=breakpoint-create,number=\"1\"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
"break-insert operation"
mi_gdb_test "201-break-insert basics.c:callee2" \
- "=breakpoint-create,number=\"2\"\r\n201\\^done" \
+ "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
"insert breakpoint at basics.c:callee2"
mi_gdb_test "202-break-insert basics.c:15" \
- "=breakpoint-create,number=\"3\"\r\n202\\^done" \
+ "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
"insert breakpoint at basics.c:15 (callee3)"
mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
- "=breakpoint-create,number=\"4\"\r\n203\\^done" \
+ "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
"insert breakpoint at \"<fullfilename>\":6 (callee4)"
mi_gdb_test "204-break-list" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
- "=breakpoint-modify,number=\"2\"\r\n=breakpoint-modify,number=\"3\"\r\n=breakpoint-modify,number=\"4\"\r\n205\\^done.*" \
+ "205\\^done.*" \
"disabling of breakpoints"
mi_gdb_test "206-break-info 2" \
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-set timeout 5
proc test_running_to_foo {} {
global mi_gdb_prompt
global hex
mi_gdb_test "200-break-insert 10" \
- "=breakpoint-create,number=\"1\"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
}
}
- mi_gdb_test "100-break-delete 1" "=breakpoint-delete,number=\"1\"\r\n100\\^done" "break-delete 1"
+ mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1"
}
send_gdb "222-exec-until 15\n"
gdb_expect {
- -re "222\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*222\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"15\"\}\r\n$mi_gdb_prompt$" {
+ -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"15\"\}\r\n$mi_gdb_prompt$" {
pass "until line number"
}
timeout {
send_gdb "333-exec-until until.c:17\n"
gdb_expect {
- -re "333\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*333\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"17\"\}\r\n$mi_gdb_prompt$" {
+ -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"17\"\}\r\n$mi_gdb_prompt$" {
pass "until line number:file"
}
timeout {
send_gdb "444-exec-until until.c:25\n"
gdb_expect {
- -re "444\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*444\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*until.c\",line=\"24\"\}\r\n$mi_gdb_prompt$" {
+ -re "444\\^running\r\n${mi_gdb_prompt}444\\*stopped,reason=\"location-reached\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*until.c\",line=\"24\"\}\r\n$mi_gdb_prompt$" {
pass "until after current function"
}
timeout {
#####
mi_gdb_test "-break-insert subroutine1" \
- "=breakpoint-create,number=\"2\"\r\n\\^done" \
+ "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \
"break-insert subroutine1"
mi_continue_to "2" "subroutine1" \
"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
# Test whether we can follow the name of a variable through multiple
# stack frames.
mi_gdb_test "-break-insert do_special_tests" \
- "=breakpoint-create,number=\"\[0-9\]+\"\r\n\\^done" \
+ {\^done,bkpt=.*} \
"set breakpoint at do_special_tests"
mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
"create selected_a"
mi_gdb_test "-break-insert incr_a" \
- "=breakpoint-create,number=\"\[0-9\]+\"\r\n\\^done" \
+ {\^done,bkpt=.*} \
"set breakpoint at incr_a"
mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
mi_gdb_load ${binfile}
mi_gdb_test "200-break-insert 260" \
- "=breakpoint-create,number=\"1\"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \
"break-insert operation"
mi_run_cmd
# Stop in "do_special_tests"
mi_gdb_test "200-break-insert do_special_tests" \
- "=breakpoint-create,number=\"2\"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \
"break-insert operation"
send_gdb "-exec-continue\n"
gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" {
+ -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" {
pass "continue to do_special_tests"
}
timeout {
}
mi_gdb_test "200-break-insert incr_a" \
- "=breakpoint-create,number=\"3\"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \
"break-insert operation"
send_gdb "-exec-continue\n"
gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" {
+ -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" {
pass "continue to incr_a"
}
- -re "\\^running\r\n${mi_gdb_prompt}(=breakpoint-.*\r\n)*\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" {
+ -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" {
fail "continue to incr_a (compiler debug info incorrect)"
}
-re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" {
# -break-list
mi_gdb_test "111-break-watch C" \
- "=breakpoint-create,number=\"2\"\r\n111\\^done" \
+ "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \
"break-watch operation"
mi_gdb_test "222-break-list" \
# -break-list
mi_gdb_test "333-break-watch -a A" \
- "=breakpoint-create,number=\"1\"\r\n333\\^done" \
+ "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
"break-watch -a operation"
mi_gdb_test "444-break-list" \
"list of watchpoints awatch"
mi_gdb_test "777-break-delete 3" \
- "=breakpoint-delete,number=\"3\"\r\n777\\^done" \
+ "777\\^done" \
"delete access watchpoint"
}
# -break-list
mi_gdb_test "200-break-watch -r C" \
- "=breakpoint-create,number=\"5"\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
"break-insert -r operation"
mi_gdb_test "300-break-list" \
"list of breakpoints"
mi_gdb_test "177-break-delete 4" \
- "=breakpoint-delete,number=\"4\"\r\n177\\^done" \
+ "177\\^done" \
"delete read watchpoint"
}
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
send_gdb "111-exec-return\n"
gdb_expect {
- -re "111\\^done,frame=\{level=\"0 \",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
+ -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
-re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
timeout { fail "return from callee4 now (timeout)"
}
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# -stack-list-frames 1 3
mi_gdb_test "231-stack-list-frames" \
- "231\\^done,stack=\\\[frame=\{level=\"0 \",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2 \",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3 \",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4 \",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+ "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
"stack frame listing"
mi_gdb_test "232-stack-list-frames 1 1" \
- "232\\^done,stack=\\\[frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
+ "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
"stack frame listing 1 1"
mi_gdb_test "233-stack-list-frames 1 3" \
- "233\\^done,stack=\\\[frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2 \",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3 \",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \
+ "233\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\}\\\]" \
"stack frame listing 1 3"
mi_gdb_test "234-stack-list-frames 1" \
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# Copyright 2002 Free Software Foundation, Inc.
-#
+# Copyright (C) 1999, 2000, 2002 Free Software Foundation
+
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-mi_gdb_test "200-break-insert do_children_tests" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"190\",times=\"0\"\}" \
- "break-insert operation"
-
-mi_run_cmd
-# The running part has been checked already by mi_run_cmd
-gdb_expect {
- -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"190\"\}\r\n$mi_gdb_prompt$" {
- pass "run to do_children_tests"
- }
- -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
- timeout {fail "run to do_children_tests (timeout 2)"}
-}
+mi_runto do_children_tests
##### #####
# #
# Step to "struct_declarations.integer = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"192\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
-
+set line 192
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line"
# Test: c_variable-4.81
# Desc: create local variable "weird"
"update all vars. None changed"
# Step over "struct_declarations.integer = 123;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"193\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 193
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.2
# Desc: check that integer changed
# weird->char_ptr = "hello";
# bar = 2121;
# foo = &bar;
-
-send_gdb "-exec-step 3\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"196\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 196
+mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
"update all vars struct_declarations.char_ptr"
# Step over "struct_declarations.int_ptr_ptr = &foo;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"197\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 197
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
"update all vars int_ptr_ptr and children changed"
# Step over "weird->long_array[0] = 1234;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"198\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 198
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
"update all vars struct_declarations.long_array.0 changed"
# Step over "struct_declarations.long_array[1] = 2345;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"199\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 199
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
"update all vars struct_declarations.long_array.1 changed"
# Step over "weird->long_array[2] = 3456;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"200\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 200
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
# struct_declarations.long_array[7] = 8901;
# weird->long_array[8] = 9012;
# struct_declarations.long_array[9] = 1234;
-send_gdb "-exec-step 7\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"208\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 208
+mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line"
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
# Step over "weird->func_ptr = nothing;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"211\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 211
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
# Step over all lines:
# ...
# psnp = &snp0;
-send_gdb "-exec-step 43\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"254\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 254
+mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line"
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
"get children of psnp->ptrs.0.next.next.ptrs"
# Step over "snp0.char_ptr = &b3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"255\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 255
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
"update all vars psnp->char_ptr (and 0.char_ptr) changed"
# Step over "snp1.char_ptr = &c3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"256\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
-
+set line 256
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
# Step over "snp2.char_ptr = &a3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"257\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
-
+set line 257
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
# Step over "snp0.long_ptr = &y3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"258\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
+set line 258
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
# Step over "snp1.long_ptr = &x3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"259\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
-
+set line 259
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
#
# Step over "snp2.long_ptr = &z3;"
-send_gdb "-exec-step\n"
-gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" {
- pass "step at do_children_tests"
- }
- timeout {
- fail "step at do_children_tests (timeout)"
- }
-}
-
+set line 260
+mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
"\\^done,value=\"3333\"" \
"assign to linteger"
+mi_gdb_test "-var-update *" \
+ "\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
+ "update all vars: linteger changed after assign"
+
+mi_gdb_test "-var-assign linteger 3333" \
+ "\\^done,value=\"3333\"" \
+ "assign to linteger again, same value"
+
+mi_gdb_test "-var-update *" \
+ "\\^done,changelist=\{\}" \
+ "update all vars: linteger not changed after same assign"
+
mi_gdb_test "-var-evaluate-expression linteger" \
"\\^done,value=\"3333\"" \
"eval linteger"
"\\^done,value=\"$hex\"" \
"assign to lpinteger"
+mi_gdb_test "-var-update *" \
+ "\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \
+ "update all vars: lpinteger changed after assign"
+
+mi_gdb_test "-var-update *" \
+ "\\^done,changelist=\{\}" \
+ "update all vars: no changes for second update"
+
mi_gdb_test "-var-evaluate-expression lpinteger" \
"\\^done,value=\"$hex\"" \
"eval lpinteger"
"\\^done,ndeleted=\"1\"" \
"delete var l"
+# Test whether we can follow the name of a variable through multiple
+# stack frames.
+mi_gdb_test "-break-insert do_special_tests" \
+ {\^done,bkpt=.*} \
+ "set breakpoint at do_special_tests"
+
+mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
+
+mi_gdb_test "-var-create selected_a @ a" \
+ {\^done,name="selected_a",numchild="0",type="int"} \
+ "create selected_a"
+
+mi_gdb_test "-break-insert incr_a" \
+ {\^done,bkpt=.*} \
+ "set breakpoint at incr_a"
+
+mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
+
+mi_gdb_test "-var-update selected_a" \
+ {\^done,changelist=\{name="selected_a",in_scope="true",new_type="char",new_num_children="0"\}} \
+ "update selected_a in incr_a"
+
+mi_next "step a line in incr_a"
+mi_next "return from incr_a to do_special_tests"
+
+mi_gdb_test "-var-update selected_a" \
+ {\^done,changelist=\{name="selected_a",in_scope="true",new_type="int",new_num_children="0"\}} \
+ "update selected_a in do_special_tests"
+
mi_gdb_exit
return 0
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
send_gdb "y\n";
exp_continue
}
- -re ".*102-break-delete\r\n(=.*)*102\\\^done\r\n$mi_gdb_prompt$" {
+ -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
# This happens if there were no breakpoints
}
timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return }
set test "mi runto $func"
mi_gdb_test "200-break-insert $func" \
- "\(=breakpoint-create,number=\"\[0-9\]+\")\r\n200\\^done" \
+ "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
"breakpoint at $func"
if {![regexp {number="[0-9]+"} $expect_out(buffer) str]
void *tidstr)
{
int num;
- ptid_t old_ptid;
struct thread_info *tp;
num = value_as_long (parse_and_eval (tidstr));
- old_ptid = inferior_ptid;
tp = find_thread_id (num);
if (!tp)
print_stack_frame (deprecated_selected_frame,
frame_relative_level (deprecated_selected_frame), 1);
-
- if (!ptid_equal (old_ptid, inferior_ptid))
- selected_thread_changed_event (pid_to_thread_id (inferior_ptid));
-
return GDB_RC_OK;
}
error ("Attempt to assign to an unmodifiable value.");
}
- if (regno > VALUE_FRAME_REGNUM (toval) + reg_offset)
- regno = -1;
if (register_changed_hook)
register_changed_hook (-1);
target_changed_event ();
-2003-02-03-cvs
+2003-02-04-cvs
#include "value.h"
#include "wrapper.h"
-/* use this struct to pass arguments to wrapper routines. We assume
+/* Use this struct to pass arguments to wrapper routines. We assume
(arbitrarily) that no gdb function takes more than ten arguments. */
struct gdb_wrapper_arguments
{
cargs->static_memfuncp, cargs->err);
return GDB_RC_OK;
}
+
#include "gdb.h"
struct value;
-struct block;
struct expression;
-struct ui_out;
-struct type;
+struct block;
/* Use this struct to pass arguments to wrapper routines. */
struct gdb_wrapper_arguments;
extern int gdb_value_ind (struct value *val, struct value ** rval);
extern int gdb_parse_and_eval_type (char *, int, struct type **);
+
#endif /* WRAPPER_H */