From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12703 invoked by alias); 28 Jun 2005 20:00:39 -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 12638 invoked by uid 22791); 28 Jun 2005 20:00:34 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 28 Jun 2005 20:00:34 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j5SJxkGw004696; Tue, 28 Jun 2005 21:59:46 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id j5SJxjZN014339; Tue, 28 Jun 2005 21:59:45 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id j5SJxaeM022138; Tue, 28 Jun 2005 21:59:36 +0200 (CEST) Date: Tue, 28 Jun 2005 20:00:00 -0000 Message-Id: <200506281959.j5SJxaeM022138@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: vgoyal@in.ibm.com CC: gdb@sources.redhat.com, dan@debian.org, fastboot@lists.osdl.org, linux-kernel@vger.kernel.org, akpm@osdl.org, bunk@stusta.de, alexn@dsv.su.se In-reply-to: <20050628112412.GB5652@in.ibm.com> (message from Vivek Goyal on Tue, 28 Jun 2005 16:54:12 +0530) Subject: Re: [Fastboot] Re: [-mm patch] i386: enable REGPARM by default References: <20050624200916.GJ6656@stusta.de> <20050624132826.4cdfb63c.akpm@osdl.org> <20050627132941.GD3764@in.ibm.com> <20050627140029.GB29121@nevyn.them.org> <20050628045111.GB4296@in.ibm.com> <20050628112412.GB5652@in.ibm.com> X-SW-Source: 2005-06/txt/msg00298.txt.bz2 Date: Tue, 28 Jun 2005 16:54:12 +0530 From: Vivek Goyal > Thanks. Any idea what might be amiss with my case where I am not seeing > proper function parameter values while analyzing kdump generated crash > dump with gdb. I am using following gdb and gcc versions. > > GNU gdb Red Hat Linux (6.1post-1.20040607.62rh) > gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) > Some more info. I dumped the stack contents and it seems that stack is fine and parameters are intact on stack. So now it seems to be a matter of how gdb is interpreting the stack contents. Any guess, what the problem is? I'd say the problem is with a user building stuff with non-standard "optimizations", probably even stripping his executable, and expecting to be able to debug the result. Why func2() and func1() are not showing right parameter values. Repeating what Daniel said before, by using "regparm", function arguments are now passed in registers instead of on the stack. It's extremely unlikely that these function arguments will stay in those registers for ever, especially since you've only got a handfull of them on the i386. So eventually they will be moved to some other register or, more likely, to memory. If the compiler doesn't tell gdb about it, gdb will still think the value is in the register, and display whatever what's there now, which is likely to be the wrong value. There are two ways the compiler can tell gdb where things are: 1. By explicitly specifying the new location. Both DWARF 2 and stabs debugging formats can do this, but AFAIK, GCC won't do this if a register is spilled to the stack. 2. By specifying where registers are saved. Only DWARF 2 can do this. We've seen cases where the information generated by GCC for 1 or 2 is either incomplete or wrong. There also have been cases where GDB didn't interpret that information correctly. And then some people tend to remove some of the debug information by stripping their code or using broken linker scripts. You'll need to find out where the problem is, but my bet is that its's a problem with GCC since you make it generate non-standard code. Oh, by the way, don't expect gdb to be able to call "regparm" functions either. Mark