Thursday, 28 January 2016

Visual Studio 2015 skip stl::* stepInto

I found a solution on the net to skip the entering into VS stl templates:

You should edit this file:
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers\default.natstepfilter

By default defense the UAC and readonly, but you can replace this file. This file is an XML and add the following line between <StepFilter /> tag:

  <Function>
    <Name>std\:\:.*</Name>
    <Action>NoStepInto</Action>
  </Function>

Start VS and test it. There is an interesting of this solution stop in stl template if you put a breakpoint. After I removed it the filter works like a charm.

Wednesday, 27 January 2016

Visual Studio heap corruption debug

I found a practically code to enable debug the heap overrun:

#ifdef _DEBUG // enable CRT memory leak detection & report
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF // enable debug heap allocs & block type IDs (ie _CLIENT_BLOCK)
// | _CRTDBG_CHECK_CRT_DF // check CRT allocations too
// | _CRTDBG_DELAY_FREE_MEM_DF // keep freed blocks in list as _FREE_BLOCK type
| _CRTDBG_LEAK_CHECK_DF // do leak report at exit (_CrtDumpMemoryLeaks)
// pick only one of these heap check frequencies
// | _CRTDBG_CHECK_ALWAYS_DF // check heap on every alloc/free
| _CRTDBG_CHECK_EVERY_16_DF
// | _CRTDBG_CHECK_EVERY_128_DF
// | _CRTDBG_CHECK_EVERY_1024_DF
//| _CRTDBG_CHECK_DEFAULT_DF // by default, no heap checks
);
int mode = _CRTDBG_MODE_WNDW;
//int mode = _CRTDBG_MODE_DEBUG;
_CrtSetReportMode(_CRT_WARN, mode);
_CrtSetReportMode(_CRT_ERROR, mode);
_CrtSetReportMode(_CRT_ASSERT, mode);

// _CrtSetBreakAlloc (209) ; // break debugger on numbered allocation
// // get id number from leak detector report of previous run
#endif

Tuesday, 5 January 2016