Viewing TraceEvents Messages

Dear All,

In the UMDF USB sample source, the debugging statements are used using Trace and TraceEvents functions.

I am debugging the driver using Visual Studio. Can anyone provide a pointer to the way to view these messages.

I need to start any trace tool or directly one can view these debugging messages in the output window of the Visual Studio.

Regards.

You can use TraceView.exe tool (under tools\tracing in WDK) to see these
traces.

The steps are:

  1. Generate tmf files from your driver pdb (tracepdb -f
    <fullpathto_pdb tracepdb.exe is at the same location as>TraceView.exe.

    2) Start TraceView, click File…Create New Log Session

    3) Click Add Provider. Provide ctl file for driver. (e.g. OsrUsbFx2.ctl)

    4) For TMF files, choose “Select TMF Files” and add all the tmfs
    generated in step #1.

    5) You should now see traces in TraceView.exe

    An easier option would have been to just use the pdb directly in step #3
    but for some reason that didn’t seem to work when I tried it.

    To redirect traces to debugger here are the options:

    1) Start a trace session and specify option to redirect to KD. This can
    make the traces appear in kernel debugger (and not user debugger - so
    may not help you with Visual Studio). You will need to include
    EVENT_TRACE_KD_FILTER_MODE flag in EVENT_TRACE_PROPERTIES.LogFileMode in
    the properties passed to StartTrace.

    2) An easier way is how KMDF samples do it. Please look at KMDF
    OsrUsbFx2 sample. It uses a define EVENT_TRACING and based on that it
    either compiles so that traces become DbgPrint or go to ETW. You can do
    something similar in UMDF driver. You will need to change the functions
    to UM counterparts (e.g. OutputDebugString instead of DbgPrint).

    Both are some amount of work so if TraceView works for you that is the
    easiest option, although #2 is convenient after some initial investment.

    HTH,

    Praveen</fullpathto_pdb>

Dear Praveen and All,

When I run tracepdb to generate TMF file, I get the following error message:

Functionality for extracting TMF out of PDB file not available.

UPDATE your DEBUGGER and use that DBGHELP.dll

Can you provide a pointer to the error message getting displayed as above. I need to download any other latest tracepdb version other than that provided with WDK.

Regards.

> When I run tracepdb to generate TMF file, I get the following error
message:

Functionality for extracting TMF out of PDB file not available.

UPDATE your DEBUGGER and use that DBGHELP.dll

You can download Debugging Tools for Windows (which includes windbg, kd
etc.) from:

http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx
(similarly for other architectures)

This should get you the right dbghelp.dll.

You can also try using the PDB directly in TraceView.exe and see if that
works for you. If that works you won’t need to extract TMF files.

Praveen

Dear Praveen,

Thanks for the inputs. I downloaded the Debugging tools for windows from the site, but still the same error message occurs when I run tracepdb.exe

I am unable to get correct dbghelp.dll required for the tracepdb. I wonder why the dbghelp.dll provided with WDK is unable to extract the required files.

I also tried using PDB directly. As you suggested in previous response, it does not seem to work. The Trace viewer is unable to locate the PDB file.

I will try the second option and also try using debugview as mentioned at:
http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

Regards.

I assume that your PDB is generated by WDK build. Is that correct? If
yes, I don’t know why it won’t work. You can try using WinDbg on a
different machine which doesn’t have VS and see if that helps - to
ensure that the latest dbghelp gets copied to system directory.

I also tried using PDB directly. As you suggested in previous
response, it does not seem to work. The Trace viewer is unable to
locate the PDB file.

What I meant was that I didn’t see the traces when I tried this. It
should be able to find the pdb if you provide the right path.

Praveen

In my experience, this dbghelp.dll issue affects a number of things,
most of which with completely meaningless and generally misleading error
messages. My solution, while not convenient, is to put the version of
dbghelp.dll that you need in the same directory as the exe.

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Thursday, August 23, 2007 09:46
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Viewing TraceEvents Messages

Dear Praveen,

Thanks for the inputs. I downloaded the Debugging tools for windows
from the site, but still the same error message occurs when I run
tracepdb.exe

I am unable to get correct dbghelp.dll required for the tracepdb. I
wonder why the dbghelp.dll provided with WDK is unable to extract the
required files.

I also tried using PDB directly. As you suggested in previous response,
it does not seem to work. The Trace viewer is unable to locate the PDB
file.

