public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* About function parameter access
@ 2005-11-17  5:30 Mao, Bibo
  2005-11-17 22:12 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Mao, Bibo @ 2005-11-17  5:30 UTC (permalink / raw)
  To: fche; +Cc: systemtap, Keshavamurthy, Anil S, Zhang, Yanmin

Hi all,
I find that there maybe exists one problem when accessing function
parameter. From the translated script, we can see that it uses MACRO
fetch_register to parameter value. Always in IA32 the first parameter is
placed in EAX register, and the macro is  fetch_register(0).

But when function is with asmlinkage prefix, it is stored in stack, but
not in register. Maybe it the same reason with what has been reported
as: http://sourceware.org/bugzilla/show_bug.cgi?id=1868

And I has tested systemtap.samples/sysopen.stp, this function is
prefixed with asmlinkage, filename parameter is accessed by MACRO
fetch_register(0).

Regards
Bibo,mao

^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: About function parameter access
@ 2005-11-18  8:02 Mao, Bibo
  2005-11-18 22:31 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Mao, Bibo @ 2005-11-18  8:02 UTC (permalink / raw)
  To: Roland McGrath; +Cc: systemtap

I write a simple script to test function parameter access. The test case is shown as follows:
	#! stap
	global filename, flags, mode
		probe kernel.function("sys_open") {
 	 filename = $filename;
 	 flags    = $flags;
	 mode     = $mode;
	}
And I test is in IA32 and IA64 platform, in IA32 I use fedora4, only that Linux kernel version is different and it is 2.6.15-rc1, and gcc versoin is 4.0.0 20050519 (Red Hat 4.0.0-8),and it is default for fedora4. It gets filename value by MACRO fetch_register(0). But from the objdumped file, we can see that it should be from stack because of sys_open is prefixed with asmlinkage flag.

And in ia64 platform, the linux distribution version is RHEL4-U2, gcc version is 3.4.4 20050721 (Red Hat 3.4.4-2). When it boots from system default kernel 2.6.9-22, parameter access result is ok. But when it boots from 2.6.15-rc1 kernel version, the parameter access result is wrong.

Regards
Bibo,mao

>-----Original Message-----
>From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org]
>On Behalf Of Roland McGrath
>Sent: 2005年11月18日 6:12
>To: Mao, Bibo
>Cc: systemtap@sources.redhat.com
>Subject: Re: About function parameter access
>
>Target variable access is driven by the DWARF information emitted by the
>compiler.  We have encountered compiler bugs in producing this before, and
>probably will again.  You need to file a bug report giving exact details of
>the kernel used and how it was compiled (if it's not a RH-produced RPM),
>so we can investigate.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-18 22:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-17  5:30 About function parameter access Mao, Bibo
2005-11-17 22:12 ` Roland McGrath
2005-11-18  8:02 Mao, Bibo
2005-11-18 22:31 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).