aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp12
-rw-r--r--gdb/testsuite/lib/future.exp11
-rw-r--r--gdb/testsuite/lib/gdb.exp53
4 files changed, 57 insertions, 26 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e01f883..c564c66 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-06-10 Jon Turney <jon.turney@dronecode.org.uk>
+
+ * gdb.base/sepdebug.exp: Add EXEEXT where needed.
+ * lib/gdb.exp (get_build_id): Teach how to extract build-id from a
+ PE file.
+ * lib/future.exp (gdb_find_objdump): Add gdb_find_objdump.
+
2015-06-12 Antoine Tremblay <antoine.tremblay@ericsson.com>
PR breakpoints/16465
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 3194377..c363be4 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# the name of a debuginfo only file. This file will be stored in the
# gdb.base/ subdirectory.
-if [gdb_gnu_strip_debug $binfile] {
+if [gdb_gnu_strip_debug $binfile$EXEEXT] {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
@@ -60,7 +60,7 @@ set new_name [standard_output_file ${testfile}${EXEEXT}]
remote_exec build "rm -rf [file dirname $new_name]"
remote_exec build "mkdir [file dirname $new_name]"
-remote_exec build "ln -s ${binfile} $new_name"
+remote_exec build "ln -s ${binfile}${EXEEXT} $new_name"
clean_restart ${testfile}${EXEEXT}
if { $gdb_file_cmd_debug_info != "debug" } then {
fail "No debug information found."
@@ -716,10 +716,10 @@ proc test_different_dir {type test_different_dir xfail} {
# the "set debug-file-directory" command.
set different_dir [standard_output_file ${testfile}.dir]
-set debugfile "${different_dir}/[standard_output_file ${testfile}.debug]"
+set debugfile "${different_dir}/[standard_output_file ${testfile}${EXEEXT}.debug]"
remote_exec build "rm -rf $different_dir"
remote_exec build "mkdir -p [file dirname $debugfile]"
-remote_exec build "mv -f [standard_output_file ${testfile}.debug] $debugfile"
+remote_exec build "mv -f [standard_output_file ${testfile}${EXEEXT}.debug] $debugfile"
test_different_dir debuglink $different_dir 0
@@ -727,7 +727,7 @@ test_different_dir debuglink $different_dir 0
# Test CRC mismatch is reported.
if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
- && ![gdb_gnu_strip_debug [standard_output_file sepdebug2]]} {
+ && ![gdb_gnu_strip_debug [standard_output_file sepdebug2]$EXEEXT]} {
remote_exec build "cp ${debugfile} [standard_output_file sepdebug2.debug]"
@@ -743,7 +743,7 @@ if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
-set build_id_debug_filename [build_id_debug_filename_get $binfile]
+set build_id_debug_filename [build_id_debug_filename_get $binfile$EXEEXT]
if ![string compare $build_id_debug_filename ""] then {
unsupported "build-id is not supported by the compiler"
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 2fb635b..a27e120 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -104,6 +104,17 @@ proc gdb_find_objcopy {} {
return $objcopy
}
+# find target objdump
+proc gdb_find_objdump {} {
+ global OBJDUMP_FOR_TARGET
+ if [info exists OBJDUMP_FOR_TARGET] {
+ set objdump $OBJDUMP_FOR_TARGET
+ } else {
+ set objdump [transform objdump]
+ }
+ return $objdump
+}
+
proc gdb_find_readelf {} {
global READELF_FOR_TARGET
if [info exists READELF_FOR_TARGET] {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 41797e7..21a4638 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4539,28 +4539,41 @@ gdb_caching_proc gdb_has_argv0 {
# Returns "" if there is none.
proc get_build_id { filename } {
- set tmp [standard_output_file "${filename}-tmp"]
- set objcopy_program [gdb_find_objcopy]
-
- set result [catch "exec $objcopy_program -j .note.gnu.build-id -O binary $filename $tmp" output]
- verbose "result is $result"
- verbose "output is $output"
- if {$result == 1} {
- return ""
+ if { ([istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]) } {
+ set objdump_program [gdb_find_objdump]
+ set result [catch {set data [exec $objdump_program -p $filename | grep signature | cut "-d " -f4]} output]
+ verbose "result is $result"
+ verbose "output is $output"
+ if {$result == 1} {
+ return ""
+ }
+ return $data
}
- set fi [open $tmp]
- fconfigure $fi -translation binary
- # Skip the NOTE header.
- read $fi 16
- set data [read $fi]
- close $fi
- file delete $tmp
- if ![string compare $data ""] then {
- return ""
+ else
+ {
+ set tmp [standard_output_file "${filename}-tmp"]
+ set objcopy_program [gdb_find_objcopy]
+ set result [catch "exec $objcopy_program -j .note.gnu.build-id -O binary $filename $tmp" output]
+ verbose "result is $result"
+ verbose "output is $output"
+ if {$result == 1} {
+ return ""
+ }
+ set fi [open $tmp]
+ fconfigure $fi -translation binary
+ # Skip the NOTE header.
+ read $fi 16
+ set data [read $fi]
+ close $fi
+ file delete $tmp
+ if ![string compare $data ""] then {
+ return ""
+ }
+ # Convert it to hex.
+ binary scan $data H* data
+ return $data
}
- # Convert it to hex.
- binary scan $data H* data
- return $data
}
# Return the build-id hex string (usually 160 bits as 40 hex characters)