OLD | NEW |
(Empty) | |
| 1 # Copyright 2012 Free Software Foundation, Inc. |
| 2 |
| 3 # This program is free software; you can redistribute it and/or modify |
| 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. |
| 7 # |
| 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. |
| 12 # |
| 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
| 16 load_lib mi-support.exp |
| 17 set MIFLAGS "-i=mi" |
| 18 |
| 19 gdb_exit |
| 20 if [mi_gdb_start] { |
| 21 continue |
| 22 } |
| 23 |
| 24 standard_testfile basics.c |
| 25 set opts {debug} |
| 26 |
| 27 if [build_executable $testfile.exp $testfile $srcfile $opts] { |
| 28 untested mi-logging.exp |
| 29 return -1; |
| 30 } |
| 31 |
| 32 if {[mi_run_to_main] < 0} { |
| 33 return -1 |
| 34 } |
| 35 |
| 36 set milogfile "milog.txt" |
| 37 |
| 38 mi_gdb_test "-gdb-set logging file $milogfile" ".*" |
| 39 |
| 40 mi_gdb_test "-gdb-set logging overwrite on" ".*" |
| 41 |
| 42 mi_gdb_test "-gdb-set logging on" ".*" "logging on" |
| 43 |
| 44 mi_step "logged step" |
| 45 |
| 46 mi_next "logged next" |
| 47 |
| 48 mi_gdb_test "-gdb-set logging off" ".*" "logging off" |
| 49 |
| 50 set chan [open $milogfile] |
| 51 set logcontent [read $chan] |
| 52 close $chan |
| 53 |
| 54 set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" |
| 55 |
| 56 if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-i
d=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\
n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_lo
g_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $log
content] { |
| 57 pass "Log file contents" |
| 58 } else { |
| 59 fail "Log file contents" |
| 60 } |
| 61 |
| 62 # Now try the redirect, which writes into the file only. |
| 63 |
| 64 mi_gdb_test "-gdb-set logging redirect on" ".*" "redirect logging on" |
| 65 |
| 66 # Since all output will be going into the file, just keep sending commands |
| 67 # and don't expect anything to appear until logging is turned off. |
| 68 |
| 69 send_gdb "1001-gdb-set logging on\n" |
| 70 send_gdb "1002-exec-step\n" |
| 71 send_gdb "1003-exec-next\n" |
| 72 |
| 73 mi_gdb_test "1004-gdb-set logging off" ".*" "redirect logging off" |
| 74 |
| 75 set chan [open $milogfile] |
| 76 set logcontent [read $chan] |
| 77 close $chan |
| 78 |
| 79 if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*runnin
g,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range
\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\
"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_
log_prompt" $logcontent] { |
| 80 pass "Redirect log file contents" |
| 81 } else { |
| 82 fail "Redirect log file contents" |
| 83 } |
| 84 |
| 85 mi_gdb_exit |
| 86 |
| 87 remote_file host delete $milogfile |
OLD | NEW |