[3/4] Add variable length tests for emit_ref in trace-condition.exp

Message ID 1463504594-4419-3-git-send-email-antoine.tremblay@ericsson.com
State New, archived
Headers

Commit Message

Antoine Tremblay May 17, 2016, 5:03 p.m. UTC
  This patch add variable length tests for emit_ref by reading the variable
passed as argument of 8 to 64 bit.

gdb/testsuite/ChangeLog:

	* gdb.trace/trace-condition.c (marker): Adapt signature to 8 to 64
	bits types.
	(main): Adapt to 8 to 64 bits types.
	* gdb.trace/trace-condition.exp: Add new tests.
---
 gdb/testsuite/gdb.trace/trace-condition.c   | 8 +++++---
 gdb/testsuite/gdb.trace/trace-condition.exp | 7 +++++--
 2 files changed, 10 insertions(+), 5 deletions(-)
  

Comments

Pedro Alves May 27, 2016, 12:05 p.m. UTC | #1
On 05/17/2016 06:03 PM, Antoine Tremblay wrote:
> This patch add variable length tests for emit_ref by reading the variable
> passed as argument of 8 to 64 bit.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.trace/trace-condition.c (marker): Adapt signature to 8 to 64
> 	bits types.
> 	(main): Adapt to 8 to 64 bits types.
> 	* gdb.trace/trace-condition.exp: Add new tests.

Looks OK to me, but same comment as previous patches.

Thanks,
Pedro Alves
  
Antoine Tremblay May 27, 2016, 1:04 p.m. UTC | #2
Pedro Alves writes:

> On 05/17/2016 06:03 PM, Antoine Tremblay wrote:
>> This patch add variable length tests for emit_ref by reading the variable
>> passed as argument of 8 to 64 bit.
>> 
>> gdb/testsuite/ChangeLog:
>> 
>> 	* gdb.trace/trace-condition.c (marker): Adapt signature to 8 to 64
>> 	bits types.
>> 	(main): Adapt to 8 to 64 bits types.
>> 	* gdb.trace/trace-condition.exp: Add new tests.
>
> Looks OK to me, but same comment as previous patches.

Note that I don't think the same comment applies here as tests check for
1 or 2 frames only. So you could not get an unconditional error.

test_tracepoints $trace_command "arg8 == 1 || arg8 == 2" 2

For example will test 2 values and collect 2 frames max to pass.

Thanks,
Antoine
  

Patch

diff --git a/gdb/testsuite/gdb.trace/trace-condition.c b/gdb/testsuite/gdb.trace/trace-condition.c
index 94bb30c..f0b1863 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.c
+++ b/gdb/testsuite/gdb.trace/trace-condition.c
@@ -16,8 +16,9 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "trace-common.h"
+#include <inttypes.h>
 
-int globvar;
+int64_t globvar;
 
 static void
 begin (void)
@@ -25,7 +26,7 @@  begin (void)
 }
 
 static void
-marker (int anarg)
+marker (int8_t arg8, int16_t arg16, int32_t arg32, int64_t arg64)
 {
   FAST_TRACEPOINT_LABEL(set_point);
 }
@@ -41,7 +42,8 @@  main ()
   begin ();
 
   for (globvar = 1; globvar < 11; ++globvar)
-    marker (globvar * 100);
+    marker (globvar, globvar + (1 << 8), globvar + (1 << 16),
+	    globvar + (1LL << 32));
 
   end ();
   return 0;
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index f5b59b1..8c770f4 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -132,9 +132,12 @@  foreach trace_command { "trace" "ftrace" } {
     test_tracepoints $trace_command "\$$pcreg == *set_point" 10
 
     # Can we read local variables?
-    test_tracepoints $trace_command "anarg == 100 || anarg == 200" 2 18955_x86_64_failure
+    test_tracepoints $trace_command "arg8 == 1 || arg8 == 2" 2 18955_x86_64_failure
+    test_tracepoints $trace_command "arg16 == 257 || arg16 == 258" 2 18955_x86_64_failure
+    test_tracepoints $trace_command "arg32 == 65537 || arg32 == 65538" 2 18955_x86_64_failure
+    test_tracepoints $trace_command "arg64 == 4294967297 || arg64 == 4294967298" 2 18955_x86_64_failure
     # Can we read global variables?
-    test_tracepoints $trace_command "anarg == 100 && globvar == 1" 1 18955_x86_64_failure
+    test_tracepoints $trace_command "arg16 == 257 && globvar == 1" 1 18955_x86_64_failure
 
     # Test various operations to cover as many opcodes as possible.
     test_tracepoints $trace_command "21 == 21" 10