public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix index-cache.exp with CC_WITH_TWEAKS_FLAGS=-i
@ 2019-05-03 10:44 Tom de Vries
  2019-05-03 21:17 ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2019-05-03 10:44 UTC (permalink / raw)
  To: gdb-patches

Hi,

When running gdb.base/index-cache.exp with target board cc-with-tweaks with
CC_WITH_TWEAKS_FLAGS set to "-i", we run into:
...
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: at least one file \
      was created
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: expected file is there
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: check index-cache stats
FAIL: gdb.base/index-cache.exp: test_cache_enabled_hit: check index-cache stats
...

The problem is that the target board makes sure that the generated executable
contains a .gdb_index section, while the test assumes that the executable
doesn't contain this section.

Fix this by removing the .gdb_index section from the generated executable.

Tested on x86_64-linux with native and CC_WITH_TWEAKS_FLAGS=-i config.

OK for trunk?

Thanks,
- Tom

[gdb/testsuite] Fix index-cache.exp with CC_WITH_TWEAKS_FLAGS=-i

gdb/testsuite/ChangeLog:

2019-05-03  Tom de Vries  <tdevries@suse.de>

	* gdb.base/index-cache.exp: Remove .gdb_index section from generated
	executable.

---
 gdb/testsuite/gdb.base/index-cache.exp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp
index 4e583abf01..a97252cee4 100644
--- a/gdb/testsuite/gdb.base/index-cache.exp
+++ b/gdb/testsuite/gdb.base/index-cache.exp
@@ -22,6 +22,12 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return
 }
 
+# If a .gdb_index section was already added during compilation, remove it.
+if {[run_on_host "objcopy" [gdb_find_objcopy] \
+	 "--remove-section .gdb_index $binfile"]} {
+    return
+}
+
 # List the files in DIR on the host (where GDB-under-test runs).
 # Return a list of two elements:
 #   - 0 on success, -1 on failure

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-06  6:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 10:44 [PATCH][gdb/testsuite] Fix index-cache.exp with CC_WITH_TWEAKS_FLAGS=-i Tom de Vries
2019-05-03 21:17 ` Simon Marchi
2019-05-04  8:20   ` [committed][gdb/testsuite] Add cc-with-debug-names.exp Tom de Vries
2019-05-04  8:35   ` [gdb/testsuite] Fix index-cache.exp with cc-with-{gdb-index,debug-names} Tom de Vries
2019-05-04 16:28     ` Simon Marchi
2019-05-06  6:43       ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).