From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25959 invoked by alias); 28 Oct 2013 17:51:07 -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 25946 invoked by uid 89); 28 Oct 2013 17:51:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 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; Mon, 28 Oct 2013 17:51:06 +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 r9SHp4S3030152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Oct 2013 13:51:04 -0400 Received: from barimba (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9SHp394030571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 28 Oct 2013 13:51:04 -0400 From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v4 3/9] add target method delegation References: <1382464769-2465-1-git-send-email-tromey@redhat.com> <1382464769-2465-4-git-send-email-tromey@redhat.com> <526E8B54.8040104@redhat.com> Date: Mon, 28 Oct 2013 17:51:00 -0000 In-Reply-To: <526E8B54.8040104@redhat.com> (Pedro Alves's message of "Mon, 28 Oct 2013 16:05:40 +0000") Message-ID: <87eh75cmig.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: 2013-10/txt/msg00870.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: Pedro> Could you please split out the patch for the second problem? I Pedro> think it'll be a small one. Sure. Pedro> What's the plan for the existing target methods that Pedro> currently already do a similar beneath lookup? I'd like it that Pedro> there's be at least a plan, so we don't end up with yet another Pedro> way of doing things, two incomplete transitions, and no clear direction. Do you mean things like target_detach? If so, then I think these are two different things. target.h declares things both for users of the target API and for the implementation of targets. Something like target_detach is a public API. My understanding of the current scheme is that a public-facing method can either be implemented by a function like target_detach, which encodes all the needed logic; or by a macro that just calls into the target_ops, in which case the method must use the inherit/default machinery. On the other hand, target_delegate_* functions are there for the target implementations to use. They just encapsulate a bit of common code for the case where a target wants to delegate a request to the next lower target on the stack. >> + gdb_assert_not_reached (_("reached end of target stack during >> delegation")); >> +} Pedro> This appears in several places. Whenever I see the same string Pedro> repeated over and over, I tend to think it'd be good to add a Pedro> utility helper function: Will do. Pedro> Some of the delegation methods have that assert, while others don't Pedro> have anything at the tail end. What's the story there? I don't remember. It does seem a bit random right now. It seems to me that the best approach is to make a target_delegate_* function assert only when there is no de_fault for the corresponding method. >> + if (t->to_insert_breakpoint) Pedro> if (t->to_insert_breakpoint != NULL) I fixed all the instances of it. Tom