e7ea3ec7c6
When gdb is started in MI mode, the output of gdb.execute command is in MI-format in case when it is executed from python stop handler while for all other cases the output is in console-format. To assure consistent output format, this is fixed by using the console format for all python gdb command executions. PR python/19743 gdb/ChangeLog: 2016-03-31 Catalin Udma <catalin.udma@freescale.com> PR python/19743 * python/python.c (execute_gdb_command): Use console uiout when executing gdb command. * utils.c (restore_ui_out_closure): New structure. (do_restore_ui_out): New function. (make_cleanup_restore_ui_out): Likewise. * utils.h (make_cleanup_restore_ui_out): Declare. gdb/testsuite/ChangeLog: 2016-03-31 Catalin Udma <catalin.udma@freescale.com> PR python/19743 * gdb.python/py-mi-events-gdb.py: New file. * gdb.python/py-mi-events.c: New file. * gdb.python/py-mi-events.exp: New file. Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
84 lines
2.6 KiB
Text
84 lines
2.6 KiB
Text
# Copyright (C) 2008-2016 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 is part of the GDB testsuite. It tests PR 19743.
|
|
|
|
load_lib mi-support.exp
|
|
set MIFLAGS "-i=mi2"
|
|
|
|
gdb_exit
|
|
if [mi_gdb_start] {
|
|
continue
|
|
}
|
|
|
|
standard_testfile
|
|
set pyfile ${testfile}-gdb.py
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
untested ${testfile}.exp
|
|
return -1
|
|
}
|
|
|
|
if { [mi_skip_python_tests] } { continue }
|
|
|
|
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
|
|
|
|
mi_delete_breakpoints
|
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
|
mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
|
|
{.*\^done} \
|
|
"set safe-path"
|
|
|
|
if [is_remote host] {
|
|
set filename ${testfile}
|
|
remote_download host ${binfile} ${filename}
|
|
} else {
|
|
set filename ${binfile}
|
|
}
|
|
|
|
mi_gdb_test "-file-exec-and-symbols ${filename}" ".*\\^done" "file-exec-and-symbols operation"
|
|
mi_run_to_main
|
|
|
|
|
|
# register the python event handlers with test-events command
|
|
mi_gdb_test "test-events" \
|
|
".*~\"Event testers registered.*\\^done" \
|
|
"register events"
|
|
|
|
|
|
# set a breakpoint into the for loop
|
|
mi_gdb_test "break ${srcfile}:[gdb_get_line_number "i++;"]" \
|
|
".*Breakpoint $decimal at 0x\[0-9a-fA-F\]+: file .*${srcfile}.*\\\.*\\^done" \
|
|
"set the breakpoint"
|
|
|
|
|
|
# resume the program
|
|
mi_send_resuming_command "exec-continue" "continue"
|
|
|
|
|
|
# test the python event handlers execution. The following checks are performed:
|
|
# - python continue handler is executed
|
|
# - the continue handler prints "info breakpoints" output in console format
|
|
# - breakpoint is hit and python stop handler is executed
|
|
# - the stop handler prints "info breakpoints" output in console format
|
|
mi_gdb_test "" ".*continue_handler.*
|
|
.*Num.*Type.*Disp.*Enb.*Address.*\
|
|
.*$decimal.*breakpoint.*keep.*y.* 0x\[0-9a-fA-F\]+.*${srcfile}.*
|
|
.*stop_handler.*
|
|
.*Num.*Type.*Disp.*Enb.*Address.*\
|
|
.*$decimal.*breakpoint.*keep.*y.* 0x\[0-9a-fA-F\]+.*${srcfile}.*" \
|
|
"check python continue and stop handlers"
|
|
|
|
mi_gdb_exit
|