From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27226 invoked by alias); 4 May 2013 01:31:29 -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 27161 invoked by uid 89); 4 May 2013 01:31:22 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 04 May 2013 01:31:20 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UYRJn-0002Rm-9v from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 03 May 2013 18:31:19 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 May 2013 18:31:18 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Fri, 3 May 2013 18:31:18 -0700 From: Yao Qi To: Subject: [RFC] Don't create inferior in tfile target. Date: Sat, 04 May 2013 01:31:00 -0000 Message-ID: <1367631071-20079-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00068.txt.bz2 In ctf target, we don't create inferior when open ctf trace file, however we do it in tfile target. After read the code for a while, I don't see any reason that we need an inferior here. The code was added along with the tfile support patch, and was modified once by patch [1] I checked out the code on the revision before patch [1] was applied bd196e7a61b03f2ea7e5dcb0aecbd49d239d6390 and I am able to reproduce the same internal error, However, I am wondering why do we need inferior in tfile target. I removed the code to create inferior in tfile_open and remove inferior in tfile_close. The internal error can be fixed also. I also checked that 'info threads' and 'info inferiors' works properly. I talked with Stan (he wrote tfile supported code) on this, but we were unable to recall the reason in details on creating inferior. I post this patch to remove the code to create inferior in tfile target. Comments are welcome. [1] robustify target tfile's open code http://sourceware.org/ml/gdb-patches/2011-05/msg00477.html gdb: 2013-05-04 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: 2013-05-04 Yao Qi * gdb.trace/tfile.exp: Test inferior and thread. --- gdb/testsuite/gdb.trace/tfile.exp | 3 +++ gdb/tracepoint.c | 19 ------------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp index 087d207..d7381eb 100644 --- a/gdb/testsuite/gdb.trace/tfile.exp +++ b/gdb/testsuite/gdb.trace/tfile.exp @@ -119,6 +119,9 @@ 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.tf\"" \ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 9e2c4e3..0124211 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -81,8 +81,6 @@ 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); @@ -4273,10 +4271,6 @@ 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.")); @@ -4287,8 +4281,6 @@ 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 @@ -4661,10 +4653,6 @@ 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); @@ -5111,12 +5099,6 @@ 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. */ @@ -5196,7 +5178,6 @@ 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