Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Antoine Tremblay <antoine.tremblay@ericsson.com>
Subject: [PATCH V2 3/5] Improve tests to allow for targets that support trace but not ftrace
Date: Thu, 03 Nov 2016 14:33:00 -0000	[thread overview]
Message-ID: <20161103143300.24934-4-antoine.tremblay@ericsson.com> (raw)
In-Reply-To: <20161103143300.24934-1-antoine.tremblay@ericsson.com>

This patch is in preparation for ARM tracepoints support in GDBServer.
Previously targets that supported tracing also supported fast tracing and
the tests could be somewhat merged without issue. With the introduction of
ARM tracepoints, without fast tracepoints support this changes.

This patch enables the trace tests to be run even if the
target does not support fast tracepoints.

gdb/testsuite/ChangeLog:

	* gdb.trace/change-loc.exp: Catch non existing IPA lib case and
	set the test to untested.
	* gdb.trace/ftrace-lock.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/pending.exp: Likewise.
	* gdb.trace/range-stepping.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-condition.exp: Move ftrace tests after testing
	for the IPA availability.
	(test_trace_command): New function.
	* gdb.trace/trace-enable-disable.exp: Move ftrace tests after
	testing	for the IPA availability.
	* gdb.trace/trace-mt.exp (foreach): Catch non existing IPA lib case and
	set the test to untested.
---
 gdb/testsuite/gdb.trace/change-loc.exp           |  5 +-
 gdb/testsuite/gdb.trace/ftrace-lock.exp          |  6 ++-
 gdb/testsuite/gdb.trace/ftrace.exp               |  6 ++-
 gdb/testsuite/gdb.trace/pending.exp              |  5 +-
 gdb/testsuite/gdb.trace/range-stepping.exp       |  6 ++-
 gdb/testsuite/gdb.trace/trace-break.exp          |  6 ++-
 gdb/testsuite/gdb.trace/trace-condition.exp      | 64 ++++++++++++++----------
 gdb/testsuite/gdb.trace/trace-enable-disable.exp | 27 ++++++----
 gdb/testsuite/gdb.trace/trace-mt.exp             |  5 +-
 9 files changed, 86 insertions(+), 44 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 9fef3f0..1cd5ce7 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -354,7 +354,10 @@ tracepoint_install_in_trace_disabled "trace"
 
 # Re-compile test case with IPA.
 set libipa [get_in_proc_agent]
-gdb_load_shlib $libipa
+if { [catch {gdb_load_shlib $libipa}] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable \
 	  [list debug nowarnings shlib=$libipa shlib=$lib_sl1 shlib_load] ] != "" } {
diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp
index 0b12c8d..179cd0e 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.exp
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp
@@ -48,7 +48,11 @@ if ![gdb_target_supports_trace] {
 
 # Compile the test case with the in-process agent library.
 set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
+
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 lappend options shlib=$libipa
 
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index e90485c..8cb0ac6 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -38,7 +38,11 @@ if ![gdb_target_supports_trace] {
 }
 
 set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
+
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 # Can't use prepare_for_testing, because that splits compiling into
 # building objects and then linking, and we'd fail with "linker input
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index f7905fb..1ba0eec 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -503,7 +503,10 @@ pending_tracepoint_installed_during_trace "trace"
 
 # Re-compile test case with IPA.
 set libipa [get_in_proc_agent]
-gdb_load_shlib $libipa
+if { [catch gdb_load_shlib $libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 lappend exec_opts "shlib=$libipa"
 
diff --git a/gdb/testsuite/gdb.trace/range-stepping.exp b/gdb/testsuite/gdb.trace/range-stepping.exp
index ba8c3d2..a606bd4 100644
--- a/gdb/testsuite/gdb.trace/range-stepping.exp
+++ b/gdb/testsuite/gdb.trace/range-stepping.exp
@@ -67,7 +67,11 @@ proc range_stepping_with_tracepoint { type } {
 range_stepping_with_tracepoint "trace"
 
 set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
+
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
 	  executable [list debug nowarnings shlib=$libipa] ] != "" } {
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index a90d02d..9756d38 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -349,7 +349,11 @@ break_trace_same_addr_6 "trace" "enable" "trace" "disable"
 break_trace_same_addr_6 "trace" "disable" "trace" "enable"
 
 set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
+
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 # Can't use prepare_for_testing, because that splits compiling into
 # building objects and then linking, and we'd fail with "linker input
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index e36dba4..b5f5798 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -37,31 +37,6 @@ if ![gdb_target_supports_trace] {
     return -1
 }
 
-set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
-
-# Can't use prepare_for_testing, because that splits compiling into
-# building objects and then linking, and we'd fail with "linker input
-# file unused because linking not done" when building the object.
-
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-	  executable [list debug $additional_flags shlib=$libipa] ] != "" } {
-    untested "failed to compile ftrace tests"
-    return -1
-}
-
-clean_restart ${executable}
-
-if ![runto_main] {
-    fail "Can't run to main for ftrace tests"
-    return 0
-}
-
-if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
-    untested "Could not find IPA lib loaded"
-    return 1
-}
-
 proc test_tracepoints { trace_command condition num_frames { kfail_proc 0 } } {
     global executable gdb_prompt
 
@@ -126,7 +101,10 @@ proc 18955_i386_failure { trace_command } {
     }
 }
 
-foreach trace_command { "trace" "ftrace" } {
+proc test_trace_command { trace_command } {
+
+    global pcreg
+
     # This condition is always true as the PC should be set to the tracepoint
     # address when hit.
     test_tracepoints $trace_command "\$$pcreg == *set_point" 10
@@ -303,3 +281,37 @@ foreach trace_command { "trace" "ftrace" } {
     test_tracepoints $trace_command "(0x0aaaaaaaaaaaaaaa > 0x09999999bbbbbbbb ? 1 : 0) == 1" 10
     test_tracepoints $trace_command "(0x00088888ccaaaaaa > 0x09999999bbbbbbbb ? 1 : 0) == 1" 0
 }
+
+
+test_trace_command "trace"
+
+set libipa [get_in_proc_agent]
+
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
+
+# Can't use prepare_for_testing, because that splits compiling into
+# building objects and then linking, and we'd fail with "linker input
+# file unused because linking not done" when building the object.
+
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+	  executable [list debug $additional_flags shlib=$libipa] ] != "" } {
+    untested "failed to compile ftrace tests"
+    return -1
+}
+
+clean_restart ${executable}
+
+if ![runto_main] {
+    fail "Can't run to main for ftrace tests"
+    return 0
+}
+
+if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
+    untested "Could not find IPA lib loaded"
+    return 1
+}
+
+test_trace_command "ftrace"
diff --git a/gdb/testsuite/gdb.trace/trace-enable-disable.exp b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
index 0c35c92..c3d1b7b 100644
--- a/gdb/testsuite/gdb.trace/trace-enable-disable.exp
+++ b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
@@ -39,17 +39,6 @@ if ![gdb_target_supports_trace] {
     return -1
 }
 
