8d3788bd59
* annotate.c (breakpoint_changed): Adjust parameter type. * breakpoint.c (set_breakpoint_condition): Adjust to change in breakpoint_modified type. (breakpoint_set_commands): Likewise. (do_map_commands_command): Likewise. (bpstat_check_breakpoint_conditions): Notify that breakpoint has changed after bumping hit count. (bpstat_stop_status): Likewise. (print_one_breakpoint_location): Don't wrap in tuple here. (print_one_breakpoint): Always print individual locations. For locations, use unnamed tuple. (disable_breakpoints_in_unloaded_shlib): Notify that breakpoint has changed. (create_catchpoint, create_syscall_event_catchpoint): Call breakpoint_created obsever. (mention): Don't call breakpoint_created observer. (create_breakpoint_sal): Call breakpoint_created observer. (create_breakpoint, watch_command_1): Likewise. (create_ada_exception_breakpoint): Likewise. (delete_breakpoint): Call breakpoint_deleted breakpoint. (locations_are_equal): New. (update_breakpoint_locations): If locations were changed, notify. (set_ignore_count, disable_breakpoint, do_enable_breakpoint): Call breakpoint_modified observer. * mi/mi-cmd-break.c (breakpoint_notify): Adjust. (mi_cmd_break_insert): Don't set observers for modify and delete. * mi/mi-interp.c (mi_suppress_breakpoint_notifications): New. (mi_breakpoint_created, mi_breakpoint_deleted) (mi_breakpoint_modified): New. (mi_interpreter_init): Hook the above. * mi/mi-main.c (mi_cmd_execute): Disable breakpoint notifications while -break-* commands are executing. * mi/mi-main.h (mi_suppress_breakpoint_notifications): New. * mi/mi-out.c (struct ui_out_data): New field original_buffer. (mi_redirect): New. (mi_ui_out_impl): Hook in mi_redirect. (mi_field_skip): True to the name, skip the field, don't output a field with an empty value. * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted): Adjust. * tui/tui-hooks.c (tui_event_create_breakpoint) (tui_event_delete_breakpoint, tui_event_modify_breakpoint): Adjust.
182 lines
7.1 KiB
Text
182 lines
7.1 KiB
Text
# Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
|
|
# 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
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# 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.
|
|
|
|
load_lib mi-support.exp
|
|
set MIFLAGS "-i=mi2"
|
|
|
|
gdb_exit
|
|
if [mi_gdb_start] {
|
|
continue
|
|
}
|
|
|
|
set testfile "basics"
|
|
set srcfile ${testfile}.c
|
|
set binfile ${objdir}/${subdir}/mi2-cli
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
|
untested mi2-cli.exp
|
|
return -1
|
|
}
|
|
|
|
mi_gdb_test "-interpreter-exec" \
|
|
{\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \
|
|
"-interpreter-exec with no arguments"
|
|
|
|
mi_gdb_test "-interpreter-exec console" \
|
|
{\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \
|
|
"-interpreter-exec with one argument"
|
|
|
|
mi_gdb_test "-interpreter-exec bogus command" \
|
|
{\^error,msg="-interpreter-exec: could not find interpreter \\\"bogus\\\""} \
|
|
"-interpreter-exec with bogus interpreter"
|
|
|
|
set msg {Undefined command: \\\"bogus\\\"\. Try \\\"help\\\"\.}
|
|
mi_gdb_test "-interpreter-exec console bogus" \
|
|
"&\\\"$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\"" \
|
|
{~"Reading symbols from .*mi2-cli...".*\^done} \
|
|
"-interpreter-exec console \"file \$binfile\""
|
|
|
|
mi_run_to_main
|
|
|
|
set line_main_head [gdb_get_line_number "main ("]
|
|
set line_main_body [expr $line_main_head + 2]
|
|
set line_main_hello [gdb_get_line_number "Hello, World!"]
|
|
set line_main_return [expr $line_main_hello + 2]
|
|
set line_callee4_head [gdb_get_line_number "callee4 ("]
|
|
set line_callee4_body [expr $line_callee4_head + 2]
|
|
|
|
mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
|
|
{\^done} \
|
|
"-interpreter-exec console \"set args foobar\""
|
|
|
|
mi_gdb_test "-interpreter-exec console \"show args\"" \
|
|
{\~"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".*\^done} \
|
|
"-interpreter-exec console \"break callee4\""
|
|
|
|
mi_gdb_test "-interpreter-exec console \"info break\"" \
|
|
{\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \
|
|
"-interpreter-exec console \"info break\""
|
|
|
|
mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
|
|
{\^done} \
|
|
"-interpreter-exec console \"set listsize 1\""
|
|
|
|
# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
|
|
mi_gdb_test "-interpreter-exec console \"list\"" \
|
|
".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
|
|
"-interpreter-exec console \"list\""
|
|
|
|
mi_execute_to "exec-continue" "breakpoint-hit" "callee4" "" ".*basics.c" $line_callee4_body \
|
|
{ "" "disp=\"keep\"" } \
|
|
"continue to callee4"
|
|
|
|
# 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\"" \
|
|
{=breakpoint-deleted,id=\"2\"\r\n100\^done} \
|
|
"-interpreter-exec console \"delete 2\""
|
|
|
|
# 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\""
|
|
|
|
# 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\""
|
|
|
|
# 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\""
|
|
|
|
# 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"
|
|
|
|
# NOTE: cagney/2003-02-03: Not yet.
|
|
# mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \
|
|
# {.*=breakpoint-create,number="3".*\^done} \
|
|
# "-break-insert -t basics.c:\$line_main_hello"
|
|
mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \
|
|
{600\^done,bkpt=.number="3",type="breakpoint".*\}} \
|
|
"-break-insert -t basics.c:\$line_main_hello"
|
|
|
|
mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*basics.c" \
|
|
$line_main_hello { "" "disp=\"del\"" } \
|
|
"-exec-continue to line $line_main_hello"
|
|
|
|
mi_execute_to "exec-next" "end-stepping-range" "main" "" ".*basics.c" $line_main_return "" \
|
|
"-exec-next to line $line_main_return"
|
|
|
|
mi_gdb_test "-interpreter-exec console \"list\"" \
|
|
"\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \
|
|
"-interpreter-exec console \"list\" at basics.c:\$line_main_return"
|
|
|
|
mi_gdb_test "-interpreter-exec console \"help set args\"" \
|
|
{\~"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\""
|
|
|
|
# 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 \"\"" \
|
|
{} \
|
|
"-interpreter-exec console \"\""
|
|
|
|
mi_gdb_exit
|
|
return 0
|