Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: gdb/testsuite/gdb.python/python.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.python/python.c ('k') | gdb/testsuite/gdb.reverse/Makefile.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. 1 # Copyright (C) 2008-2012 Free Software Foundation, Inc.
2 2
3 # This program is free software; you can redistribute it and/or modify 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 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 5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version. 6 # (at your option) any later version.
7 # 7 #
8 # This program is distributed in the hope that it will be useful, 8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 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/>. 14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 15
16 # This file is part of the GDB testsuite. It tests the mechanism 16 # This file is part of the GDB testsuite. It tests the mechanism
17 # exposing values to Python. 17 # exposing values to Python.
18 18
19 if $tracelevel then {
20 strace $tracelevel
21 }
22
23 load_lib gdb-python.exp 19 load_lib gdb-python.exp
24 20
25 set testfile "python" 21 standard_testfile python.c python-1.c
26 set srcfile ${testfile}.c
27 set srcfile1 ${testfile}-1.c
28 set binfile ${objdir}/${subdir}/${testfile}
29 22
30 if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1 }" \ 23 if {[build_executable $testfile.exp $testfile \
31 » ${binfile} executable {debug}] != "" } { 24 » [list $srcfile $srcfile2] debug] == -1} {
32 untested "Could not compile $binfile."
33 return -1 25 return -1
34 } 26 }
35 27
36 # Start with a fresh gdb. 28 # Start with a fresh gdb.
37 gdb_exit 29 gdb_exit
38 gdb_start 30 gdb_start
39 gdb_reinitialize_dir $srcdir/$subdir 31 gdb_reinitialize_dir $srcdir/$subdir
40 32
41 # Skip all tests if Python scripting is not enabled. 33 # Skip all tests if Python scripting is not enabled.
42 if { [skip_python_tests] } { continue } 34 if { [skip_python_tests] } { continue }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 -re "---Type <return>" { 105 -re "---Type <return>" {
114 exp_continue 106 exp_continue
115 } 107 }
116 -re " to continue, or q <return>" { 108 -re " to continue, or q <return>" {
117 exp_continue 109 exp_continue
118 } 110 }
119 -re " to quit---$" { 111 -re " to quit---$" {
120 pass $test 112 pass $test
121 } 113 }
122 } 114 }
123 gdb_test "q" "Quit" "verify pagination beforehand: q" 115 gdb_test "q" "Quit.*Error while executing Python.*" "verify pagination beforehan d: q"
124 116
125 gdb_test "python if gdb.execute('python print \"\\\\n\" * $lines', to_string=Tru e) == \"\\n\" * [expr $lines + 1]: print \"yes\"" "yes" "gdb.execute does not pa ge" 117 gdb_test "python if gdb.execute('python print \"\\\\n\" * $lines', to_string=Tru e) == \"\\n\" * [expr $lines + 1]: print \"yes\"" "yes" "gdb.execute does not pa ge"
126 118
127 set test "verify pagination afterwards" 119 set test "verify pagination afterwards"
128 gdb_test_multiple "python print \"\\n\" * $lines" $test { 120 gdb_test_multiple "python print \"\\n\" * $lines" $test {
129 -re "---Type <return>" { 121 -re "---Type <return>" {
130 exp_continue 122 exp_continue
131 } 123 }
132 -re " to continue, or q <return>" { 124 -re " to continue, or q <return>" {
133 exp_continue 125 exp_continue
134 } 126 }
135 -re " to quit---$" { 127 -re " to quit---$" {
136 pass $test 128 pass $test
137 } 129 }
138 } 130 }
139 gdb_test "q" "Quit" "verify pagination afterwards: q" 131 gdb_test "q" "Quit.*Error while executing Python.*" "verify pagination afterward s: q"
140 132
141 gdb_test_no_output "set height 0" 133 gdb_test_no_output "set height 0"
142 134
143 gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect hel p from uiout" 135 gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect hel p from uiout"
144 136
145 gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify hel p to uiout" 137 gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify hel p to uiout"
146 138
147 # Test PR 12212, using InfThread.selected_thread() when no inferior is 139 # Test PR 12212, using InfThread.selected_thread() when no inferior is
148 # loaded. 140 # loaded.
149 gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aqu ire thread with no inferior" 1 141 gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aqu ire thread with no inferior" 1
(...skipping 29 matching lines...) Expand all
179 gdb_test "python print symtab\[1\]\[0\].symtab" ".*gdb.python/python.c.*" "Test decode_line python.c:26 filename" 171 gdb_test "python print symtab\[1\]\[0\].symtab" ".*gdb.python/python.c.*" "Test decode_line python.c:26 filename"
180 gdb_test "python print symtab\[1\]\[0\].line" "26" "Test decode_line python.c:26 line number" 172 gdb_test "python print symtab\[1\]\[0\].line" "26" "Test decode_line python.c:26 line number"
181 173
182 gdb_test "python gdb.decode_line(\"randomfunc\")" \ 174 gdb_test "python gdb.decode_line(\"randomfunc\")" \
183 "gdb.error: Function \"randomfunc\" not defined.*" "test decode_line randomf unc" 175 "gdb.error: Function \"randomfunc\" not defined.*" "test decode_line randomf unc"
184 gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode _line func1()" 1 176 gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode _line func1()" 1
185 gdb_test "python print len(symtab)" "2" "Test decode_line func1 length" 177 gdb_test "python print len(symtab)" "2" "Test decode_line func1 length"
186 gdb_test "python print len(symtab\[1\])" "1" "Test decode_line func1 length" 178 gdb_test "python print len(symtab\[1\])" "1" "Test decode_line func1 length"
187 gdb_test "python print symtab\[1\]\[0\].symtab" ".*gdb.python/python-1.c.*" "Tes t decode_line func1 filename" 179 gdb_test "python print symtab\[1\]\[0\].symtab" ".*gdb.python/python-1.c.*" "Tes t decode_line func1 filename"
188 gdb_test "python print symtab\[1\]\[0\].line" "19" "Test decode_line func1 line number" 180 gdb_test "python print symtab\[1\]\[0\].line" "19" "Test decode_line func1 line number"
181 gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \
182 "test decode_line func1,func2" 1
183 gdb_test {python print symtab[0]} ",func2" "stop at comma in linespec"
189 184
190 # gdb.write 185 # gdb.write
191 gdb_test "python print sys.stderr" ".*__main__.GdbOutputErrorFile instance at.*" "Test stderr location" 186 gdb_test "python print sys.stderr" ".*__main__.GdbOutputErrorFile instance at.*" "Test stderr location"
192 gdb_test "python print sys.stdout" ".*__main__.GdbOutputFile instance at.*" "Tes t stdout location" 187 gdb_test "python print sys.stdout" ".*__main__.GdbOutputFile instance at.*" "Tes t stdout location"
193 gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "Test default write" 188 gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "Test default write"
194 gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error strea m" "Test stderr write" 189 gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error strea m" "Test stderr write"
195 gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal str eam" "Test stdout write" 190 gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal str eam" "Test stdout write"
196 gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" " Test stdlog write" 191 gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" " Test stdlog write"
197 192
198 # print-stack 193 # print-stack
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 "Test print-backtrace set setting" 1 356 "Test print-backtrace set setting" 1
362 357
363 gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { 358 gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
364 -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" { 359 -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" {
365 pass "set hook" 360 pass "set hook"
366 } 361 }
367 } 362 }
368 363
369 gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \ 364 gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \
370 "set the hook to default" 1 365 "set the hook to default" 1
366
367 # Start with a fresh gdb.
368 clean_restart ${testfile}
369
370 # The following tests require execution.
371
372 if ![runto_main] then {
373 fail "Can't run to main"
374 return 0
375 }
376
377 runto [gdb_get_line_number "Break at func2 call site."]
378
379 gdb_py_test_silent_cmd "python line = gdb.selected_frame().find_sal().line" "Get line number of func2 call site" 1
380 gdb_test "python print gdb.find_pc_line(gdb.selected_frame().pc()).line == line" "True" "Test find_pc_line at func2 call site"
381
382 gdb_py_test_silent_cmd "step" "Step into func2" 1
383 gdb_py_test_silent_cmd "up" "Step out of func2" 1
384
385 gdb_test "python print gdb.find_pc_line(gdb.selected_frame().pc()).line > line" "True" "Test find_pc_line with resume address"
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.python/python.c ('k') | gdb/testsuite/gdb.reverse/Makefile.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698