Fix file name matching on remote host.

I see the following fails in the remote host testing we do for mingw32
hosted GDB,

python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line current locationn filename

python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line python.c:26 filename

The test cases doesn't consider remote host and assumes that directory
on build also exists on host.  In this patch, we only match file base
name if host is remote, otherwise, match file with dir name.

gdb/testsuite:

2014-10-15  Yao Qi  <yao@codesourcery.com>

	* gdb.python/py-symbol.exp: Match file base name if host is
	remote, otherwise match file name with dir name.
	* gdb.python/py-symtab.exp: Likewise.
	* gdb.python/python.exp: Likewise.
This commit is contained in:
Yao Qi 2014-09-15 17:40:54 +08:00
parent 46dc139462
commit 65d7b369af
4 changed files with 39 additions and 7 deletions

View file

@ -189,14 +189,20 @@ gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line cur
gdb_test "python print (len(symtab))" "2" "Test decode_line current location"
gdb_test "python print (symtab\[0\])" "None" "Test decode_line expression parse"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line current location"
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python.c" "Test decode_line current location filename"
if { [is_remote host] } {
set python_c [string_to_regexp "python.c"]
} else {
set python_c [string_to_regexp "gdb.python/python.c"]
}
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line current location filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "Test decode_line current location line number"
gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26" 1
gdb_test "python print (len(symtab))" "2" "Test decode_line python.c:26 length"
gdb_test "python print (symtab\[0\])" "if foo" "Test decode_line expression parse"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line python.c:26 length"
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python.c" "Test decode_line python.c:26 filename"
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "Test decode_line python.c:26 filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "26" "Test decode_line python.c:26 line number"
gdb_test "python gdb.decode_line(\"randomfunc\")" \
@ -204,7 +210,13 @@ gdb_test "python gdb.decode_line(\"randomfunc\")" \
gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode_line func1()" 1
gdb_test "python print (len(symtab))" "2" "Test decode_line func1 length"
gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line func1 length"
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*gdb.python/python-1.c" "Test decode_line func1 filename"
if { [is_remote host] } {
set python_1_c [string_to_regexp "python-1.c"]
} else {
set python_1_c [string_to_regexp "gdb.python/python-1.c"]
}
gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "Test decode_line func1 filename"
gdb_test "python print (symtab\[1\]\[0\].line)" "19" "Test decode_line func1 line number"
gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \
"test decode_line func1,func2" 1