Add "info connections" command, "info inferiors" connection number/string
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / report.exp
index 3c3025d609ffc3c9c4d02ecfa35b5c4e92f674c0..93029757b777a7a0aa94f63feca6fbf7b69cc002 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1998-2013 Free Software Foundation, Inc.
+#   Copyright 1998-2020 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 # This file was written by Michael Snyder (msnyder@cygnus.com)
 
-load_lib "trace-support.exp";
+load_lib "trace-support.exp"
 
 
 gdb_exit
 gdb_start
 
 standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+    unsupported "no trace-common.h support for arch"
+    return -1
+}
 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-         executable {debug nowarnings}] != "" } {
-    untested report.exp
+         executable {debug nowarnings nopie}] != "" } {
+    untested "failed to compile"
     return -1
 }
 gdb_load $binfile
@@ -34,7 +38,7 @@ runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
 if { ![gdb_target_supports_trace] } then {
-    unsupported "Current target does not support trace"
+    unsupported "current target does not support trace"
     return 1
 
 }
@@ -62,10 +66,10 @@ set arg4 4
 set arg5 5
 set arg6 6
 
-set gdb_recursion_test_baseline [gdb_find_recursion_test_baseline $srcfile];
+set gdb_recursion_test_baseline [gdb_find_recursion_test_baseline $srcfile]
 if { $gdb_recursion_test_baseline == -1 } {
-    fail "Could not find gdb_recursion_test function"
-    return;
+    fail "could not find gdb_recursion_test function"
+    return
 }
 
 set return_me 0
@@ -97,13 +101,13 @@ gdb_test_multiple "list $gdb_recursion_test_baseline, +12" "" {
     }
     -re ".*$gdb_prompt $" {
        if { ($testline1 == 0) || ($testline2 == 0) || ($testline3 == 0) || ($testline4 == 0) || ($testline5 == 0) || ($testline6 == 0) } {
-           untested report.exp
+           untested "unexpected testline values"
            set return_me 1
 all tests in this module will fail."
        }
     }
     default {
-           untested report.exp
+           untested "couldn't match pattern"
            set return_me 1
 all tests in this module will fail."
     } 
@@ -134,7 +138,7 @@ set tdp6 [gdb_gettpnum $testline6]
 if {    $tdp1 <= 0 || $tdp2 <= 0 || $tdp3 <= 0 || \
        $tdp4 <= 0 || $tdp5 <= 0 || $tdp6 <= 0 } then {
     fail "setting tracepoints failed"
-    return;
+    return
 }
 
 gdb_trace_setactions "9.x: setup TP to collect regs" \
@@ -150,20 +154,6 @@ gdb_trace_setactions "9.x: setup TP to collect locals" \
        "$tdp4" \
        "collect \$locs" "^$"
 
-if [is_amd64_regs_target] {
-    set fpreg "rbp"
-    set spreg "rsp"
-    set pcreg "rip"
-} elseif [is_x86_like_target] {
-    set fpreg "ebp"
-    set spreg "esp"
-    set pcreg "eip"
-} else {
-    set fpreg "fp"
-    set spreg "sp"
-    set pcreg "pc"
-}
-
 gdb_trace_setactions "9.x: setup TP to collect stack memory" \
        "$tdp5" \
        "collect \$$fpreg, \*\(void \*\*\) \$$spreg @ 64" "^$"
@@ -174,7 +164,7 @@ gdb_trace_setactions "9.x: setup TP to collect expressions" \
 
 gdb_test "tstart" ".*" ""
 
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
@@ -197,7 +187,7 @@ proc use_collected_data { data_source } {
        global tdp1 tdp2 tdp3 tdp4 tdp5 tdp6
        global testline1 testline2 testline3 testline4 testline5 testline6
        global pcreg fpreg spreg
-       global srcfile srcdir subdir
+       global srcfile srcdir subdir binfile
        global arg1 arg3
        global decimal hex gdb_prompt
        #
@@ -397,6 +387,11 @@ proc use_collected_data { data_source } {
                }
            }
        }
+
+       # There is always a thread of an inferior, either a live one or
+       # a faked one.
+       gdb_test "info threads" "\\* ${decimal}    (process|Thread) \[0-9\.\]+\[ \t\].*"
+       gdb_test "info inferiors" "\\* 1    process ${decimal} \[ \t\]+\[^\r\n\]*\[ \t\]+${binfile}.*"
     }
 }
 
@@ -412,6 +407,11 @@ gdb_test "tsave ${tracefile}.tf" \
     "Trace data saved to file '${tracefile}.tf'.*" \
     "save tfile trace file"
 
+# Save trace frames to ctf.
+gdb_test "tsave -ctf ${tracefile}.ctf" \
+    "Trace data saved to directory '${tracefile}.ctf'.*" \
+    "save ctf trace file"
+
 # Change target to tfile.
 set test "change to tfile target"
 gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
@@ -425,3 +425,12 @@ gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
 }
 # Test the collected trace frames from tfile.
 use_collected_data "tfile"
+
+# Try to read ctf data if GDB supports.
+gdb_test_multiple "target ctf ${tracefile}.ctf" "" {
+    -re "Undefined target command: \"ctf ${tracefile}.ctf\"\.  Try \"help target\"\.\r\n$gdb_prompt $" {
+    }
+    -re ".*\r\n$gdb_prompt $" {
+       use_collected_data "ctf"
+    }
+}
This page took 0.027276 seconds and 4 git commands to generate.