From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12512 invoked by alias); 8 Mar 2011 17:21:04 -0000 Received: (qmail 12322 invoked by uid 22791); 8 Mar 2011 17:21:02 -0000 X-SWARE-Spam-Status: No, hits=-1.7 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-a50.g.dreamhost.com) (208.113.200.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 17:20:57 +0000 Received: from homiemail-a50.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a50.g.dreamhost.com (Postfix) with ESMTP id 0FC3E6F8060; Tue, 8 Mar 2011 09:20:56 -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-a50.g.dreamhost.com (Postfix) with ESMTPSA id DB5126F8057; Tue, 8 Mar 2011 09:20:55 -0800 (PST) Message-ID: <4D766577.9000005@eagerm.com> Date: Tue, 08 Mar 2011 17:21:00 -0000 From: Michael Eager User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Mark Kettenis CC: tromey@redhat.com, gdb@sourceware.org Subject: Re: Translate memory addresses References: <4D741E53.2090104@eagerm.com> <4D765DB9.5000708@eagerm.com> <201103081703.p28H3u7q027427@glazunov.sibelius.xs4all.nl> In-Reply-To: <201103081703.p28H3u7q027427@glazunov.sibelius.xs4all.nl> 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/msg00059.txt.bz2 Mark Kettenis wrote: >> Date: Tue, 08 Mar 2011 08:47:53 -0800 >> From: Michael Eager >> >> 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. > > Did you look at how the BSD kvm target does things? It does a > physical to virtual address translation (by using the system-provided > libkvm), and seems to get away with this without having such a hook. How would this help? The kernel isn't running when debugging a hardware target and you can't execute target code when debugging a core file. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077