From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2770 invoked by alias); 12 Dec 2003 15:07:31 -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 2744 invoked from network); 12 Dec 2003 15:07:31 -0000 Received: from unknown (HELO svr44.ehostpros.com) (66.98.192.92) by sources.redhat.com with SMTP; 12 Dec 2003 15:07:31 -0000 Received: from [61.11.17.253] (port=10035 helo=askii-pc) by svr44.ehostpros.com with asmtp (Exim 4.24) id 1AUot8-0004vk-Is; Fri, 12 Dec 2003 07:07:30 -0800 From: "Amit S. Kale" Organization: EmSysSoft To: Daniel Jacobowitz Subject: Re: gdbserver ps_lgetregs implementation for nptl Date: Fri, 12 Dec 2003 15:07:00 -0000 User-Agent: KMail/1.5 Cc: gdb@sources.redhat.com References: <200312111513.23927.amitkale@emsyssoft.com> <20031211141429.GB26315@nevyn.them.org> In-Reply-To: <20031211141429.GB26315@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200312122036.57453.amitkale@emsyssoft.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - svr44.ehostpros.com X-AntiAbuse: Original Domain - sources.redhat.com X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - emsyssoft.com X-SW-Source: 2003-12/txt/msg00181.txt.bz2 Implementing the commented out code was trivial for i386 because it already has register sets. I implemented all ps_*getregs functions. A change was needed in gdb. I had to add support for qSymbol in remote.c:remote_wait. This was needed for a symbol query from nptl. I am pasting below code from ps_lsetregs modified by me. I removed creation of a register cache. before fetch_registers and fill_function. Is this the right way of doing it? ---- ps_err_e ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset) { struct thread_info *reg_inferior, *save_inferior; reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid); if (reg_inferior == NULL) return PS_ERR; save_inferior = current_inferior; current_inferior = reg_inferior; the_target->fetch_registers (0); gregset_info()->fill_function (gregset); current_inferior = save_inferior; return PS_OK; } ----- On Thursday 11 Dec 2003 7:44 pm, Daniel Jacobowitz wrote: > On Thu, Dec 11, 2003 at 03:13:23PM +0530, Amit S. Kale wrote: > > Hi, > > > > I am trying to debug nptl programs using gdbserver on x86 platform. First > > problem I found was missing ps_get_thread_area, which was easy to copy > > from the implementation in gdb. Then error return from ps_lgetregs caused > > a problem. ps_lgetregs has come code, though it's commented out. Any > > ideas on completing that code? > > I've been meaning to make it work with NPTL and not found the time... > However, it will take more than making it load to make it work. I > expect that it will also require an extension to the remote protocol to > query the thread base address. > > ps_get_thread_area in LinuxThreads was only called by functions that > gdbserver did not use. If it's necessary for LinuxThreads - it appears > to be - then you'll have to supply a working version. This will > require describing register sets in gdbserver, which it already can do > on some platforms (see the code that uses PTRACE_GETREGS). -- Amit Kale EmSysSoft (http://www.emsyssoft.com) KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)