From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18462 invoked by alias); 9 May 2005 19:53:50 -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 18302 invoked from network); 9 May 2005 19:53:35 -0000 Received: from unknown (HELO brmx1.boca.ssc.siemens.com) (12.147.96.32) by sourceware.org with SMTP; 9 May 2005 19:53:35 -0000 Received: from fdns2.rolm.com (localhost [127.0.0.1]) by brmx1.boca.ssc.siemens.com (8.12.10/8.12.10) with ESMTP id j49JrMMK005006; Mon, 9 May 2005 15:53:22 -0400 Received: from stca200a.bus.sc.rolm.com (stca200a.bus.sc.rolm.com [165.218.68.180]) by fdns2.rolm.com (8.12.10/8.12.10) with ESMTP id j49JrM5Z003655; Mon, 9 May 2005 12:53:22 -0700 (PDT) Received: by stca200a.bus.sc.rolm.com with Internet Mail Service (5.5.2657.72) id ; Mon, 9 May 2005 12:53:22 -0700 Message-ID: <2DA8F872430BE8469BF0F403A6103F9205CFCC@stca20aa.bocc.icn.siemens.com> From: "Bloch, Jack" To: "'Daniel Jacobowitz'" Cc: gdb@sources.redhat.com Subject: RE: Reading target registers Date: Mon, 09 May 2005 19:53:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2005-05/txt/msg00121.txt.bz2 Thanks, I also waituntil the target is stopped before reading the registers. I get a value, just not the correct value. I noticed that I get the same incorrect value as the lsstack application which uses ptrace(PTRACE_PEEKUSER,l_pid,EIP*4,0) But GDB gets the correc value. I'm assuming it is something with my linking or which version of user I'm including. I may be way off here but any help is appreciated. -----Original Message----- From: Daniel Jacobowitz [mailto:drow@false.org] Sent: Monday, May 09, 2005 3:50 PM To: Bloch, Jack Cc: gdb@sources.redhat.com Subject: Re: Reading target registers On Mon, May 09, 2005 at 12:44:05PM -0700, Bloch, Jack wrote: > While this is not a direct GDB question, I'm hoping someone can answer me. I > have an application which uses the ptrace interface to attach to a target > process and read the target registers (I'm specifically interested in the > EIP). It will run on a SuSE 2.6 Kernel x86 based machine. My code is below. You can only use PTRACE_GETREGS when the process is stopped; that may be the problem. After attaching be sure to wait(). Otherwise, try stracing to see what's going on. -- Daniel Jacobowitz CodeSourcery, LLC