From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8149 invoked by alias); 4 Feb 2008 04:53:47 -0000 Received: (qmail 8140 invoked by uid 22791); 4 Feb 2008 04:53:45 -0000 X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 04 Feb 2008 04:53:28 +0000 Received: by fg-out-1718.google.com with SMTP id e12so1807589fga.0 for ; Sun, 03 Feb 2008 20:53:26 -0800 (PST) Received: by 10.86.96.18 with SMTP id t18mr6213957fgb.13.1202100806018; Sun, 03 Feb 2008 20:53:26 -0800 (PST) Received: by 10.86.52.6 with HTTP; Sun, 3 Feb 2008 20:53:26 -0800 (PST) Message-ID: Date: Mon, 04 Feb 2008 04:53:00 -0000 From: "Neeraj kushwaha" To: gdb@sourceware.org Subject: value of local variable stored in register MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00004.txt.bz2 Hi All, I am trying to find the value of local variable stored in register. But I am getting wrong value from gdb. Here what i am trying #include int main() { int *a=0; volatile register int b=0xabcd; register int c=20; printf("%x\n",b*c); *a=0; return 0; } ------------------------------ ----------------------- GDB info: Core was generated by `./a.out'. Program terminated with signal 11, Segmentation fault. #0 0x080483e1 in main () at 1.c:9 9 *a=0; (gdb) info local a = (int *) 0x0 b = 43981 c = 11305136 (gdb) info reg eax 0x0 0 ecx 0x0 0 edx 0xac80b0 11305136 ebx 0xac6ff4 11300852 esp 0xbfc65a00 0xbfc65a00 ebp 0xbfc65a28 0xbfc65a28 esi 0x973ca0 9911456 edi 0x0 0 eip 0x80483e1 0x80483e1 eflags 0x210282 [ SF IF RF ID ] cs 0x73 115 ss 0x7b 123 ds 0x7b 123 es 0x7b 123 fs 0x0 0 gs 0x33 51 (gdb) The value of local variable is shown as c = 11305136, but actual value is 20. How to get the correct value of variables which are stored in register. Regards Neeraj