I will try the second option and also try using debugview as mentioned
at:
http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

Regards.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I assume that you are not running under Vista. The version of dbghlp that is
installed with the OS is not the correct version for the current traceview.
You need to put the WDK versions of dbghlp.dll in the same directory that
you run traceview from. This has been discussed previously on this list.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of xxxxx@gmail.com
Sent: Thursday, August 23, 2007 9:46 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Viewing TraceEvents Messages

Dear Praveen,

Thanks for the inputs. I downloaded the Debugging tools for windows from
the site, but still the same error message occurs when I run tracepdb.exe

I am unable to get correct dbghelp.dll required for the tracepdb. I wonder
why the dbghelp.dll provided with WDK is unable to extract the required
files.

I also tried using PDB directly. As you suggested in previous response, it
does not seem to work. The Trace viewer is unable to locate the PDB file.

I will try the second option and also try using debugview as mentioned at:
http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

Regards.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Dear All,

I copied dbghelp.dll from the WDK to the tools/tracing directory where the traceview.exe is located.

Now I am able to add the provided by using PDB directly as well as generating the TMF files using tracepdb.exe I am able to see the trace messages that I added in the source code.

Wandel was correct. This was previously discussed in the list.

I searched the list with the error message I got. I should have searched with either traceview or tracepdb keyboards.

When I redirect the to file using Log Trace Event Data To File option, the output file is generating but it is filled with some binary data instead of actual real time data that is getting displayed in the traceviewer.

Is there any optional way to redirect the output to some file so that one can view entire contents at a strech.

Regards.

IF you just want to capture a trace and view it later then use the command line tools instead of Traceview.

The binary file that you see contains the raw events, to see them all you can use Tracefmt.exe which is provided with the WDK, MSDN has documentation on this.

I use a batch file something like this to capture the trace of the Tracedrv sample driver included in the WDK.

REM : Because I am not really interested in the times and other stuff I set my own prefix REM : You can set a prefix you want or completely remove the line set TRACE_FORMAT_PREFIX=[%%1!s!][%%2!s!][%%!FUNC!][%%!LEVEL!][%%!FLAGS!]

del *.tmf
tracelog.exe -start tracedrv -guid #d58c126f-b309-11d1-969e-0000f875a5bc -f tracedrv.log -flags 15 -level 0xFF tracectl.exe tracelog -stop tracedrv Tracepdb -f tracedrv.pdb tracefmt -display -p . tracedrv.log

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, August 24, 2007 6:39 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Viewing TraceEvents Messages

Dear All,

I copied dbghelp.dll from the WDK to the tools/tracing directory where the traceview.exe is located.

Now I am able to add the provided by using PDB directly as well as generating the TMF files using tracepdb.exe I am able to see the trace messages that I added in the source code.

Wandel was correct. This was previously discussed in the list.

I searched the list with the error message I got. I should have searched with either traceview or tracepdb keyboards.

When I redirect the to file using Log Trace Event Data To File option, the output file is generating but it is filled with some binary data instead of actual real time data that is getting displayed in the traceviewer.

Is there any optional way to redirect the output to some file so that one can view entire contents at a strech.

Regards.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Dear Jose,

In the batch file you are using, I find tracectl.exe file. But this file is not located in tools/tracing directory hirarchy.

I used to launch traceview.exe before attaching the device to Windows so that I can get the trace messages in the traceview tool.

Now when to run this batch file. I guess after attaching the device.

Also the previous method of redirecting events to a file resulted in .etl file. Is there a way to convert this .etl file to readable format using tracefmt.exe For eg:

tracefmt.exe testevents.etl

Regards.

Yes. typically I use:

tracelog -start foo -guid foo.ctl -f foo.etl -level 7 -flags 0xffff
tracefmt -p LocationOfTmfFiles -o foo.txt foo.etl

The -p is used to define the location (search path) of your .tmf files.

~kenny

xxxxx@gmail.com wrote:

Dear Jose,

In the batch file you are using, I find tracectl.exe file. But this file is not located in tools/tracing directory hirarchy.

I used to launch traceview.exe before attaching the device to Windows so that I can get the trace messages in the traceview tool.

Now when to run this batch file. I guess after attaching the device.

Also the previous method of redirecting events to a file resulted in .etl file. Is there a way to convert this .etl file to readable format using tracefmt.exe For eg:

tracefmt.exe testevents.etl

Regards.