Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for WPP tracing #236

Open
fulopboti opened this issue Feb 9, 2018 · 2 comments
Open

Support for WPP tracing #236

fulopboti opened this issue Feb 9, 2018 · 2 comments
Assignees
Projects

Comments

@fulopboti
Copy link

fulopboti commented Feb 9, 2018

Projects which use WPP tracing (WindowsAplicationForDriversXX) and do include the tmh files will raise errors such as:
C:\...\myfile.c:8:10: fatal error: 'myfile.tmh' file not found

example source file:

#include "myfile.h"
#include "trace.h"
#include "myfile.tmh"

int square(int num) {
    return num*num;
}

example trace.h:

#ifndef __TRACE_H_INCLUDED__
#define __TRACE_H_INCLUDED__
//
// WPP Control GUID for MyProject: 2DC429B3-080F-4539-A340-D1C707D47E31
//
#define WPP_CONTROL_GUIDS                                              \
    WPP_DEFINE_CONTROL_GUID(                                           \
        MyProject, (2DC429B3,080F,4539,A340,D1C707D47E31),      \
        WPP_DEFINE_BIT(TRACE_FLAG_APPLICATION)      /* bit  0 = 0x00000001 */ \
        ) 

#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAGS_ENABLED(lvl,flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level  >= lvl)


#define WPP_LEVEL_FLAGS_TIMESTAMP_LOGGER(lvl, flags, tmpstamp) WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAGS_TIMESTAMP_ENABLED(lvl, flags, tmpstamp) WPP_LEVEL_FLAGS_ENABLED(lvl, flags)

//
// Here we define our logging functions
//
// begin_wpp config
//
// FUNC AppLogTrace{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=TRACE_FLAG_APPLICATION}(MSG, ...);
// FUNC AppLogInfo{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=TRACE_FLAG_APPLICATION}(MSG, ...);
// FUNC AppLogWarning{LEVEL=TRACE_LEVEL_WARNING, FLAGS=TRACE_FLAG_APPLICATION}(MSG, ...);
// FUNC AppLogError{LEVEL=TRACE_LEVEL_ERROR, FLAGS=TRACE_FLAG_APPLICATION}(MSG, ...);
// FUNC AppLogCritical{LEVEL=TRACE_LEVEL_CRITICAL, FLAGS=TRACE_FLAG_APPLICATION}(MSG, ...);
//
// end_wpp
//


#endif//__TRACE_H_INCLUDED__
@cpp-red-lion
Copy link
Contributor

Hi,

Thank you for bringing this issue to our attention.

Can you attach a small sample VS project (with source files) reproducing this problem?

@fulopboti
Copy link
Author

Hi,
I have attached a zip for a sample application.

Afaik MsBuild uses a WPP precompiler, which generates these tmh files, which contains macros for logging messages trough ETW.

From a procmon log we can see that the MsBuild.exe starts the C:\Program Files (x86)\MSBuild\14.0\bin\Tracker.exe with a commandline which then starts the tracewpp.exe, to generate these tmh files.

As a solution you could generate temporary tmh files which contain only the macros with empty bodies from the comment in the trace.h file.

SampleApp.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
CPT-Backlog
Awaiting triage
Development

No branches or pull requests

3 participants