From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24170 invoked by alias); 5 Sep 2002 23:35:54 -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 24163 invoked from network); 5 Sep 2002 23:35:53 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 5 Sep 2002 23:35:53 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17n76K-0003oT-00; Thu, 05 Sep 2002 19:35:56 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17n6A9-0004NO-00; Thu, 05 Sep 2002 19:35:49 -0400 Date: Thu, 05 Sep 2002 16:35:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: native or target? Message-ID: <20020905233548.GA16706@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sources.redhat.com References: <20020905232440.GV1169@gnat.com> <20020905232935.GF1194@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020905232935.GF1194@gnat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-09/txt/msg00077.txt.bz2 On Thu, Sep 05, 2002 at 04:29:35PM -0700, Joel Brobecker wrote: > Hello, > > I have read the gdbint documentation, but still sometimes have some > difficulties deciding where some of the pieces of code should be going. > Should be -nat, or -tdep? Difficult to say sometimes. Can anyone help > me? > > I think part of it is due to the fact that I don't have a clear > definition of what a native port is. I suppose native is when host and > target are the same? I don't have a recent cross-debugger handy to check > that: if I am running on a x86-linux machine cross ppc, is the code in > i386-nat.c used? > > Let's take an example of where I am confused: A native port is something which runs natively, and speaks to some native debug interface. A cross debugger uses some sort of remote target. But it still needs to understand the target. > On interix, the PC_IN_SIGTRAMP method works by comparing the > PC address against a set of addresses. These addresses are actually > to computed at the time when the comparison is made, but were > cached earlier. > > One of the places where these addresses are computed is in the > procfs module (ie we deduct these addresses from the proc info). > Right now, our code looks like this: > > proc_get_status (procinfo *pi) > { > [a. normal processing] > #ifdef __INTERIX > [b. compute sigtramp-related addresses from proc info] > #endif > [c. rest of normal processing] > } > > I would like to move the code in [b.] to the right place, and then > remplace the #ifdef __INTERIX section by the proper runtime test. > But I am confused as to where the right place for this code would > be. On one hand the procinfo stuff seem to pertain to the native > side (hence the -nat module), but on the other hand, the addresses > themselves belong to the interix-tdep module... What would you do? > > Or maybe the approach of caching the addresses from the proc > information is not viable in the current GDB architecture? It's as viable as it ever was - and as incorrect as it ever was! The right place to calculate this information is in a function in your tdep file, if you can. It is often easier to do this sort of thing natively, so people take shortcuts. Basically, if it pertains to a computation that an interix-targeted debugger needs, then it should not be in a native-dependant file. procfs code is native-dependent. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer