From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31358 invoked by alias); 8 Mar 2011 16:48:05 -0000 Received: (qmail 31333 invoked by uid 22791); 8 Mar 2011 16:48:03 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from caibbdcaaaaf.dreamhost.com (HELO homiemail-a42.g.dreamhost.com) (208.113.200.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 16:47:57 +0000 Received: from homiemail-a42.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a42.g.dreamhost.com (Postfix) with ESMTP id 7DF2068C065; Tue, 8 Mar 2011 08:47:55 -0800 (PST) Received: from redwood.eagercon.com (c-98-210-161-13.hsd1.ca.comcast.net [98.210.161.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: eager@eagerm.com) by homiemail-a42.g.dreamhost.com (Postfix) with ESMTPSA id 473CB68C05F; Tue, 8 Mar 2011 08:47:55 -0800 (PST) Message-ID: <4D765DB9.5000708@eagerm.com> Date: Tue, 08 Mar 2011 16:48:00 -0000 From: Michael Eager User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Tom Tromey CC: gdb@sourceware.org Subject: Re: Translate memory addresses References: <4D741E53.2090104@eagerm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00057.txt.bz2 Tom Tromey wrote: >>>>>> "Michael" == Michael Eager writes: > > Michael> I'm working with a target which needs to translate > Michael> a virtual memory addresses to a physical address > Michael> before accessing the target's memory or the core file. > > Michael> Core_ops is defined in corelow.c, and there doesn't appear > Michael> to be an obvious hook for the target code to modify it to > Michael> add the translation routine. > > Michael> Any suggestions on the best way to add a hook or how to specify > Michael> a target routine to do address translations for core files? > > I am not an expert in this area, but couldn't you make a new > arch_stratum target that does the translation? > > With this approach maybe you don't even need a hook -- just do the > translation and call the target beneath. Interesting idea. I didn't think of adding a stratum for translation. I took a clue from the way that sol-thread.c prevents corelow.c from calling add_target to install core_ops. I added the following to corelow.c: CORE_ADDR (*target_translate_address) (struct target_ops *, CORE_ADDR addr); and in init_core_ops(): core_ops.to_translate_address = target_translate_address; The target code contains a definition for target_translate_address which is initialized to point to the translation routine. For other targets, this will be zero. It's inelegant, what can I say, but functional. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077