From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3744 invoked by alias); 8 Feb 2009 13:15:35 -0000 Received: (qmail 3732 invoked by uid 22791); 8 Feb 2009 13:15:34 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SARE_SUB_GETRID,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.188) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 08 Feb 2009 13:15:27 +0000 Received: by ti-out-0910.google.com with SMTP id y8so1408715tia.12 for ; Sun, 08 Feb 2009 05:15:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.110.53.14 with SMTP id b14mr6243364tia.52.1234098924244; Sun, 08 Feb 2009 05:15:24 -0800 (PST) In-Reply-To: <200902061550.13149.pedro@codesourcery.com> References: <20090206030528.2E7A0EAEE0@pedro-laptop-dell> <200902061550.13149.pedro@codesourcery.com> Date: Sun, 08 Feb 2009 13:15:00 -0000 Message-ID: Subject: Re: Get rid of linux-thread-db.c:target_beneath From: teawater To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2009-02/txt/msg00193.txt.bz2 Hi Pedro, On Fri, Feb 6, 2009 at 23:50, Pedro Alves wrote: > On Friday 06 February 2009 04:56:58, teawater wrote: >> But we still meet the problem that if a function of beneath target is >> NULL, current target use find_target_beneath to get the beneath >> function pointer is not easy and dangerous like process record meet, >> right? > > linux-thread-db.c always sits on top of linux-nat.c currently, so > it is safe to use in the cases I adjusted. When it isn't "safe", > linux-thread-db.c already checks for NULL-ness. > >> What about make a interface to support safe beneath function? > > For now, you can check that the function pointer is NULL before > calling it. If it is NULL, then try the next target > beneath, etc. See target_attach, target_flash_erase, etc. You > could do something similar in the record.c target. Things > are cleaner on the target method implementation side > if the target method takes a "this" pointer, like the one I'm > adding to target_wait. > > If you do that, you get rid of the record_beneath_to_resume, > record_beneath_to_wait, record_beneath_to_store_registers, etc. > function pointer hacks you had. The wrinkle that has, is that your > method ends up responsible for doing the default if no target > implements the method. IMO, that would acceptible for > now. But, it can be fixed. > I see. So I make a new patch for it. Could you please help me review it? http://sourceware.org/ml/gdb-patches/2009-02/msg00187.html http://sourceware.org/ml/gdb-patches/2009-02/msg00188.html And I make some new patches to fix the format errors. Please help me review it. http://sourceware.org/ml/gdb-patches/2009-02/msg00189.html http://sourceware.org/ml/gdb-patches/2009-02/msg00190.html http://sourceware.org/ml/gdb-patches/2009-02/msg00192.html Thanks, Hui