6571a38156
PR cli/18053 concerns a couple of minor bugs in the JIT debuginfo support. First, jit-reader-load should use filename completion and support tilde expansion. Second, the help for jit-reader-unload is incorrect. While working on this I also realized that jit-reader-unload should use the no-op completer, so I've included that as well. Built and regtested on x86-64 Fedora 23. A completer test for jit-reader-load is included, but not a tilde-expansion test, as I couldn't think of a reliable way to test that. 2016-07-13 Tom Tromey <tom@tromey.com> PR cli/18053: * jit.c (jit_reader_load_command): Use tilde_expand. (_initialize_jit): Fix help for jit-reader-unload. Set completer for new commands. 2016-07-13 Tom Tromey <tom@tromey.com> PR cli/18053: * gdb.base/jit-so.exp (one_jit_test): Add jit-reader-load completion test.
126 lines
4.3 KiB
Text
126 lines
4.3 KiB
Text
# Copyright 2011-2016 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# The same tests as in jit.exp, but loading JITer itself from a shared
|
|
# library.
|
|
|
|
if {[skip_shlib_tests]} {
|
|
untested jit-so.exp
|
|
return -1
|
|
}
|
|
|
|
if {[get_compiler_info]} {
|
|
warning "Could not get compiler info"
|
|
untested jit-so.exp
|
|
return 1
|
|
}
|
|
|
|
#
|
|
# test running programs
|
|
#
|
|
|
|
set testfile jit-dlmain
|
|
set srcfile ${testfile}.c
|
|
set binfile [standard_output_file ${testfile}]
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
|
|
untested jit-so.exp
|
|
return -1
|
|
}
|
|
|
|
set testfile2 jit-main
|
|
set srcfile2 ${testfile2}.c
|
|
set binfile2 [standard_output_file ${testfile2}.so]
|
|
set binfile2_dlopen [shlib_target_file ${testfile2}.so]
|
|
if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug additional_flags="-DMAIN=jit_dl_main"}] != "" } {
|
|
untested jit.exp
|
|
return -1
|
|
}
|
|
|
|
set solib_testfile "jit-solib"
|
|
set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c"
|
|
set solib_binfile [standard_output_file ${solib_testfile}.so]
|
|
set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}.so"
|
|
|
|
# Note: compiling without debug info: the library goes through symbol
|
|
# renaming by munging on its symbol table, and that wouldn't work for .debug
|
|
# sections. Also, output for "info function" changes when debug info is resent.
|
|
if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
|
|
untested jit-so.exp
|
|
return -1
|
|
}
|
|
|
|
set solib_binfile_target [gdb_remote_download target ${solib_binfile}]
|
|
|
|
proc one_jit_test {count match_str} {
|
|
with_test_prefix "one_jit_test-$count" {
|
|
global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
|
|
|
|
clean_restart $testfile
|
|
gdb_load_shlib $binfile2
|
|
|
|
# This is just to help debugging when things fail
|
|
if {$verbose > 0} {
|
|
gdb_test "set debug jit 1"
|
|
}
|
|
|
|
if { ![runto_main] } {
|
|
fail "Can't run to main"
|
|
return
|
|
}
|
|
|
|
gdb_breakpoint [gdb_get_line_number "break here before-dlopen" ]
|
|
gdb_continue_to_breakpoint "break here before-dlopen"
|
|
# Poke desired values directly into inferior instead of using "set args"
|
|
# because "set args" does not work under gdbserver.
|
|
gdb_test_no_output "set var jit_libname = \"$binfile2_dlopen\""
|
|
|
|
gdb_breakpoint [gdb_get_line_number "break here after-dlopen" ]
|
|
gdb_continue_to_breakpoint "break here after-dlopen"
|
|
|
|
gdb_breakpoint "$srcfile2:[gdb_get_line_number {break here 0} $srcfile2]"
|
|
gdb_continue_to_breakpoint "break here 0"
|
|
|
|
gdb_test_no_output "set var argc = 2"
|
|
gdb_test_no_output "set var libname = \"$solib_binfile_target\"" "set var libname = \"$solib_binfile_test_msg\""
|
|
gdb_test_no_output "set var count = $count"
|
|
|
|
gdb_breakpoint "$srcfile2:[gdb_get_line_number {break here 1} $srcfile2]"
|
|
gdb_continue_to_breakpoint "break here 1"
|
|
|
|
gdb_test "info function jit_function" "$match_str"
|
|
|
|
# This is just to help debugging when things fail
|
|
if {$verbose > 0} {
|
|
gdb_test "maintenance print objfiles"
|
|
gdb_test "maintenance info break"
|
|
}
|
|
|
|
gdb_breakpoint "$srcfile2:[gdb_get_line_number {break here 2} $srcfile2]"
|
|
gdb_continue_to_breakpoint "break here 2"
|
|
# All jit librares must have been unregistered
|
|
gdb_test "info function jit_function" \
|
|
"All functions matching regular expression \"jit_function\":"
|
|
}
|
|
}
|
|
|
|
one_jit_test 1 "${hex} jit_function_0000"
|
|
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
|
|
|
|
# We don't intend to load the .so as a JIT debuginfo reader, but we
|
|
# need some handy file name for a completion test.
|
|
gdb_test \
|
|
"complete jit-reader-load [standard_output_file ${solib_testfile}.s]" \
|
|
"jit-reader-load $solib_binfile" \
|
|
"test jit-reader-load filename completion"
|