fix gdb.python to be parallel-safe

This fixes gdb.python to be parallel-safe, mostly by changing it to
use gdb_remote_download.

Tested on x86-64 Fedora 18.

	* gdb.python/py-error.exp: Use gdb_remote_download.
	* gdb.python/py-mi.exp: Use gdb_remote_download.
	* gdb.python/py-objfile-script.exp: Use standard_output_file.
	* gdb.python/py-prettyprint.exp: Use gdb_remote_download.
	(run_lang_tests): Likewise.
	* gdb.python/py-section-script.c: Use SCRIPT_FILE rather than
	filename.
	* gdb.python/py-section-script.exp: Set SCRIPT_FILE when
	compiling.  Use gdb_remote_download.  Update some tests.
	* gdb.python/py-strfns.exp (test_strfns_core_file): Use
	standard_output_file.
	* gdb.python/py-typeprint.exp: Use gdb_remote_download.
	* gdb.python/py-frame-args.exp: Use gdb_remote_download.
	* gdb.python/py-framefilter-mi.exp: Use gdb_remote_download.
	* gdb.python/py-framefilter.exp: Use gdb_remote_download,
	standard_output_file.
This commit is contained in:
Tom Tromey 2013-08-22 13:51:08 +00:00
parent 16cfcbc202
commit 8448e842cd
12 changed files with 62 additions and 26 deletions

View File

@ -1,3 +1,22 @@
2013-08-22 Tom Tromey <tromey@redhat.com>
* gdb.python/py-error.exp: Use gdb_remote_download.
* gdb.python/py-mi.exp: Use gdb_remote_download.
* gdb.python/py-objfile-script.exp: Use standard_output_file.
* gdb.python/py-prettyprint.exp: Use gdb_remote_download.
(run_lang_tests): Likewise.
* gdb.python/py-section-script.c: Use SCRIPT_FILE rather than
filename.
* gdb.python/py-section-script.exp: Set SCRIPT_FILE when
compiling. Use gdb_remote_download. Update some tests.
* gdb.python/py-strfns.exp (test_strfns_core_file): Use
standard_output_file.
* gdb.python/py-typeprint.exp: Use gdb_remote_download.
* gdb.python/py-frame-args.exp: Use gdb_remote_download.
* gdb.python/py-framefilter-mi.exp: Use gdb_remote_download.
* gdb.python/py-framefilter.exp: Use gdb_remote_download,
standard_output_file.
2013-08-22 Tom Tromey <tromey@redhat.com>
* lib/cell.exp (skip_cell_tests): Use standard_temp_file.

View File

@ -48,7 +48,8 @@ if {$test2 == ""} {
return 0
}
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
# argc=LookupError: unknown encoding: IBM1047
gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2

View File

@ -26,9 +26,11 @@ if ![runto_main] {
return -1
}
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
"python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"

View File

@ -44,7 +44,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
mi_runto main
set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
mi_gdb_test "python execfile ('${remote_python_file}')" ".*\\^done." \
"Load python file"

View File

@ -39,7 +39,7 @@ if { [skip_python_tests] } { continue }
set remote_obj_python_file \
[remote_download \
host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
${subdir}/${testfile}-gdb.py]
[standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
@ -57,7 +57,8 @@ gdb_test_no_output "set python print-stack full" \
"Set python print-stack to full"
# Load global frame-filters
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')" \
"Load python file"
@ -199,7 +200,7 @@ if { [skip_python_tests] } { continue }
set remote_obj_python_file \
[remote_download \
host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
${subdir}/${testfile}-gdb.py]
[standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
@ -218,7 +219,8 @@ gdb_test_no_output "set python print-stack full" \
"set python print-stack full for no debuginfo tests"
# Load global frame-filters
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')" \
"Load python file for no debuginfo tests"

View File

@ -42,7 +42,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
mi_runto main
set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ""

View File

@ -32,7 +32,9 @@ if { [skip_python_tests] } { continue }
# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
# Care is taken to put it in the same directory as the binary so that
# gdb will find it.
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in ${subdir}/${testfile}-gdb.py]
set remote_python_file [remote_download host \
${srcdir}/${subdir}/${testfile}-gdb.py.in \
[standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"

View File

@ -53,9 +53,11 @@ proc run_lang_tests {exefile lang} {
".*Breakpoint.*"
gdb_test "continue" ".*Breakpoint.*"
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
"python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
@ -123,9 +125,11 @@ if ![runto_main ] then {
return
}
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
"python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_breakpoint [gdb_get_line_number "eval-break"]
gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"

View File

@ -26,7 +26,7 @@
.popsection \n\
");
DEFINE_GDB_SCRIPT ("py-section-script.py")
DEFINE_GDB_SCRIPT (SCRIPT_FILE)
struct ss
{

View File

@ -31,7 +31,15 @@ if {![istarget *-*-linux*]
standard_testfile
if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
# Make this available to gdb before the program starts, it is
# automagically loaded by gdb.
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
set quoted_name "\"$remote_python_file\""
if {[build_executable $testfile.exp $testfile $srcfile \
[list debug additional_flags=-DSCRIPT_FILE=$quoted_name]] == -1} {
return -1
}
@ -42,18 +50,14 @@ gdb_start
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
# Make this available to gdb before the program starts, it is
# automagically loaded by gdb.
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
gdb_load ${binfile}
# Verify gdb loaded the script.
gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*"
# Again, with a regexp this time.
gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*"
# Again, with a regexp that matches no scripts.
gdb_test "info auto-load python-scripts no-script-matches-this" \
"No auto-load scripts matching no-script-matches-this."

View File

@ -64,9 +64,9 @@ gdb_test "p /d {char\[4\]} arg" "= \\{0, 1, 2, 4\\}"
# Verify use on a core file.
proc test_strfns_core_file { } {
global objdir subdir gdb_prompt testfile
global gdb_prompt testfile
set filename "${objdir}/${subdir}/py-strfns.core"
set filename [standard_output_file py-strfns.core]
if {![gdb_gcore_cmd "$filename" "save a corefile"]} {
# No use proceeding from here.

View File

@ -26,9 +26,11 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
if { [skip_python_tests] } { continue }
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
"python exec (open ('[file tail ${remote_python_file}]').read ())"
cp_test_ptype_class s "basic test" "class" "templ<string>" {
{ field public "T x;" }