public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* feature request: DWARF-based sizeof(), array_size(), typeof()
@ 2015-03-17 21:45 Stephane Chazelas
  2015-04-01 17:49 ` David Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2015-03-17 21:45 UTC (permalink / raw)
  To: systemtap

Hello,

recently, I found myself needing to loop over the elements of a
kernel array
(http://stackoverflow.com/questions/29034267/get-size-of-target-array-in-systemtap)

Though there are ways to get that information (parse symdata(),
use C code relying on internal APIs), none of them are
straighforward or ideal.

It would be nice if operators like sizeof(addr) (to retrieve the
size of a symbol at a given address) and array_size(addr) (to
retrieve the number of elements if that is an array). be added
to systemtap.

A typeof() one could be nice as well (especially if we can
combine it with @cast).

What do you think?
Stephane

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

* Re: feature request: DWARF-based sizeof(), array_size(), typeof()
  2015-03-17 21:45 feature request: DWARF-based sizeof(), array_size(), typeof() Stephane Chazelas
@ 2015-04-01 17:49 ` David Smith
  0 siblings, 0 replies; 2+ messages in thread
From: David Smith @ 2015-04-01 17:49 UTC (permalink / raw)
  To: Stephane Chazelas, systemtap

On 03/17/2015 04:22 PM, Stephane Chazelas wrote:
> Hello,
> 
> recently, I found myself needing to loop over the elements of a
> kernel array
> (http://stackoverflow.com/questions/29034267/get-size-of-target-array-in-systemtap)
> 
> Though there are ways to get that information (parse symdata(),
> use C code relying on internal APIs), none of them are
> straighforward or ideal.
> 
> It would be nice if operators like sizeof(addr) (to retrieve the
> size of a symbol at a given address) and array_size(addr) (to
> retrieve the number of elements if that is an array). be added
> to systemtap.
> 
> A typeof() one could be nice as well (especially if we can
> combine it with @cast).
> 
> What do you think?

It is an interesting idea, although since that really isn't my area of
expertise I'm not sure how easy/possible those operators would be.

I filed PR18191 on your idea so we won't lose it. Please CC yourself on
that bug.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

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

end of thread, other threads:[~2015-04-01 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 21:45 feature request: DWARF-based sizeof(), array_size(), typeof() Stephane Chazelas
2015-04-01 17:49 ` David Smith

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).