This finishes making gdb.dwarf2 parallel-safe.
To do this, this patch introduces a new gdb_remote_download proc, that
works somewhat differently in the one specific case where it matters:
for a copy to "host", if no destination was given, and the host is not
actually remote, then standard_output_file is used.  In parallel mode
this guarantees that the resulting file will end up in a parallel-safe
location.
Tested on x86-64 Fedora 18.
	* gdb.dwarf2/dw2-basic.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-compressed.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-intercu.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-intermix.exp: Use gdb_remote_download.
	* gdb.dwarf2/dw2-producer.exp: Use gdb_remote_download.
	* gdb.dwarf2/mac-fileno.exp: Use gdb_remote_download.
	* lib/gdb.exp (gdb_remote_download): New proc.
+2013-08-22  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.dwarf2/dw2-basic.exp: Use gdb_remote_download.
+       * gdb.dwarf2/dw2-compressed.exp: Use gdb_remote_download.
+       * gdb.dwarf2/dw2-intercu.exp: Use gdb_remote_download.
+       * gdb.dwarf2/dw2-intermix.exp: Use gdb_remote_download.
+       * gdb.dwarf2/dw2-producer.exp: Use gdb_remote_download.
+       * gdb.dwarf2/mac-fileno.exp: Use gdb_remote_download.
+       * lib/gdb.exp (gdb_remote_download): New proc.
+
 2013-08-22  Tom Tromey  <tromey@redhat.com>
 
        * gdb.dwarf2/clztest.exp: Use standard_testfile.
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 # This needs to be done first so that the CU for int2 gets expanded first.
 # This exercises the case where the type for this die is hashed, but we
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
     return -1
 }
 
-set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+set remote_dwarf_srcfile [gdb_remote_download host \
+                             ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
     }
 }
 
+# Like remote_download but provides a gdb-specific behavior.  If DEST
+# is "host", and the host is not remote, and TOFILE is not specified,
+# then the [file tail] of FROMFILE is passed through
+# standard_output_file to compute the destination.
+
+proc gdb_remote_download {dest fromfile {tofile {}}} {
+    if {$dest == "host" && ![is_remote host] && $tofile == ""} {
+       set tofile [standard_output_file [file tail $fromfile]]
+    }
+    return [remote_download $dest $fromfile $tofile]
+}
+
 # gdb_download
 #
 # Copy a file to the remote target and return its target filename.