On Sun, Aug 21, 2011 at 9:47 PM, Julia Lawall <[email protected]> wrote:

> On Mon, 22 Aug 2011, Simon Hardy-Francis wrote:
>
> > Julia Lawall <julia <at> diku.dk> writes:
> >
> > >
> > > On Sun, 21 Aug 2011, SF Markus Elfring wrote:
> > >
> > > > > Include files are mostly useful for giving type information.
> > > >
> > > > I have got a different view on this matter.
> > >
> > > Sorry, I didn't mean it as a general statement.  In the context of
> > > Coccinelle, include files are mostly useful for giving type
> information.
> >
> > I guess then that Coccinelle just won't work on some C source code that
> heavily
> > employs and uses header files and the pre-processor.
>
> It works.  You can give some hints about macro definitions.  Usually a
> very small number is enough.  Otherwise it uses some heuristics to find
> its way around, and ignores top-level items it can't parse.  On the other
> hand, if your code is written in a way that looks nothing like C, then it
> probably won't work.
>
> > What I'm really looking for is a tool which gives me a lot of the debug
> > information (that usually gets generated by e.g. gcc and placed in the
> > executable for e.g. debugger usage; e.g. statement/token type, line
> > number, file, ...) but without having to compile the C file and extract
> > that debug info. I was hoping that there might be a way to get
> > Coccinelle to examine a particular C source code file and tell me all
> > about it... in a similar way that the debug info tells me a lot about
> > the C source file.
>
> I think you would have to be more concrete.  Do you want to obtain this
> information in advance or at run time, eg when a crash occurs?  Could you
> give an example of the output you would like for a small program?
>

Thanks for the question. So I don't need the info at run-time. I'd like to
have a sort of C equivalent to this Perl module which can do 'round trip'
parsing of Perl source code into a structured, hierarchical format, and back
into Perl source code:
http://search.cpan.org/~adamk/PPI-1.215/lib/PPI.pm

The would be that the small program would output parsed info about the C
source file, e.g. like the -tokens_c output but hierarchical and with extra
info such as labeling the parts of the output for what they are, e.g. a
function, a variable declaration, a struct declaration, an assignment, etc.

Get the idea now?

Thanks,
Simon


> julia
>
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to