This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How can I access ULONG_MAX constant without using -g option?
- From: David Smith <dsmith at redhat dot com>
- To: Tetsuo Handa <penguin-kernel at I-love dot SAKURA dot ne dot jp>, systemtap at sourceware dot org
- Date: Thu, 08 May 2014 12:03:29 -0500
- Subject: Re: How can I access ULONG_MAX constant without using -g option?
- Authentication-results: sourceware.org; auth=none
- References: <201405061502 dot JDC34371 dot FFVOSFQtOOHMJL at I-love dot SAKURA dot ne dot jp>
On 05/06/2014 01:02 AM, Tetsuo Handa wrote:
> Hello.
>
> I'm using systemtap-2.3-4.el6_5.i686 and I need to mask a value with ULONG_MAX
> constant because task_current() returns 64bits value on 32bits architecture.
>
> # uname -m
> i686
> # stap -e 'probe begin { printf("current=%lx\n", task_current()); exit(); }'
> current=ffffffffc1681aa0
>
> In the example output above, current=c1681aa0 is the expected value on i686.
>
> I know I can wrap like
>
> function get_current:long() {
> return task_current() & %{ ULONG_MAX %};
> }
>
> and use get_current() instead of task_current(), but this needs -g option.
> Is there a way to do it without using -g option?
>
> Regards.
I think fixing this in task_current() is the right way to go here, but
there is a way around this without using '-g'. Also note that it is
gross (and untested):
====
function get_current:long()
{
%( arch == "i386" || arch == "arm" %?
return task_current() & 0xffffffff
%:
return task_current() & 0xffffffffffffffff
%)
}
====
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)