In the Macro use Level not TRACE_LEVEL_INFORMATION. This refers to an
internal WPP control structure not a value.
Must be:
#define WPP_LEVEL_FLAG_ENABLED(lvl, flags) \
(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_##
DBG_NORMAL).Level >= lvl)
RUN_WPP=$(SOURCES)\
-km\
-dll\
-DMacroName\
-func:MyTraceEvents{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=DBG_INIT_1}(MSG,
…)\
-func:TraceEvents(LEVEL,FLAG,MSG…)
MyTraceEvents(“Initializing…%d\n”, Adapter); // for this macro. LEVEL
harcoded to TRACE_LEVEL_INFORMATION, and Flags =DBG_INIT_1 to trcae
Level =4 and Flags = 1
TraceEvents(TRACE_LEVEL_FATAL, DBG_INIT_1, “Failed to initialize
Adapter Status %d”, Adapter);
// Trace if Level= 1 and Flags = 1
Thanks,
Jose Sua
ETW Dev Team
Microsoft Corporation
This posting is provided “AS IS” with no warranties and confers no
rights.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Manasi Deval
Sent: Tuesday, March 15, 2005 9:24 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] enabling wpp
Thanks for all the help. I think I’m closer but not quite done yet.
When I make the changes, to define the macro in the build file as:
RUN_WPP=$(SOURCES)\
-km\
-dll\
-DMacroName\
-func:MyTraceEvents(LEVEL, FLAG,(MSG,…))\
-func:TraceEvents(LEVEL,FLAG,(MSG…))
I include the .tmh file and define the configuration as:
#define TRACE_LEVEL_NONE 0 // Tracing is not on
#define TRACE_LEVEL_FATAL 1 // Abnormal exit or termination
#define TRACE_LEVEL_ERROR 2 // Severe errors that need logging
#define TRACE_LEVEL_WARNING 3 // Warnings such as allocation
failure
#define TRACE_LEVEL_INFORMATION 4 // Includes non-error
cases(e.g.,Entry-Exit)
#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID(ixgbDriver,
(B7868145,8EB9,4b06,BC04,41ED07A49251),\
WPP_DEFINE_BIT(DBG_INIT_1) /* bit 0 = 0x00000001 */ \
WPP_DEFINE_BIT(DBG_NORMAL) /* bit 1 = 0x00000010 */ \
/* You can have up to 32 defines. If you want more than that,\
you have to provide another trace control GUID */\
)
#define WPP_LEVEL_FLAG_LOGGER(lvl,flags) \
WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAG_ENABLED(lvl, flags) \
(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_##
DBG_NORMAL).TRACE_LEVEL_INFORMATION >= lvl)
Then I call the trace message in the code as follows:
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_NORMAL,
(“Initializing…%s\n”, AdapterName));
interrupt.cpp(91) : error C2143: syntax error : missing ‘)’ before
'constant
interrupt.cpp(91) : error C2059: syntax error : ‘)’
interrupt.cpp(91) : error C3861: ‘WPP_LEVEL_FLAG_S_ENABLED’: identifier
not d, even with argument-dependent lookup
interrupt.cpp(91) : error C3861: ‘WPP_LEVEL_FLAG_S_LOGGER’: identifier
not f , even with argument-dependent lookup
If the trace message in the code on lines 88,89 and 90 is as follows:
MyTraceEvents(TRACE_LEVEL_INFORMATION, “Initializing…%d\n”,
Adapter);
MyTraceEvents(DBG_NORMAL, “Initializing…%d\n”, Adapter);
MyTraceEvents(“Initializing…\n”);
I get the compilation error:
interrupt.cpp(88) : error C3861: ‘MyTraceEvents’: identifier not found,
even with argument-dependent lookup
interrupt.cpp(89) : error C3861: ‘MyTraceEvents’: identifier not found,
even with argument-dependent lookup
interrupt.cpp(90) : error C3861: ‘MyTraceEvents’: identifier not found,
even with argument-dependent lookup
Hope I am getting closer to the solution.
Manasi
From: “Jose Sua”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] enabling wpp
>Date: Wed, 9 Mar 2005 10:08:36 -0800
>
>DoTraceMessage is a macro, is the default trace macro which is
>recognized by the WPP preprocesor. You can also define your own and
>tell the preprocessor the name of it in your sources file with
>-func:MyOwnTracingFunc, or add it in your code as a wpp_config
>statement and let WPP scan it. In your example you are not defining
“TRACE”
>therefore the preprocessor ignores it and only expands the found
>DoTraceMessage defined in #define TRACE(A,LVL,S)
>
>The general format of a valid trace message function is as follows:
>
>FunctionName(Conditions…,“Message”,MessageVariables…);
>
>This is expanded into:
>
>If (Conditions enabled) {
>
> Add the flag value, message, and message formatting to the PDB
>symbol file;
>
>…Call WmiTraceMessage; // for user Mode we use TraceMessage
>
>}
>
>When you do a macro for tracing, you must provide:
>How to check if tracing is enabled, and the logger handle for the trace
>function.
>
>So if you define the trace macro as:
>DoTraceLevelMessage(LEVEL,FLAGS,MSG,…)
>You also need to define :
>#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)
>
>A trace statemet will look like:
> DoTraceLevelMessage(TRACE_LEVEL_INFORMATION,Noise, “Hello, %s
%d”,
>“World” , i);
>
>
>Is this what you want to do?
>
>You can further simplify by defining more macros assume that you define
>a flag= Unusual, and want a macro that traces for
>level=TRACE_LEVEL_INFORMATION and Flags = Unusual
>
>Method 1: define this in your code and have tracewpp scan the file with
>the -scan:filename option In this case you can define additional
>configuration for the trace macro such as prefix and suffix, assumes
>that you have a var named hr.
>// begin_wpp config
>// USEPREFIX (MYTRACE,“%!STDPREFIX!”);
>// FUNC MYTRACE{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=Unusual}(MSG,…);
>// USESUFFIX (MYTRACE,“Init Adapter:%d”,hr); // end_wpp
>
>Method 2: in the source file hace
>-func:MYTRACE{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=Unusual}(MSG,…)
>
>In both cases the trace macro in your code will look like:
>
>MYTRACE(“Init Adapter %s”, AdapterName);
>
>Thanks,
>Jose Sua
>Microsoft Corporation
>
>This posting is provided “AS IS” with no warranties and confers no
>rights.
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Manasi Deval
>Sent: Tuesday, March 08, 2005 6:00 PM
>To: Windows System Software Devs Interest List
>Subject: RE: [ntdev] enabling wpp
>
>Yes, I am.
>
>I also tried TraceEvents and that gives me the same problem.
>
>Manasi
>
> >From: “Doron Holan”
> >Reply-To: “Windows System Software Devs Interest List”
> >
> >To: “Windows System Software Devs Interest List”
> >
> >Subject: RE: [ntdev] enabling wpp
> >Date: Tue, 8 Mar 2005 17:36:10 -0800
> >
> >Are you wrapping the #include of the .tmh file in an extern “C”?
> >
> >Ie
> >
> >extern “C” {
> >#include “Foo.tmh”
> >}
> >
> >For foo.cpp?
> >
> >d
> >
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com] On Behalf Of Manasi Deval
> >Sent: Tuesday, March 08, 2005 4:45 PM
> >To: Windows System Software Devs Interest List
> >Subject: [ntdev] enabling wpp
> >
> >Hi all,
> > I am trying to enable WPP in my driver. In my free version
> >trace
>
> >macros to print out the DoTraceMessage string.
> > #define TRACE(A,LVL,S) DoTraceMessage(TRACE_LEVEL_INFORMATION,
> >LVL, S); where is is the data string. I also added a bunch of debug
> >levels and functions for using here.
> >
> >In the driver entry, I added
> > WPP_INIT_TRACING(DriverObject, RegistryPath); and similarly
> >in the shutdown function I stop the tracing.
> >
> >In the makefile, i added :
> >
> >RUN_WPP=$(SOURCES)<br>> > -km<br>> > -dll<br>> > -func:DoTraceMessage(LEVEL,FLAG,(MSG,…))
> >
> >In each of my .cpp files I include the corresponding .tmh file.
> >
> >The trace message in the code looks like:
> > TRACE(Adapter, DBG_INTERRUPT_2, (“Init adapter\n”));
> >
> >When I build all this, I get error # 2065,
> >WPP_ANNOTATE_FILENAME_LINE_NUMBER
> >: undeclared identifier.
> >
> >I am at a loss as to what identifier it is looking for and where
> >should
>
> >i define it.
> >
> >Thanks,
> >Manasi
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as:
> >xxxxx@windows.microsoft.com To unsubscribe send a blank email to
> >xxxxx@lists.osr.com
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: unknown lmsubst tag
argument:
>‘’
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@microsoft.com To
>unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com