Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. messing with afxDump

messing with afxDump

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Scott H Settlemier
    wrote on last edited by
    #1

    Am I in much danger doing this? I wanted to see the TRACE results w/o attaching a debugger, so I did this:

    #ifdef _DEBUG
    {
    typedef BOOL (WINAPI* ISDEBUGGERPRESENT)();
    ISDEBUGGERPRESENT pIsDebuggerPresent=(ISDEBUGGERPRESENT)GetProcAddress(GetModuleHandle("KERNEL32.DLL"),"IsDebuggerPresent");
    if (pIsDebuggerPresent && !pIsDebuggerPresent())
    { // this is a debug build with no debugger, let's set the afxDump object
    // to dump to a local file so that we can inspect the results
    ASSERT(!afxDump.m_pFile);
    CString DumpFilename;
    DumpFilename.ReleaseBuffer(::GetModuleFileName(0,DumpFilename.GetBuffer(MAX_PATH),MAX_PATH)?-1:0);
    DumpFilename+=".TRACE-DUMP.TXT";
    afxDump.m_pFile=new CFile(DumpFilename,CFile::modeWrite|CFile::modeCreate|CFile::shareDenyWrite);
    }
    }
    #endif

    I feel uneasy about it. Besides the problem of a debugger attaching to the process later on, it may step on other dependencies of which I am unaware. Is there a simple tool instead that will serve to receive and display the TRACE messages?

    M 1 Reply Last reply
    0
    • S Scott H Settlemier

      Am I in much danger doing this? I wanted to see the TRACE results w/o attaching a debugger, so I did this:

      #ifdef _DEBUG
      {
      typedef BOOL (WINAPI* ISDEBUGGERPRESENT)();
      ISDEBUGGERPRESENT pIsDebuggerPresent=(ISDEBUGGERPRESENT)GetProcAddress(GetModuleHandle("KERNEL32.DLL"),"IsDebuggerPresent");
      if (pIsDebuggerPresent && !pIsDebuggerPresent())
      { // this is a debug build with no debugger, let's set the afxDump object
      // to dump to a local file so that we can inspect the results
      ASSERT(!afxDump.m_pFile);
      CString DumpFilename;
      DumpFilename.ReleaseBuffer(::GetModuleFileName(0,DumpFilename.GetBuffer(MAX_PATH),MAX_PATH)?-1:0);
      DumpFilename+=".TRACE-DUMP.TXT";
      afxDump.m_pFile=new CFile(DumpFilename,CFile::modeWrite|CFile::modeCreate|CFile::shareDenyWrite);
      }
      }
      #endif

      I feel uneasy about it. Besides the problem of a debugger attaching to the process later on, it may step on other dependencies of which I am unaware. Is there a simple tool instead that will serve to receive and display the TRACE messages?

      M Offline
      M Offline
      mike_corrigan
      wrote on last edited by
      #2

      Scott H. Settlemier wrote: Is there a simple tool instead that will serve to receive and display the TRACE messages? Here is a tool that captures both kernel and Win32 debug output: http://www.systeminternals.com/ntw2k/freeware/debugview.shtml[^] Good luck! Mike

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups