From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 960 invoked by alias); 14 Jan 2014 15:30:57 -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 950 invoked by uid 89); 14 Jan 2014 15:30:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2014 15:30:55 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0EFUq2g001844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Jan 2014 10:30:53 -0500 Received: from barimba (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0EFUonX026120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 14 Jan 2014 10:30:51 -0500 From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix "is a record target open" checks. References: <1389640367-5571-1-git-send-email-tromey@redhat.com> <1389640367-5571-3-git-send-email-tromey@redhat.com> <52D523FD.8060205@redhat.com> Date: Tue, 14 Jan 2014 15:30:00 -0000 In-Reply-To: <52D523FD.8060205@redhat.com> (Pedro Alves's message of "Tue, 14 Jan 2014 11:48:13 +0000") Message-ID: <8738kqy40l.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-01/txt/msg00446.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: >> RECORD_IS_USED and find_record_target look at >> current_target.to_stratum to determine whether a record target is in >> use. This is bad because arch_stratum is greater than record_stratum. Pedro> This rationale doesn't look right for find_record_target. Yeah, good point. I've changed the description on my branch. Now it says: RECORD_IS_USED looks at current_target.to_stratum to determine whether a record target is in use. This is bad because arch_stratum is greater than record_stratum. To fix this, this patch adds find_target_at to determine whether a target appears at a given stratum. This may seem like overkill somehow, but I have a subsequent patch series that uses it more heavily. This new function lets us clean up find_record_target a bit as well. I consider the change to find_record_target to be a minor cleanup. It seemed cleaner to me to have this kind of target stack iteration isolated in target.c when possible. This mattered more on the multi-target branch, where I converted the target stack to be an array rather than a linked list -- it made the conversion simpler. However, I am not sure I am going to keep that change. Pedro> Instead, I'd rather apply a patch that fixes these record issues Pedro> completely, and only does that. (IMO this one could go in Pedro> immediately). WDYT? I think it looks great, though I have a few nits :) Pedro> +/* The shortnames of the record full targets. */ Pedro> +static char record_full_shortname[] = "record-full"; Pedro> +static char record_full_core_shortname[] = "record-core"; Pedro> + Pedro> +/* See record-full.h. */ Pedro> + Pedro> +int Pedro> +record_full_is_used (void) Pedro> +{ Pedro> + struct target_ops *t; Pedro> + Pedro> + t = find_record_target (); Pedro> + return (t != NULL Pedro> + && (t->to_shortname == record_full_shortname Pedro> + || t->to_shortname == record_full_core_shortname)); Could this check against record_full_*ops directly rather than checking the shortname? I'm curious about the rationale for this choice -- it's all fine by me in the end, but if kept I think could use a comment. Pedro> +void Pedro> +record_preopen (void) Pedro> +{ Need a "/* See record.h. */" Pedro> + /* Check if a record target is already running. */ Pedro> + if (find_record_target ()) != NULL Pedro> +/* Find the record_stratum target in the target stack. */ Pedro> +extern struct target_ops *find_record_target (void); I think this should mention that it can return NULL. Tom