a faster way to send info to a debugger

inline void MyDbgPrint(const char* str,int len)
{
ULONG_PTR args[2];
args[0] = len;//strlen(str);
args[1] = (ULONG_PTR)str;
__try
{
RaiseException(0x40010006,0,2,args);
}
__except(1)
{
}
}

Advertisements

1 Comment

  1. a traditional usage:

    void MyLog(const char* fmt,…)
    {
    if (!IsDebuggerPresent()) return;
    char* buf = (char*)malloc(4092);
    if (buf==NULL) return;
    va_list args;
    va_start(args, fmt);
    int len=_vsnprintf(buf,4091,fmt,args);
    if (len==-1) len=4091;
    MyDbgPrint(buf,len);
    free(buf);
    }

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s