* Re: Accessing size of arrays allocated on the stack
[not found] <45431.3344126151$1355336405@news.gmane.org>
@ 2012-12-12 23:19 ` Frank Ch. Eigler
0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2012-12-12 23:19 UTC (permalink / raw)
To: Alex.Hoole; +Cc: systemtap
Hi, Alexander --
Alexander.Hoole wrote:
> I noticed that systemtap is able to know that a local variable, allocated on
> the stack, is an array. [...]
> Does SystemTap presently support the ability to determine the size of local
> arrays using either built-in functionality or embedded C?
Not well. There is a sizeof.stp sample, but that works for type names
that are resolvable via the @cast() construct, not general C type
declaration strings, and not references to a varable. Via embedded-C
of course one can do anything one wants (return sizeof(some_c_type))
but that code doesn't have access to the DWARF data stap has
processed.
To get array bounds, stap would have to search for stuff like
DW_TAG_subrange_type -> DW_AT_upper_bound (which "extern array[];"
declarations won't have). Stap would have to export this through
some new language feature, perhaps @byte_size($foo) (if one wants
all the array dimensions/element-sizes multiplied out).
- FChE
^ permalink raw reply [flat|nested] 2+ messages in thread
* Accessing size of arrays allocated on the stack
@ 2012-12-12 18:19 Alexander M. Hoole
0 siblings, 0 replies; 2+ messages in thread
From: Alexander M. Hoole @ 2012-12-12 18:19 UTC (permalink / raw)
To: systemtap
I noticed that systemtap is able to know that a local variable, allocated on
the stack, is an array. For example, a program containing:
...
int main(int argc, char *argv[])
{
char buf[40];
unsigned long p;
char *str;
...
With a probe containing:
...
probe process("./array_test").function("main").call {
log (probefunc()." param: ".$$parms)
log (probefunc()." locals: ".$$locals)
...
Produces
...
main param: argc=0x2 argv=0xbfeb9954
main local: buf=[...] p=0x160c7d7e str=0x3e9a9883
...
Does SystemTap presently support the ability to determine the size of local
arrays using either built-in functionality or embedded C?
Does this differ for user-space vs kernel-space probes?
Cheers,
A
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-12 23:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <45431.3344126151$1355336405@news.gmane.org>
2012-12-12 23:19 ` Accessing size of arrays allocated on the stack Frank Ch. Eigler
2012-12-12 18:19 Alexander M. Hoole
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).