From patchwork Thu Nov 3 14:32:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 17161 Received: (qmail 53955 invoked by alias); 3 Nov 2016 14:33:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 53897 invoked by uid 89); 3 Nov 2016 14:33:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=3033, availability, 6711, 5037 X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 14:33:24 +0000 Received: from EUSAAHC002.ericsson.se (Unknown_Domain [147.117.188.78]) by (Symantec Mail Security) with SMTP id 6C.A1.02571.146FA185; Thu, 3 Nov 2016 09:33:05 +0100 (CET) Received: from elxa4wqvvz1.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.78) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Nov 2016 10:33:09 -0400 From: Antoine Tremblay To: CC: Antoine Tremblay Subject: [PATCH V2 3/5] Improve tests to allow for targets that support trace but not ftrace Date: Thu, 3 Nov 2016 10:32:58 -0400 Message-ID: <20161103143300.24934-4-antoine.tremblay@ericsson.com> In-Reply-To: <20161103143300.24934-1-antoine.tremblay@ericsson.com> References: <20161103143300.24934-1-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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 \