How to use DEBUGMSG macro?

Hi,

What is the TRACE like method for Smartphone In debugging process I want ot put some message to Output window, is that DEBUGMSG macro is appropriate one

In order to use that macro, what kind of header file I should include I included the dbgapi.h file, but it doesn't work.

So how to use this kind of trace method

Thanks.



Answer this question

How to use DEBUGMSG macro?

  • Jerry D

  • Simon253

    Thank you Michael, it really helps me.

    When I using ASSERT macro, I've got another problem.

    I want ot find some instruction for Smartphone platform just like _asm {int 3} to throw exception and then I can switch to debugger. But ASSERT(0) doesn't work for me.  In debugging mode, the program stopped at point where I insert ASSERT(0) macro without any exception occured. And when using "start without debugging" command, this macro has no effect at all.

    By the way, the DEBUGMSG macro does not send my debugging mesage to output window.

    So should I enable some IDE options for this

    Thanks.



  • merbs11

    I'm using VS2005 Beta2, WM5 Smartphone SDK. This is my code.

    #include <windows.h>

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nShowCmd)
    {
     DebugBreak();
     MessageBox(NULL, TEXT("text"), TEXT("caption"), MB_OK);
     return 0;
    }

    I do work in debug project configuration, and the function DebugBreak() have no effect at all when I "start without debugging". What's wrong


  • Davo.net

    The whole debug support macros (DEBUGMSG, ASSERT...) do only work for Debug builds. More precise: the C++ preprocessor definitions _DEBUG and DEBUG must be set in order to get those macros to work.

    In Release Builds those macros expand to nothing. My guess is that your're building and debugging a release build.

    To break into the debugger, just call the API DebugBreak () which is defined in kfuncs.h.

    Hope this answers your questions.




  • azrich

    The DEBUGMSG macro is part the Windows CE debugging toolset. This is documented in the Platform Builder for Windows CE Documentation (http://msdn.microsoft.com/library/default.asp url=/library/en-us/wcecoreos5/html/wce51lrfdebugmsg.asp).

    An Overview of the Debug Message support can be found here:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/wcedebug5/html/wce50conapplicationdebuggingwithkerneldebugger.asp

    hope this answers your question.

  • James Spink

    Thanks, Ilya.

    This function works for me, but the sample projects provided by WM5 SDK almost always use DEBUGMSG macro, so  I need to learn about it.

    Would you like to provide me further information about DEBUGMSG


  • saurabhsule82

    Michael, thank you for your help :)

  • pickedname

    Well, there is nothing wrong with your code. The problem is that Windows CE OS seams to ignore the breakpoint exception when there is no debugger attached to the process.

    I see two option to solve this issue.
    a) Show a message box telling to attach the debugger to this process before calling DebugBreak (). One the debugger is attached confirm the MessageBox and you should break into the debugger.

    b) Force a "divide by zero exception". This will trigger the JIT Debugger on the device. Now you have the ability to attach the VS debugger.

    Unfortunatly there is no better solution.
    If you feel that this is behavior you cannot accept (since it works under Windows XP) file a bug at the MSDN Product Feedback Center.

  • How to use DEBUGMSG macro?