* [9fans] prof
@ 2000-08-11 13:10 D. Brownlee
2000-08-11 14:03 ` D. Brownlee
0 siblings, 1 reply; 7+ messages in thread
From: D. Brownlee @ 2000-08-11 13:10 UTC (permalink / raw)
To: 9fans
Hello,
This program:
main()
{
void f(char *);
f("hello\n");
}
f(char *s)
{
printf("%s", s);
}
produces, with 'prof -d' the following output:
main:0
. printf:0
. vfprintf:0
. qlock:0
. . lock:0
etc.
This indicates that 'main' calls 'qlock', but I
think that 'qlock' is actually called by 'vfprintf'. (?)
Another question: has anyone done anything with the
compiler to generate a static flow graph -- something
like 'cflow'?
D. Brownlee
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
2000-08-11 13:10 [9fans] prof D. Brownlee
@ 2000-08-11 14:03 ` D. Brownlee
0 siblings, 0 replies; 7+ messages in thread
From: D. Brownlee @ 2000-08-11 14:03 UTC (permalink / raw)
To: 9fans
Whoops! That should be:
main:0
. f:0
. printf:0
. vprintf:0
. qlock:0
. . lock:0
etc.
D. Brownlee wrote:
>
deleted
>
> produces, with 'prof -d' the following output:
>
> main:0
> . printf:0
> . vfprintf:0
> . qlock:0
> . . lock:0
> etc.
>
> This indicates that 'main' calls 'qlock', but I
> think that 'qlock' is actually called by 'vfprintf'. (?)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
2000-08-11 14:19 forsyth
2000-08-11 18:22 ` D. Brownlee
@ 2000-08-15 4:15 ` D. Brownlee
1 sibling, 0 replies; 7+ messages in thread
From: D. Brownlee @ 2000-08-15 4:15 UTC (permalink / raw)
To: 9fans
forsyth@vitanuova.com wrote:
>
> >>Another question: has anyone done anything with the
> >>compiler to generate a static flow graph -- something
> >>like 'cflow'?
>
> i have changes to one of the linkers somewhere.
> it also checked stack depth.
I got curious and came up with this after a minor change:
%term diff /sys/src/cmd/8l/pass.c pass.c
306a307
> mydiag("%s calls %s", TNAME, s->name);
308d308
< diag("undefined: %s in %s\n", s->name, TNAME);
void mydiag(char *fmt, ...); -- after diag() in list.c
This yields alot of lines of the form:
caller calls callee
It looks like a fairly simple job for 'awk', maybe 'rc', to
process those lines and produce the flow graph. Thanks for
the clue about using the linker instead of the compiler; I'll
even get things that were written in assembler.
Later,
D. Brownlee
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
@ 2000-08-11 21:14 forsyth
0 siblings, 0 replies; 7+ messages in thread
From: forsyth @ 2000-08-11 21:14 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 90 bytes --]
the linker knows all.
i'll try to unearth the code, or reproduce it.
it wasn't hard.
[-- Attachment #2: Type: message/rfc822, Size: 2245 bytes --]
From: "D. Brownlee" <ancipites@earthlink.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] prof
Date: Fri, 11 Aug 2000 11:22:17 -0700
Message-ID: <39944459.C86EAAFE@earthlink.net>
It would be nice to see the linker
change. I was thinking of modifying
the compiler's 'codgen' to create a
bunch of temp files that identify
function definitions and the functions
called within them, then process those
to get a static flow graph.
forsyth@vitanuova.com wrote:
>
> >>Another question: has anyone done anything with the
> >>compiler to generate a static flow graph -- something
> >>like 'cflow'?
>
> i have changes to one of the linkers somewhere.
> it also checked stack depth.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
2000-08-11 14:19 forsyth
@ 2000-08-11 18:22 ` D. Brownlee
2000-08-15 4:15 ` D. Brownlee
1 sibling, 0 replies; 7+ messages in thread
From: D. Brownlee @ 2000-08-11 18:22 UTC (permalink / raw)
To: 9fans
It would be nice to see the linker
change. I was thinking of modifying
the compiler's 'codgen' to create a
bunch of temp files that identify
function definitions and the functions
called within them, then process those
to get a static flow graph.
forsyth@vitanuova.com wrote:
>
> >>Another question: has anyone done anything with the
> >>compiler to generate a static flow graph -- something
> >>like 'cflow'?
>
> i have changes to one of the linkers somewhere.
> it also checked stack depth.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
@ 2000-08-11 14:23 Russ Cox
0 siblings, 0 replies; 7+ messages in thread
From: Russ Cox @ 2000-08-11 14:23 UTC (permalink / raw)
To: 9fans
the problem is likely that rio uses 4-space
tabs, while prof assumes 8-space. try
prof | pr -t -e8
and the output will probably make more sense.
the extra . on the lock line as compared with
the vprintf line shows that they're not actually
lined up as they seem to be.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] prof
@ 2000-08-11 14:19 forsyth
2000-08-11 18:22 ` D. Brownlee
2000-08-15 4:15 ` D. Brownlee
0 siblings, 2 replies; 7+ messages in thread
From: forsyth @ 2000-08-11 14:19 UTC (permalink / raw)
To: 9fans
>>Another question: has anyone done anything with the
>>compiler to generate a static flow graph -- something
>>like 'cflow'?
i have changes to one of the linkers somewhere.
it also checked stack depth.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2000-08-15 4:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-11 13:10 [9fans] prof D. Brownlee
2000-08-11 14:03 ` D. Brownlee
2000-08-11 14:19 forsyth
2000-08-11 18:22 ` D. Brownlee
2000-08-15 4:15 ` D. Brownlee
2000-08-11 14:23 Russ Cox
2000-08-11 21:14 forsyth
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 NNTP newsgroup(s).