* lib/gdb.exp (build_id_debug_filename_get): New function.
* gdb.base/sepdebug.exp: Reflect the changes in the heading comment. Remove the generate DEBUG file for the future testcase runs. New testcase for the NT_GNU_BUILD_ID retrieval. Move the final testing step to ... (test_different_dir): ... a new function. New parameter XFAIL to XFAIL all the tests performed. New parameter TEST_DIFFERENT_DIR parametrizing the directory. New parameter TYPE to PF_PREFIX all the tests performed.
This commit is contained in:
parent
399347457c
commit
4935890f4d
|
@ -1,3 +1,15 @@
|
|||
2007-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* lib/gdb.exp (build_id_debug_filename_get): New function.
|
||||
* gdb.base/sepdebug.exp: Reflect the changes in the heading comment.
|
||||
Remove the generate DEBUG file for the future testcase runs.
|
||||
New testcase for the NT_GNU_BUILD_ID retrieval.
|
||||
Move the final testing step to ...
|
||||
(test_different_dir): ... a new function.
|
||||
New parameter XFAIL to XFAIL all the tests performed.
|
||||
New parameter TEST_DIFFERENT_DIR parametrizing the directory.
|
||||
New parameter TYPE to PF_PREFIX all the tests performed.
|
||||
|
||||
2007-08-31 Vladimir Prus <vladimir@codesourcery.com>
|
||||
|
||||
* gdb.mi/mi-var-cp.cc (path_expression): New
|
||||
|
|
|
@ -19,11 +19,14 @@
|
|||
|
||||
# Based on break.exp, written by Rob Savoye. (rob@cygnus.com)
|
||||
# Modified to test gdb's handling of separate debug info files.
|
||||
# Modified to test gdb's handling of a debug-id retrieval.
|
||||
|
||||
# This file has two parts. The first is testing that gdb behaves
|
||||
# normally after reading in an executable and its corresponding
|
||||
# separate debug file. The second moves the .debug file to a different
|
||||
# location and tests the "set debug-file-directory" command.
|
||||
# The third is for testing build-id retrievel by finding the separate
|
||||
# ".debug-id/ab/cdef.debug" file.
|
||||
|
||||
|
||||
if $tracelevel then {
|
||||
|
@ -828,14 +831,17 @@ test_next_with_recursion
|
|||
|
||||
#********
|
||||
|
||||
# now move the .debug file to a different location so that we can test
|
||||
# the "set debug-file-directory" command.
|
||||
proc test_different_dir {type test_different_dir xfail} {
|
||||
global srcdir subdir objdir binfile srcfile timeout gdb_prompt
|
||||
global pf_prefix
|
||||
global bp_location6 decimal hex
|
||||
|
||||
set pf_prefix "$type:"
|
||||
|
||||
remote_exec build "mv ${objdir}/${subdir}/.debug/${testfile}.debug ${objdir}/${subdir}"
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_test "set debug-file-directory ${objdir}/${subdir}" ".*" "set separate debug location"
|
||||
gdb_test "set debug-file-directory ${test_different_dir}" ".*" "set separate debug location"
|
||||
gdb_load ${binfile}
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
|
@ -845,6 +851,9 @@ if [target_info exists gdb_stub] {
|
|||
#
|
||||
# test break at function
|
||||
#
|
||||
if {$xfail} {
|
||||
setup_xfail "*-*-*"
|
||||
}
|
||||
gdb_test "break main" \
|
||||
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
||||
"breakpoint function, optimized file"
|
||||
|
@ -852,6 +861,9 @@ gdb_test "break main" \
|
|||
#
|
||||
# test break at function
|
||||
#
|
||||
if {$xfail} {
|
||||
setup_xfail "*-*-*"
|
||||
}
|
||||
gdb_test "break marker4" \
|
||||
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
||||
"breakpoint small function, optimized file"
|
||||
|
@ -860,6 +872,9 @@ gdb_test "break marker4" \
|
|||
# run until the breakpoint at main is hit. For non-stubs-using targets.
|
||||
#
|
||||
gdb_run_cmd
|
||||
if {$xfail} {
|
||||
setup_xfail "*-*-*"
|
||||
}
|
||||
gdb_expect {
|
||||
-re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
|
||||
pass "run until function breakpoint, optimized file"
|
||||
|
@ -891,6 +906,9 @@ gdb_expect {
|
|||
set bp_location13 [gdb_get_line_number "set breakpoint 13 here"]
|
||||
set bp_location14 [gdb_get_line_number "set breakpoint 14 here"]
|
||||
send_gdb "continue\n"
|
||||
if {$xfail} {
|
||||
setup_xfail "*-*-*"
|
||||
}
|
||||
gdb_expect {
|
||||
-re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
|
||||
pass "run until breakpoint set at small function, optimized file"
|
||||
|
@ -918,3 +936,47 @@ if [istarget "*-*-vxworks*"] {
|
|||
send_gdb "set args main\n"
|
||||
gdb_expect -re ".*$gdb_prompt $" {}
|
||||
}
|
||||
|
||||
unset pf_prefix
|
||||
# proc test_different_dir
|
||||
}
|
||||
|
||||
|
||||
# now move the .debug file to a different location so that we can test
|
||||
# the "set debug-file-directory" command.
|
||||
|
||||
remote_exec build "mv ${objdir}/${subdir}/.debug/${testfile}.debug ${objdir}/${subdir}"
|
||||
set debugfile "${objdir}/${subdir}/${testfile}.debug"
|
||||
|
||||
test_different_dir debuglink "${objdir}/${subdir}" 0
|
||||
|
||||
|
||||
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
|
||||
|
||||
set build_id_debug_filename [build_id_debug_filename_get $binfile]
|
||||
if {$build_id_debug_filename eq ""} {
|
||||
unsupported "build-id is not supported by the compiler"
|
||||
|
||||
# Spare debug files may confuse testsuite runs in the future.
|
||||
remote_exec build "rm -f $debugfile"
|
||||
} else {
|
||||
set build_id_debugself_filename [build_id_debug_filename_get $debugfile]
|
||||
set test "build-id support by binutils"
|
||||
set xfail 0
|
||||
if {$build_id_debugself_filename eq ""} {
|
||||
unsupported $test
|
||||
set xfail 1
|
||||
} elseif {$build_id_debugself_filename ne $build_id_debug_filename} {
|
||||
fail $test
|
||||
} else {
|
||||
pass $test
|
||||
}
|
||||
|
||||
file mkdir [file dirname ${objdir}/${subdir}/${build_id_debug_filename}]
|
||||
remote_exec build "mv $debugfile ${objdir}/${subdir}/${build_id_debug_filename}"
|
||||
|
||||
test_different_dir build-id "${objdir}/${subdir}" $xfail
|
||||
|
||||
# Spare debug files may confuse testsuite runs in the future.
|
||||
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
|
||||
}
|
||||
|
|
|
@ -2482,6 +2482,27 @@ proc separate_debug_filename { exec } {
|
|||
return $debug_file
|
||||
}
|
||||
|
||||
# Return the build-id hex string (usually 160 bits as 40 hex characters)
|
||||
# converted to the form: .build-id/ab/cdef1234...89.debug
|
||||
# Return "" if no build-id found.
|
||||
proc build_id_debug_filename_get { exec } {
|
||||
set tmp "${exec}-tmp"
|
||||
exec objcopy -j .note.gnu.build-id -O binary $exec $tmp
|
||||
set fi [open $tmp]
|
||||
# Skip the NOTE header.
|
||||
read $fi 16
|
||||
set data [read $fi]
|
||||
close $fi
|
||||
file delete $tmp
|
||||
if {$data eq ""} {
|
||||
return ""
|
||||
}
|
||||
# Convert it to hex.
|
||||
binary scan $data H* data
|
||||
set data [regsub {^..} $data {\0/}]
|
||||
return ".build-id/${data}.debug";
|
||||
}
|
||||
|
||||
# Create stripped files for DEST, replacing it. If ARGS is passed, it is a
|
||||
# list of optional flags. The only currently supported flag is no-main,
|
||||
# which removes the symbol entry for main from the separate debug file.
|
||||
|
|
Loading…
Reference in New Issue