f8237e75c6f03da8e10be64c7d6078377c12e0de
[external/binutils.git] / gdb / testsuite / gdb.trace / infotrace.exp
1 #   Copyright 1998, 2007-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 # This file was written by Michael Snyder (msnyder@cygnus.com)
17
18 load_lib "trace-support.exp";
19
20 if $tracelevel then {
21     strace $tracelevel
22 }
23
24
25 gdb_exit
26 gdb_start
27
28 set testfile "actions"
29 set srcfile ${testfile}.c
30 set binfile $objdir/$subdir/infotrace
31 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
32           executable {debug nowarnings}] != "" } {
33     untested infotrace.exp
34     return -1
35 }
36 gdb_reinitialize_dir $srcdir/$subdir
37
38 # If testing on a remote host, download the source file.
39 # remote_download host $srcdir/$subdir/$srcfile
40
41 gdb_file_cmd $binfile
42
43 #
44 # test "info tracepoints" command
45 #
46
47 gdb_delete_tracepoints
48 set c_test_num [gdb_gettpnum gdb_c_test];
49 set asm_test_num [gdb_gettpnum gdb_asm_test];
50 if { $c_test_num <= 0 || $asm_test_num <= 0 } then {
51     fail "setting tracepoints"
52     return;
53 }
54
55 # 2.1 info tracepoints (all)
56 gdb_test "info tracepoints" \
57     "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
58 \[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
59 \[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+." \
60     "2.1: info tracepoints (all)"
61
62 # 2.2 info tracepoint (specific)
63 gdb_test "info tracepoint $c_test_num" \
64     "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
65 \[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+." \
66     "2.2a: info tracepoint $c_test_num (gdb_c_test)"
67
68 gdb_test "info tracepoint $asm_test_num" \
69     "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
70 \[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+." \
71     "2.2b: info tracepoint $asm_test_num (gdb_asm_test)"
72
73 # 2.3 info tracepoint (invalid tracepoint number)
74 gdb_test "info tracepoint [expr $c_test_num + $asm_test_num]" \
75     "No tracepoint matching '[expr $c_test_num + $asm_test_num]'." \
76     "2.3: info tracepoint (invalid tracepoint number)"
77
78 # 2.4 info tracepoints (list of numbers)
79 gdb_test_multiple "info tracepoints $c_test_num $asm_test_num " \
80     "2.4: info trace rejects multiple tracepoint numbers" {
81         -re "Num Enb .*$gdb_prompt $" {
82             fail "2.4: info trace rejects multiple tracepoint numbers"
83         }
84         -re ".*$gdb_prompt $" {
85             pass "2.4: info trace rejects multiple tracepoint numbers"
86         }
87     }
88
89 # 2.5 help info trace
90 gdb_test "help info tracepoints" \
91     "Status of specified tracepoints .all tracepoints if no argument.*" \
92     "2.5: help info tracepoints"
93