From: "Mark Kettenis" <mark.kettenis@xs4all.nl>
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
Subject: Re: [Fastboot] Re: [-mm patch] i386: enable REGPARM by default
Date: Wed, 29 Jun 2005 10:08:00 -0000 [thread overview]
Message-ID: <8824.192.87.1.200.1120039619.squirrel@192.87.1.200> (raw)
In-Reply-To: <20050629083452.GC3771@in.ibm.com>
> On Tue, Jun 28, 2005 at 09:59:36PM +0200, Mark Kettenis wrote:
>> Date: Tue, 28 Jun 2005 16:54:12 +0530
>> From: Vivek Goyal <vgoyal@in.ibm.com>
>>
>> > 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.
>>
>
>
> In this case I am building linux kernel with debug info (-g) and -mregparm
> is not specified. So parameters should be passed on stack. Following
> is the effective command line to build kernel/sysfs.c. I am not sure if
> any of the below mentioned options are going to affect the gdb results.
>
> gcc -m32 -Wp,-MD,kernel/.ksysfs.o.d -nostdinc -isystem
> /usr/lib/gcc/i386-redhat-linux/3.4.3/include -D__KERNEL__ -Iinclude
> -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
> -fno-common -ffreestanding -O2 -fomit-frame-pointer -g -pipe
> -msoft-float -mpreferred-stack-boundary=2 -fno-unit-at-a-time
> -march=i686 -mtune=pentium4 -Iinclude/asm-i386/mach-default
> -Wdeclaration-after-statement -DKBUILD_BASENAME=ksysfs
> -DKBUILD_MODNAME=ksysfs -c -o kernel/ksysfs.o kernel/ksysfs.c
-O2 will have some effect. The compiler might optimize away variables
(including function arguments) and doesn't always record that fact in
the debug information.
But the real killer here is probably -fomit-frame-pointer. Last time I
looked GCC didn't generate the correct debug information in that case.
I didn't really look into this, but it seemed as if GCC blindly produces
location descriptions relative to the frame pointer even though there no
longer is a frame pointer. GCC 4.0 or 4.1 might have this fixed.
>
>> 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.
>
> Sorry for the confusion. In the last mail all the results were reported
> with REGPARM disabled. I wanted to make sure that first normal case works
> fine and then discuss the REGPARM case later.
If you're prepared to do some more tests, you might want to check out
what happens if you leave out -O2 and -fomit-frame-pointer, and then add
back only -O2
Mark
next prev parent reply other threads:[~2005-06-29 10:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050624200916.GJ6656@stusta.de>
[not found] ` <20050624132826.4cdfb63c.akpm@osdl.org>
2005-06-27 13:30 ` Vivek Goyal
2005-06-27 14:00 ` Daniel Jacobowitz
2005-06-28 4:51 ` Vivek Goyal
2005-06-28 11:24 ` Vivek Goyal
2005-06-28 20:00 ` Mark Kettenis
2005-06-29 8:35 ` Vivek Goyal
2005-06-29 10:08 ` Mark Kettenis [this message]
2005-06-29 11:47 ` Vivek Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8824.192.87.1.200.1120039619.squirrel@192.87.1.200 \
--to=mark.kettenis@xs4all.nl \
--cc=akpm@osdl.org \
--cc=alexn@dsv.su.se \
--cc=bunk@stusta.de \
--cc=dan@debian.org \
--cc=fastboot@lists.osdl.org \
--cc=gdb@sources.redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vgoyal@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox