Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

SDV needs a little work

Jan_BottorffJan_Bottorff Member - All Emails Posts: 469
I just spent 3 days getting static driver verifier to work on a pretty simple driver and thought I'd share the silliness I had to jump though.

There were two major root problems:

SDV chokes on TraceLoggingProvider.h if included in a .cpp file. You don't have to use anything in the .h, simply including it causes the problem. I was fortunate there was only a small amount of code that required C++ mode, and after converting it back to generic C, and renaming the file to .c, SDV stopped complaining about this issue, and TraceLogging calls were happy. If using pure C was not an option, another potential (untested) workaround would be to make a custom TraceLoggingProvider.h with all the _CPLUSPLUS #ifdef sections removed/deactivated.

The second problem was SDV can't parse quoted strings passed as compiler /D options. I had a version string which was set in the project as VERSION_STRING="" in the compiler defines section. Actually my project set VERSION_STRING=$(VERSION_STRING) which passes the msbuild property which had the value "", which I set in a .props file, but the simpler literal quoted string also fails. This gave a very cryptic error about a link failure, and none of the standard SDV log files seems to say anything about a link failure. I eventually used the debug SDV build: msbuild /t:sdv /p:Inputs="/check:* /debug" mydriver.VcxProj /p:Configuration="Release" /p:Platform=x64 , described at Running the SDV msbuild from the command line ended in an error on the final compile of dynamicbus, and a log was being generated a couple directories down. The log had a bunch of warnings and a fatal error that warning.h could not be found. Looking at the command line it used for the compiler, the quoted version string was clearly corrupted, like VERSION_STRING='/||"". The workaround was to pass the unquoted value and then use the preprocessor stringize operator/macro to turn it into "". The normal compiler is perfectly happy to use a quoted string.

After all this fooling around, SDV reported there were no errors detected, but didn't offer to give me 3 days back.

The project built just fine normally and only had issues with SDV builds. I'm not sure when these regressions were introduced, although I know a driver written about 2 years ago used TraceLoggingProvider.h and SDV worked as that driver passed the HLK tests. I've been using the .props file for version data for probably about 7 years now. I almost always use .cpp files, and it's about 50/50 I use any C++ features in a driver.

In future WDK releases, I'd like to see MSFT do a little broader testing of SDV, like do the MSFT include files actually compile under SDV ok. I'd also like to see the SDV UI panel have a little checkbox for SDV debugging enabled, it's such fun to have a fatal tool error and zero clues in any log files.

On this project, a simple KMDF driver, SDV was more pain than benefits.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!