-# Compile the test case with the in-process agent library.
-set libipa [get_in_proc_agent]
-gdb_load_shlib $libipa
-
-lappend options shlib=$libipa
-
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
-    untested "Couldn't compile test program with in-process agent library"
-    return -1
-}
-
 # This test makes sure that disabling and enabling tracepoints works
 # correctly.  TRACEPOINT_CMD is the command used to set tracepoints
 # (e.g. trace or ftrace).
@@ -125,4 +114,20 @@ proc test_tracepoint_enable_disable { tracepoint_cmd } {
 }
 
 test_tracepoint_enable_disable trace
+
+# Compile the test case with the in-process agent library.
+set libipa [get_in_proc_agent]
+
+if { [catch {gdb_load_shlib $libipa}] } {
+    untested "Failed to load $libipa"
+    return -1
+}
+
+lappend options shlib=$libipa
+
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
+    untested "Couldn't compile test program with in-process agent library"
+    return -1
+}
+
 test_tracepoint_enable_disable ftrace
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index b580344..15f6c63 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -107,7 +107,10 @@ foreach break_always_inserted { "on" "off" } {
 step_over_tracepoint "trace"
 
 set libipa [get_in_proc_agent]
-set remote_libipa [gdb_load_shlib $libipa]
+if { [catch {gdb_load_shlib $libipa} remote_libipa] } {
+    untested "Failed to load $libipa"
+    return -1
+}
 
 # Compile test case again with IPA.
 if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
-- 
2.9.2


  parent reply	other threads:[~2016-11-03 14:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 14:33 [PATCH V2 0/5] Support tracepoints for ARM linux in GDBServer Antoine Tremblay
2016-11-03 14:33 ` [PATCH V2 4/5] Use FAST_TRACEPOINT_LABEL in range-stepping.exp Antoine Tremblay
2016-11-03 14:33 ` [PATCH V2 2/5] Enable tracing of pseudo-registers on ARM Antoine Tremblay
2016-11-03 14:33 ` [PATCH V2 5/5] Support tracepoints for ARM linux in GDBServer Antoine Tremblay
2016-11-03 17:51   ` Eli Zaretskii
2016-11-03 18:12     ` Antoine Tremblay
2016-11-10 14:01   ` Yao Qi
2016-11-15 14:42     ` Antoine Tremblay
2016-11-16 20:49       ` Yao Qi
2016-11-03 14:33 ` [PATCH V2 1/5] Teach arm unwinders to terminate gracefully Antoine Tremblay
2016-11-03 14:33 ` Antoine Tremblay [this message]
2016-11-07  9:25 ` [PATCH V2 0/5] Support tracepoints for ARM linux in GDBServer Yao Qi
     [not found]   ` <wwoka8dasqta.fsf@ericsson.com>
2016-11-08 15:34     ` Antoine Tremblay
2016-11-09 16:39     ` Yao Qi
2016-11-09 17:58       ` Antoine Tremblay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161103143300.24934-4-antoine.tremblay@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox