# field names, all of which are stored in the .debug_str section.
gdb_test "p global_var" " = \\{aa = 0, bb = 0, cc = 0\\}"
+# If we have a .gdb_index already, this test isn't going to work,
+# because the .gdb_index reader doesn't check for .debug_str.
+if {[get_index_type $testfile] == "gdb"} {
+ untested ".gdb_index does not handle this case"
+ return
+}
+
+# objcopy, even with --dump-section, will try to open the executable
+# for writing. To avoid "text file busy", exit gdb here, stopping the
+# inferior as a side effect.
+gdb_exit
+
set host_binfile [gdb_remote_download host $binfile]
# Verify that the executable actually contains a .debug_str section, before