From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5269 invoked by alias); 20 Mar 2003 21:08:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 5261 invoked from network); 20 Mar 2003 21:08:31 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 20 Mar 2003 21:08:31 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 09DBD2B11; Thu, 20 Mar 2003 16:08:27 -0500 (EST) Message-ID: <3E7A2DCA.6050205@redhat.com> Date: Thu, 20 Mar 2003 21:08:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Adam Fedor Cc: GDB Patches Subject: Re: [PATCH] Step over Objective-C dispatch function References: <3E1504FF.2070506@doc.com> <3E39E4F3.E7865684@redhat.com> <3E39E86E.9060700@redhat.com> <3E39F35A.9050208@doc.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00435.txt.bz2 > + /* Determine if we are currently in the Objective-C dispatch > + function. If so, get the address of the method function that > + the dispatcher would call and use that as the function to > + step into instead. Also skip over the trampoline for the > + function (if any). This is better for the user since they > + are only interested in stepping into the method function > + anyway. */ > + { > + CORE_ADDR method_stop_pc; > + > + if (real_stop_pc) > + find_objc_msgcall (real_stop_pc, &method_stop_pc); > + else > + find_objc_msgcall (stop_pc, &method_stop_pc); > + > + if (method_stop_pc) > + ecs->stop_func_start = method_stop_pc; > + > + if (method_stop_pc) > + { > + real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc); > + if (real_stop_pc != 0) > + ecs->stop_func_start = real_stop_pc; > + } > + } > + Adam, Seems you were waiting on me here :-( I've looked at what the underlying code is trying to do and, unfortunatly, the original objc-lang.c botched its portability(1), sigh! The file is currently native only so infrun.c can't directly refer to objc-lang.c, and hence, will need to go via a dispatch table. Going via a dispatch table wouldn't hurt anyway. Can you please do things as sketched out below. - append to "language.h":struct language_defn the method: /* If PC is possibly an unknown languages trampoline. If that PC falls in a trampoline belonging to this language, return the address of the first pc in the real function, or 0 if it isn't a language tramp for this language. */ CORE_ADDR (*skip_trampoline) (CORE_ADDR pc); - add to "language.h" the global method: CORE_ADDR skip_language_trampoline (CORE_ADDR pc); the implementation iterates through all registered languages looking for and calling any non-NULL struct language_defn.skip_trampoline() functions. Returning the result from the first that returns non-zero, or 0 if all `fail'. - add to objc-lang.c, a language specific objc_skip_trampoline() that implements the above - just confirm that the objc_skip_trampoline() only does target side accesses (memory/register read/write) after it's confirmed that there is a valid objc symbol. No valid objc symbol, no target access. - for infrun.c, before the existing SKIP_TRAMPOLINE() call, make a call to skip_language_trampoline() and then, only if that `fails', try the SKIP_TRAMPOLINE() method. The intent of all this is to make it possible to at leat enable objc on selective natives, and then over time make it more portable. Andrew (1) I noticed that the parameter extract methods assume host=target.