* lib/gdb.exp (build_id_debug_filename_get): Update to use them.
(gdb_gnu_strip_debug): Ditto.
* lib/prelink-support.exp (section_get, prelink_no): Ditto.
* gdb.arch/altivec-abi.exp: Ditto.
* gdb.base/attach-pie-misread.exp: Ditto.
* gdb.base/comprdebug.exp: Ditto.
* gdb.base/dup-sect.exp: Ditto.
* gdb.base/gnu-debugdata.exp: Ditto.
* gdb.base/step-symless.exp: Ditto.
* gdb.dwarf2/dw2-inline-param.exp: Ditto.
* gdb.dwarf2/dw2-skip-prologue.exp: Ditto.
* gdb.dwarf2/gdb-index.exp: Ditto.
+2013-09-20 Doug Evans <dje@google.com>
+
+ * lib/future.exp (gdb_find_objcopy, gdb_find_readelf): New procs.
+ * lib/gdb.exp (build_id_debug_filename_get): Update to use them.
+ (gdb_gnu_strip_debug): Ditto.
+ * lib/prelink-support.exp (section_get, prelink_no): Ditto.
+ * gdb.arch/altivec-abi.exp: Ditto.
+ * gdb.base/attach-pie-misread.exp: Ditto.
+ * gdb.base/comprdebug.exp: Ditto.
+ * gdb.base/dup-sect.exp: Ditto.
+ * gdb.base/gnu-debugdata.exp: Ditto.
+ * gdb.base/step-symless.exp: Ditto.
+ * gdb.dwarf2/dw2-inline-param.exp: Ditto.
+ * gdb.dwarf2/dw2-skip-prologue.exp: Ditto.
+ * gdb.dwarf2/gdb-index.exp: Ditto.
+
2013-09-18 Andrew Burgess <aburgess@broadcom.com>
* gdb.dwarf2/dw2-reg-undefined.exp: Change pattern for info
if { "$force_abi" == "auto" } {
# If the toolchain does not record attributes, skip auto-ABI tests.
- set readelf_program [transform readelf]
+ set readelf_program [gdb_find_readelf]
set result [catch "exec $readelf_program -A $binfile" output]
if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} {
# DYNAMIC 0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x000200 RW 0x8
#
proc read_phdr {binfile test} {
- set readelf_program [transform readelf]
+ set readelf_program [gdb_find_readelf]
set command "exec $readelf_program -Wl $binfile"
verbose -log "command is $command"
set result [catch $command output]
return
}
-set objcopy_program [transform objcopy]
+set objcopy_program [gdb_find_objcopy]
set cmd "$objcopy_program --compress-debug-sections $ofile"
verbose "invoking $cmd"
set result [catch "exec $cmd" output]
}
set test "rename section"
-set objcopy_program [transform objcopy]
+set objcopy_program [gdb_find_objcopy]
set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
verbose "result is $result"
verbose "output is $output"
set pipeline_counter 0
+set objcopy_program [gdb_find_objcopy]
+
# Run a pipeline of processes through 'run_on_host'.
# TEST is the base name of the test, it is modified and passed to 'run_on_host'.
# Each subsequent argument is a list of the form {PROGRAM [ARG]...}.
# Separate full debug info into ${binfile}.debug.
remote_file host delete ${binfile}.debug
-if {[run_on_host "copydebug" [transform objcopy] \
+if {[run_on_host "copydebug" ${objcopy_program} \
"--only-keep-debug ${binfile} ${binfile}.debug"]} {
return -1
}
# Copy the full debuginfo, keeping only a minimal set of symbols and
# removing some unnecessary sections.
remote_file host delete ${binfile}.mini_debuginfo
-if {[run_on_host "objcopy 1" [transform objcopy] "-S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile}.debug ${binfile}.mini_debuginfo"]} {
+if {[run_on_host "objcopy 1" ${objcopy_program} "-S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile}.debug ${binfile}.mini_debuginfo"]} {
return -1
}
# some files there may be PT_NOTE with NT_GNU_BUILD_ID and GDB could look up
# the .debug file from it. This is only an additional test of GDB, such link
# is not present in usual MiniDebugInfo sections.
-if {[run_on_host "addlink" [transform objcopy] \
+if {[run_on_host "addlink" ${objcopy_program} \
"--add-gnu-debuglink=${binfile}.debug ${binfile}.mini_debuginfo ${binfile}.mini_debuginfo-debuglink"]} {
return -1
}
return -1
}
remote_file host delete ${binfile}.test
-if {[run_on_host "objcopy 2" [transform objcopy] "--add-section .gnu_debugdata=${binfile}.mini_debuginfo-debuglink.xz ${binfile}.strip ${binfile}.test"]} {
+if {[run_on_host "objcopy 2" ${objcopy_program} "--add-section .gnu_debugdata=${binfile}.mini_debuginfo-debuglink.xz ${binfile}.strip ${binfile}.test"]} {
return -1
}
# We need those symbols global to access them from the .S file.
set test "strip stub symbols"
-set objcopy_program [transform objcopy]
+set objcopy_program [gdb_find_objcopy]
set result [catch "exec $objcopy_program -N symless ${binfile}" output]
verbose "result is $result"
verbose "output is $output"
# Strip out any labels there as they could corrupt the `main' name.
-set objcopy_program [transform objcopy]
+set objcopy_program [gdb_find_objcopy]
set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile}"
verbose -log "Executing: $command"
set result [catch "exec $command" output]
# We need those symbols global to access them from the .S file.
set test "strip stub symbols"
-set objcopy_program [transform objcopy]
+set objcopy_program [gdb_find_objcopy]
set result [catch "exec $objcopy_program \
-N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \
-N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \
}
set program_with_index ${program}.with-index
- if {[run_on_host "objcopy" [transform objcopy] "--remove-section .gdb_index --add-section .gdb_index=$index_file --set-section-flags .gdb_index=readonly ${program} ${program_with_index}"]} {
+ if {[run_on_host "objcopy" [gdb_find_objcopy] "--remove-section .gdb_index --add-section .gdb_index=$index_file --set-section-flags .gdb_index=readonly ${program} ${program_with_index}"]} {
return ""
}
return ${program_with_index}
return $ldd
}
+proc gdb_find_objcopy {} {
+ global OBJCOPY_FOR_TARGET
+ if [info exists OBJCOPY_FOR_TARGET] {
+ set objcopy $OBJCOPY_FOR_TARGET
+ } else {
+ set objcopy [transform objcopy]
+ }
+ return $objcopy
+}
+
+proc gdb_find_readelf {} {
+ global READELF_FOR_TARGET
+ if [info exists READELF_FOR_TARGET] {
+ set readelf $READELF_FOR_TARGET
+ } else {
+ set readelf [transform readelf]
+ }
+ return $readelf
+}
+
proc gdb_default_target_compile {source destfile type options} {
global target_triplet
global tool_root_dir
# Return "" if no build-id found.
proc build_id_debug_filename_get { exec } {
set tmp [standard_output_file "${exec}-tmp"]
- set objcopy_program [transform objcopy]
+ set objcopy_program [gdb_find_objcopy]
set result [catch "exec $objcopy_program -j .note.gnu.build-id -O binary $exec $tmp" output]
verbose "result is $result"
set debug_file "${dest}.debug"
set strip_to_file_program [transform strip]
- set objcopy_program [transform objcopy]
+ set objcopy_program [gdb_find_objcopy]
set debug_link [file tail $debug_file]
set stripped_file "${dest}.stripped"
proc section_get {exec section} {
global subdir
set tmp [standard_output_file section_get.tmp]
- set objcopy_program [transform objcopy]
+ set objcopy_program [gdb_find_objcopy]
set command "exec $objcopy_program -O binary --set-section-flags $section=A --change-section-address $section=0 -j $section $exec $tmp"
verbose -log "command is $command"
# Skip prelink options.
continue
}
- set readelf_program [transform readelf]
+ set readelf_program [gdb_find_readelf]
set command "exec $readelf_program -WS $bin"
verbose -log "command is $command"
set result [catch $command output]