From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19099 invoked by alias); 28 Apr 2014 06:15:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19027 invoked by uid 89); 28 Apr 2014 06:15:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Apr 2014 06:15:21 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WeeqT-0005ua-UV from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sun, 27 Apr 2014 23:15:17 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 27 Apr 2014 23:15:17 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Sun, 27 Apr 2014 23:15:16 -0700 From: Yao Qi To: Subject: [PATCH 3/4] Save traceframes in trace file and read data out from trace file. Date: Mon, 28 Apr 2014 06:15:00 -0000 Message-ID: <1398665538-16580-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1398665538-16580-1-git-send-email-yao@codesourcery.com> References: <1398665538-16580-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00557.txt.bz2 This patch is to make GDB read data from trace file, tfile and ctf, and test the output of collected data should be the same as read data from remote target. After the change, there are some fails below, and the next patch is to fix them. FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print struct_b FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print /x struct_b FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print /x struct_b.struct_a FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print /x struct_b.struct_a.array FAIL: gdb.trace/unavailable.exp: collect globals: tfile: is not the same as 0 in array element repetitions FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print *tarray@3 FAIL: gdb.trace/unavailable.exp: collect globals: tfile: printing partially collected string FAIL: gdb.trace/unavailable.exp: collect globals: tfile: print virtual_partial FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print struct_b FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print /x struct_b FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print /x struct_b.struct_a FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print /x struct_b.struct_a.array FAIL: gdb.trace/unavailable.exp: collect globals: ctf: is not the same as 0 in array element repetitions FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print *tarray@3 FAIL: gdb.trace/unavailable.exp: collect globals: ctf: printing partially collected string FAIL: gdb.trace/unavailable.exp: collect globals: ctf: print virtual_partial gdb/testsuite: 2014-04-26 Yao Qi * gdb.trace/unavailable.exp (gdb_collect_args_test): Save traceframes into tfile and ctf trace files. Read data from trace file and test collected data. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_unavailable_floats): Likewise. (gdb_collect_globals_test): Likewise. (top-level): Append "ctf" to trace_file_targets if GDB supports. --- gdb/testsuite/gdb.trace/unavailable.exp | 142 ++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index d76b54d..ec5ed26 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -188,6 +188,8 @@ proc gdb_collect_args_test_1 {} { proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments" { global gdb_prompt + global testfile srcdir subdir binfile + global trace_file_targets prepare_for_trace_test @@ -203,6 +205,30 @@ proc gdb_collect_args_test {} { gdb_test "tfind none" \ "#0 end .*" \ "cease trace debugging" + + set tracefile [standard_output_file ${testfile}] + gdb_test "tsave ${tracefile}.args.tfile" \ + "Trace data saved to file '${tracefile}.args.tfile'\.\\r" \ + "tsave ${testfile}.args.tfile" + gdb_test "tsave -ctf ${tracefile}.args.ctf" \ + "Trace data saved to directory '${tracefile}.args.ctf'\.\\r" \ + "save ctf trace file" + + foreach target_name ${trace_file_targets} { + # Restart GDB and read the trace data in ${TARGET_NAME} target. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_file_cmd $binfile + gdb_test "target ${target_name} ${tracefile}.args.${target_name}" ".*" \ + "change to ${target_name} target" + + with_test_prefix "${target_name}" { + gdb_test "tfind start" "#0 args_test_func .*" \ + "tfind test frame" + gdb_collect_args_test_1 + } + } } } @@ -244,6 +270,8 @@ proc gdb_collect_locals_test_1 { func } { proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg" { global gdb_prompt + global testfile srcdir subdir binfile + global trace_file_targets prepare_for_trace_test @@ -261,6 +289,30 @@ proc gdb_collect_locals_test { func msg } { gdb_test "tfind none" \ "#0 end .*" \ "cease trace debugging" + + set tracefile [standard_output_file ${testfile}] + gdb_test "tsave ${tracefile}.locals.tfile" \ + "Trace data saved to file '${tracefile}.locals.tfile'\.\\r" \ + "tsave ${testfile}.locals.tfile" + gdb_test "tsave -ctf ${tracefile}.locals.ctf" \ + "Trace data saved to directory '${tracefile}.locals.ctf'\.\\r" \ + "save ctf trace file" + + foreach target_name ${trace_file_targets} { + # Restart GDB and read the trace data in ${TARGET_NAME} target. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_file_cmd $binfile + gdb_test "target ${target_name} ${tracefile}.locals.${target_name}" ".*" \ + "change to ${target_name} target" + + with_test_prefix "${target_name}" { + gdb_test "tfind start" "#0 $func .*" \ + "tfind test frame" + gdb_collect_locals_test_1 $func + } + } } } @@ -302,6 +354,8 @@ proc gdb_unavailable_registers_test_1 { } { proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers" { + global testfile srcdir subdir binfile + global trace_file_targets prepare_for_trace_test @@ -318,6 +372,30 @@ proc gdb_unavailable_registers_test { } { gdb_unavailable_registers_test_1 gdb_test "tfind none" "#0 end .*" "cease trace debugging" + + set tracefile [standard_output_file ${testfile}] + gdb_test "tsave ${tracefile}.registers.tfile" \ + "Trace data saved to file '${tracefile}.registers.tfile'\.\\r" \ + "tsave ${testfile}.registers.tfile" + gdb_test "tsave -ctf ${tracefile}.registers.ctf" \ + "Trace data saved to directory '${tracefile}.registers.ctf'\.\\r" \ + "save ctf trace file" + + foreach target_name ${trace_file_targets} { + # Restart GDB and read the trace data in ${TARGET_NAME} target. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_file_cmd $binfile + gdb_test "target ${target_name} ${tracefile}.registers.${target_name}" ".*" \ + "change to ${target_name} target" + + with_test_prefix "${target_name}" { + gdb_test "tfind start" "#0 globals_test_func .*" \ + "tfind test frame" + gdb_unavailable_registers_test_1 + } + } } } @@ -340,6 +418,9 @@ proc gdb_unavailable_floats_1 { } { proc gdb_unavailable_floats { } { with_test_prefix "unavailable floats" { + global testfile srcdir subdir binfile + global trace_file_targets + prepare_for_trace_test # We'll simply re-use the globals_test_function for this test @@ -355,6 +436,30 @@ proc gdb_unavailable_floats { } { gdb_unavailable_floats_1 gdb_test "tfind none" "#0 end .*" "cease trace debugging" + + set tracefile [standard_output_file ${testfile}] + gdb_test "tsave ${tracefile}.floats.tfile" \ + "Trace data saved to file '${tracefile}.floats.tfile'\.\\r" \ + "tsave ${testfile}.floats.tfile" + gdb_test "tsave -ctf ${tracefile}.floats.ctf" \ + "Trace data saved to directory '${tracefile}.floats.ctf'\.\\r" \ + "save ctf trace file" + + foreach target_name ${trace_file_targets} { + # Restart GDB and read the trace data in ${TARGET_NAME} target. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_file_cmd $binfile + gdb_test "target ${target_name} ${tracefile}.floats.${target_name}" ".*" \ + "change to ${target_name} target" + + with_test_prefix "${target_name}" { + gdb_test "tfind start" "#0 globals_test_func .*" \ + "tfind test frame" + gdb_unavailable_floats_1 + } + } } } @@ -551,6 +656,9 @@ proc gdb_collect_globals_test_1 { } { proc gdb_collect_globals_test { } { with_test_prefix "collect globals" { + global testfile binfile srcdir subdir + global trace_file_targets + prepare_for_trace_test set testline [gdb_get_line_number "set globals_test_func tracepoint here"] @@ -596,6 +704,31 @@ proc gdb_collect_globals_test { } { gdb_test "tfind none" \ "#0 end .*" \ "cease trace debugging" + + set tracefile [standard_output_file ${testfile}] + gdb_test "tsave ${tracefile}.globals.tfile" \ + "Trace data saved to file '${tracefile}.globals.tfile'\.\\r" \ + "tsave ${testfile}.globals.tfile" + gdb_test "tsave -ctf ${tracefile}.globals.ctf" \ + "Trace data saved to directory '${tracefile}.globals.ctf'\.\\r" \ + "save ctf trace file" + + foreach target_name ${trace_file_targets} { + # Restart GDB and read the trace data in ${TARGET_NAME} target. + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_file_cmd $binfile + gdb_test "target ${target_name} ${tracefile}.globals.${target_name}" ".*" \ + "change to ${target_name} target" + + with_test_prefix "${target_name}" { + gdb_test "tfind start" "#0 globals_test_func .*" \ + "tfind test frame" + gdb_collect_globals_test_1 + } + } + } } @@ -617,6 +750,15 @@ if { ![gdb_target_supports_trace] } then { return 1 } +set trace_file_targets [list "tfile"] +gdb_test_multiple "target ctf" "" { + -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" { + } + -re "No CTF directory specified.*\r\n$gdb_prompt $" { + lappend trace_file_targets "ctf" + } +} + # Body of test encased in a proc so we can return prematurely. gdb_trace_collection_test -- 1.9.0