* looking for any examples of using sparse
@ 2007-05-09 14:32 Mish Mash
2007-05-10 6:34 ` Mike Goodwin
2007-07-28 17:44 ` looking for any examples of using sparse Randy Dunlap
0 siblings, 2 replies; 4+ messages in thread
From: Mish Mash @ 2007-05-09 14:32 UTC (permalink / raw)
To: linux-sparse
dear all,
I'm trying to use sparse for writing various source code analysis
tools (I was using ctool previously). I'm currently going through the
source trying to figure out what I need. Given the excessive amounts
of comments I'm having to wade through, this probably isn't the
fastest way of figuring the beast out ;)
Does anyone have any notes they've taken or can point me at code that
uses sparse to help get a rough idea of how to use the beast? (Ideally
slightly more detailed than Randy Dunlap's howto) I noticed smatch now
uses sparse and i've applied their patch which I'm going over. Is
there anything better? (I've already found the no longer very useful
presentation at http://developer.osdl.org/dmo/sparse/)
Thanks!
nessim
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: looking for any examples of using sparse
2007-05-09 14:32 looking for any examples of using sparse Mish Mash
@ 2007-05-10 6:34 ` Mike Goodwin
2007-05-10 17:46 ` A Sparse C Interpreter [was: looking for any examples of using sparse] Tommy Thorn
2007-07-28 17:44 ` looking for any examples of using sparse Randy Dunlap
1 sibling, 1 reply; 4+ messages in thread
From: Mike Goodwin @ 2007-05-10 6:34 UTC (permalink / raw)
To: linux-sparse
I hear you, being in a similar situation myself. I believe I roughly
understand what is going on (though mostly I only care about up until
the parsing stage), but not well enough to explain.
Unless there is a trove of documentation I am missing, sparse at the
moment for better or worse seems to be an experts only (experts in
sparse that is!). The excessive amounts of comments I assume is said
with a little 2nd degree. For me what is lacking is the type of broad
comments (at the top of files say) that give an overall idea about how
things fit together - insightful remarks.
Probably most importantly the principal types are largely
undocumented. What invariants apply to them, when and how they will be
used. Ok, tokens are fairly self-explanatory and conventional, but
Symbols... Now I would hasard to say a symbol represents anything that
will be manifested in the compiled code, but this is probably
inaccurate (I am not sure what happens to unused types for instance if
this is true).
A couple of questions then:-
-Preprocessing operates on tokens (i.e. before symbols are created).
So what role to NS_PREPROCESSOR and SYM_PREPROCESSOR have (and why are
both required)?
-What is the meaning of SYM_NODE? (A block or statement in the code??)
From the top of symbol.h:
/*
* An identifier with semantic meaning is a "symbol".
*
* There's a 1:n relationship: each symbol is always
* associated with one identifier, while each identifier
* can have one or more semantic meanings due to C scope
* rules.
*
* The progression is symbol -> token -> identifier. The
* token contains the information on where the symbol was
* declared.
*/
Perhaps this could be elaborated upon.
"The progression is symbol -> token -> identifier."
Is this correct? Not wanting to embarrass myself, I would have thought
it would be something like
tokens->(identifier,symbol), i.e. we start with tokens, which groups
of which form symbols. One in the group will be the identifier. The
identifier structure itself is not namespace specific, so they are
shared between namespaces.
Sorry could say more but that was already longer than intended!
- Mike
On 5/9/07, Mish Mash <khalota@gmail.com> wrote:
> dear all,
>
> I'm trying to use sparse for writing various source code analysis
> tools (I was using ctool previously). I'm currently going through the
> source trying to figure out what I need. Given the excessive amounts
> of comments I'm having to wade through, this probably isn't the
> fastest way of figuring the beast out ;)
>
> Does anyone have any notes they've taken or can point me at code that
> uses sparse to help get a rough idea of how to use the beast? (Ideally
> slightly more detailed than Randy Dunlap's howto) I noticed smatch now
> uses sparse and i've applied their patch which I'm going over. Is
> there anything better? (I've already found the no longer very useful
> presentation at http://developer.osdl.org/dmo/sparse/)
>
> Thanks!
> nessim
> -
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* A Sparse C Interpreter [was: looking for any examples of using sparse]
2007-05-10 6:34 ` Mike Goodwin
@ 2007-05-10 17:46 ` Tommy Thorn
0 siblings, 0 replies; 4+ messages in thread
From: Tommy Thorn @ 2007-05-10 17:46 UTC (permalink / raw)
To: linux-sparse
Mike Goodwin wrote:
> I hear you, being in a similar situation myself. I believe I roughly
> understand what is going on (though mostly I only care about up until
> the parsing stage), but not well enough to explain.
....
One thing I think might be useful, and likely fun to create, is a C interpreter
on top of Sparse. As far as possible, it should use the Sparse data structures
directly (speed is of tertiary concern).
I believe having this would make it easier to understand some of the data
structures in Sparse.
Cheers,
Tommy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: looking for any examples of using sparse
2007-05-09 14:32 looking for any examples of using sparse Mish Mash
2007-05-10 6:34 ` Mike Goodwin
@ 2007-07-28 17:44 ` Randy Dunlap
1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2007-07-28 17:44 UTC (permalink / raw)
To: Mish Mash; +Cc: linux-sparse
On Wed, 9 May 2007 16:32:30 +0200 Mish Mash wrote:
> dear all,
>
> I'm trying to use sparse for writing various source code analysis
> tools (I was using ctool previously). I'm currently going through the
> source trying to figure out what I need. Given the excessive amounts
> of comments I'm having to wade through, this probably isn't the
> fastest way of figuring the beast out ;)
>
> Does anyone have any notes they've taken or can point me at code that
> uses sparse to help get a rough idea of how to use the beast? (Ideally
> slightly more detailed than Randy Dunlap's howto) I noticed smatch now
> uses sparse and i've applied their patch which I'm going over. Is
> there anything better? (I've already found the no longer very useful
> presentation at http://developer.osdl.org/dmo/sparse/)
[belated]
Hi,
My sparse howto was never meant to be a guide to sparse internals,
but agreed, something like that would be very helpful.
My sparse howto is really intended to be a basic/intro user guide since
I didn't find one anywhere else. And I have just updated it --
comments/corrections welcome.
http://www.xenotime.net/linux/sparse/sparse_howto.txt
---
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-28 17:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-09 14:32 looking for any examples of using sparse Mish Mash
2007-05-10 6:34 ` Mike Goodwin
2007-05-10 17:46 ` A Sparse C Interpreter [was: looking for any examples of using sparse] Tommy Thorn
2007-07-28 17:44 ` looking for any examples of using sparse Randy Dunlap
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).