From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18135 invoked by alias); 21 Aug 2006 18:50:05 -0000 Received: (qmail 18112 invoked by uid 22791); 21 Aug 2006 18:50:01 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.169) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 21 Aug 2006 18:49:56 +0000 Received: by ug-out-1314.google.com with SMTP id u2so1847711uge for ; Mon, 21 Aug 2006 11:49:53 -0700 (PDT) Received: by 10.67.103.7 with SMTP id f7mr3867707ugm; Mon, 21 Aug 2006 11:49:53 -0700 (PDT) Received: by 10.67.101.17 with HTTP; Mon, 21 Aug 2006 11:49:53 -0700 (PDT) Message-ID: Date: Mon, 21 Aug 2006 18:50:00 -0000 From: "Cai Qian" To: "Michael Snyder" Subject: Re: Virtual Machine and GDB Cc: gdb@sourceware.org In-Reply-To: <1156184892.8438.18.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060821000736.GA2596@nevyn.them.org> <44E9E787.9010202@cse.unl.edu> <1156184892.8438.18.camel@localhost.localdomain> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00171.txt.bz2 Hi, On 8/21/06, Michael Snyder wrote: > On Mon, 2006-08-21 at 18:59 +0100, Cai Qian wrote: > > Hi, > > > > On 8/21/06, Neo wrote: > > > Cai, > > > > > > I am wondering why you need to debug the VM remotely. Maybe you have > > > your own requirements, such as for embedded systems. But I think you > > > need to first make sure you can debug any binary running on your target > > > board remotely. Then, you can treat the VM as the rest ordinary binary. > > > > > > > I don't want to debug VM itself here, but executable running on the > > VM. As my VM has a new instruction set, and GDB is quite unlikely to > > run locally. > > OK, so you have two issues: > 1) You need to get gdbserver running in your VM, and provide > some means for gdbserver to talk to a gdb that is running in the > outside world. Unles you have access to a serial port, the > obvious way to do this is to get a IP stack running in the VM, > assign it an IP address, and let gdbserver open up a socket. > Then gdb (running somewhere outside of the VM) can attach to > the socket. > I have implemented a debug server in VM. At the moment, it can read the RSP messages from remote GDB through socket. So, I think I have done this part. > 2) You need to teach gdb to understand the architecture of > your virtual machine -- the word size, the instruction language, > the register set, and so forth. That doesn't mean porting gdb > to RUN on the VM -- it just means teaching gdb how to DEBUG > the VM (meaning, debug something that is running in the VM). > How can I achieve this part? At the moment, after received a packet from remote GDB, I am trying to parse the packet first, and then send the right response to GDB. For example, if VM received a "info registers" command at the debug socket, it will try to collect register information, and then generate a right RSP message back. Or, if it received "next", I can set a flag in VM to indicate to only execute one instruction. Is that a right way to do? Qian > > > > >