From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9521 invoked by alias); 30 Jan 2014 05:46:56 -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 9512 invoked by uid 89); 30 Jan 2014 05:46:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 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; Thu, 30 Jan 2014 05:46:55 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1W8kSi-0003Si-7y from Yao_Qi@mentor.com ; Wed, 29 Jan 2014 21:46:52 -0800 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); Wed, 29 Jan 2014 21:46:52 -0800 Received: from qiyao.dyndns.org (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; Wed, 29 Jan 2014 21:46:49 -0800 From: Yao Qi To: CC: Subject: [PATCH 1/2] Create inferior for tfile target Date: Thu, 30 Jan 2014 05:46:00 -0000 Message-ID: <1391060652-10870-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1391060652-10870-1-git-send-email-yao@codesourcery.com> References: <1391060652-10870-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg01055.txt.bz2 When a trace file is loaded in Eclipse, it is expected to see thread and process (=thread-group-started and =thread-created). Create an inferior and add a thread for this purpose. This patch just reverts my previous patch. gdb/testsuite: 2014-01-30 Yao Qi Revert this patch: 2013-05-24 Yao Qi * gdb.trace/tfile.exp: Test inferior and thread. gdb: 2014-01-30 Yao Qi Revert this patch: 2013-05-24 Yao Qi * tracepoint.c (TFILE_PID): Remove. (tfile_open): Don't add thread and inferior. (tfile_close): Don't set 'inferior_ptid'. Don't call exit_inferior_silent. (tfile_thread_alive): Remove. (init_tfile_ops): Don't set field 'to_thread_alive' of tfile_ops. --- gdb/testsuite/gdb.trace/tfile.exp | 3 --- gdb/tracepoint.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp index 35d9c2c..634c2fc 100644 --- a/gdb/testsuite/gdb.trace/tfile.exp +++ b/gdb/testsuite/gdb.trace/tfile.exp @@ -136,9 +136,6 @@ Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).* Not looking at any trace frame.*" \ "tstatus on error trace file" -gdb_test "info threads" "No threads\..*" -gdb_test "info inferiors" "\\* 1 \[ \t\]+${binfile}.*" - # Make sure we can reopen without error. gdb_test \ "interpreter-exec mi \"-target-select tfile $tfile_basic\"" \ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index f3b9bfc..0a50606 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -79,6 +79,8 @@ large. (400 - 31)/2 == 184 */ #define MAX_AGENT_EXPR_LEN 184 +#define TFILE_PID (1) + /* A hook used to notify the UI of tracepoint operations. */ void (*deprecated_trace_find_hook) (char *arg, int from_tty); @@ -4372,6 +4374,10 @@ tfile_open (char *filename, int from_tty) throw_exception (ex); } + inferior_appeared (current_inferior (), TFILE_PID); + inferior_ptid = pid_to_ptid (TFILE_PID); + add_thread_silent (inferior_ptid); + if (ts->traceframe_count <= 0) warning (_("No traceframes present in this file.")); @@ -4382,6 +4388,8 @@ tfile_open (char *filename, int from_tty) merge_uploaded_trace_state_variables (&uploaded_tsvs); merge_uploaded_tracepoints (&uploaded_tps); + + post_create_inferior (&tfile_ops, from_tty); } /* Interpret the given line from the definitions part of the trace @@ -4754,6 +4762,10 @@ tfile_close (void) if (trace_fd < 0) return; + pid = ptid_get_pid (inferior_ptid); + inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */ + exit_inferior_silent (pid); + close (trace_fd); trace_fd = -1; xfree (trace_filename); @@ -5250,6 +5262,12 @@ tfile_has_registers (struct target_ops *ops) return traceframe_number != -1; } +static int +tfile_thread_alive (struct target_ops *ops, ptid_t ptid) +{ + return 1; +} + /* Callback for traceframe_walk_blocks. Builds a traceframe_info object for the tfile target's current traceframe. */ @@ -5336,6 +5354,7 @@ init_tfile_ops (void) tfile_ops.to_has_stack = tfile_has_stack; tfile_ops.to_has_registers = tfile_has_registers; tfile_ops.to_traceframe_info = tfile_traceframe_info; + tfile_ops.to_thread_alive = tfile_thread_alive; tfile_ops.to_magic = OPS_MAGIC; } -- 1.7.7.6