My Wine static analysis tool

Damjan Jovanovic damjan.jov at gmail.com
Tue Jan 15 11:51:34 CST 2013


Hi

I've hacked together a simple tool for analyzing Wine code. Currently
it can do the following:
1. Find BOOL functions returning non-BOOL.
2. Find HRESULT functions returning non-HRESULTs.
3. Generate a TRACE() for each function showing all its parameters.

It isn't really a formal C parser, as it ignores all preprocessor
directives, but this makes it *much* simpler and shorter than a real C
parser, and it sees original Windows types like LPCWSTR etc. It's not
100% accurate, but it's very effective. 3 of my recent patches have
been generated with its help - and I've barely gotten started.

I'd like to add the following features at some stage:
* Populate all functions with a TRACE() of their arguments, if they
don't already have it.
* Scan all GUIDs in include/ and generate a full list of all GUIDs and
their names. Then patch debugstr_guid() to also output the name of the
GUID when available, and/or search and replace GUIDs in WINEDEBUG
traces after they've been recorded.
* Update .spec files from .c file contents, and verify .spec file accuracy.
* It could be extended to examine contents of functions and enforce
the absence of W->A and 32->16 calls, etc.
* etc.

Anybody interested in using it or helping develop it?

Regards
Damjan



More information about the wine-devel mailing list