From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14266 invoked by alias); 11 Jun 2002 16:25:44 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 14191 invoked from network); 11 Jun 2002 16:25:41 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 11 Jun 2002 16:25:41 -0000 Received: from romulus.sfbay.redhat.com (romulus.sfbay.redhat.com [172.16.27.251]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id JAA02915; Tue, 11 Jun 2002 09:25:39 -0700 (PDT) Received: (from kev@localhost) by romulus.sfbay.redhat.com (8.11.6/8.11.6) id g5BGPWf06102; Tue, 11 Jun 2002 09:25:32 -0700 Date: Tue, 11 Jun 2002 09:25:00 -0000 From: Kevin Buettner Message-Id: <1020611162531.ZM6101@localhost.localdomain> In-Reply-To: "Lawrence Lee (Shanghai)" "FW: The question about the relation between gdb and the programme debugged" (Jun 11, 9:33am) References: To: "Lawrence Lee (Shanghai)" , gdb Subject: Re: The question about the relation between gdb and the programme debugged MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-06/txt/msg00088.txt.bz2 On Jun 11, 9:33am, Lawrence Lee (Shanghai) wrote: > But how does the gdb process access the memory spaces in the program being > debugged? It depends. For a "native" debugger, the operating system's kernel provides an interface by which the debugger can read/write the memory of the process being debugged. On GNU/Linux (and many other unices), ptrace() is the interface by which the debugger accesses and controls memory, registers, and other aspects of the inferior program. "Pure" SVR4 systems use the use the /proc filesystem for this interface. For a remote debugger, the target machine has a debugging "stub" running on it which provides access to memory, registers, etc. (GDB communicates with the stub via a serial port, ethernet, usb, etc.) The stub may use the same type of interface as described above for a native debugger to access memory, registers, etc. Or, if the OS on the target in question is not very sophisticated, it may simply access memory directly. > If the object program uses ioperm and iopl to get the permission to > read(write) IO port, can the gdb access the IO port also? Again, it depends. On most unix systems, this sort of thing is a security hole and is usually disallowed. But when using a "cross" debugger with a remote board, it may be that the OS of the board will allow access it IO ports. Kevin