Visual Leak Detector with Visual Studio 2017: no source code line numbers
Asked Answered
F

2

12

I try to use Visual Leak Detector with Visual Studio 2017 with Platform Toolset "Visual Studio 2017" I have set the include directory and the library directory. Generating debug infos is on. Symbols for the exe are loaded.

(It works if i change the platform toolset to "Visual Studio 2013")

With Toolset "Visual Studio 2017" VLD is detecting leaks but do not resolve the line numbers:

Visual Leak Detector read settings from: C:\Program Files (x86)\Visual Leak Detector\vld.ini
Visual Leak Detector Version 2.5.1 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x005ECDB8: 400 bytes ----------
  Leak Hash: 0x36672640, Count: 1, Total 400 bytes
  Call Stack (TID 6284):
    ucrtbased.dll!malloc()
    ConsoleApplication6.exe!0x00361FAD()
    ConsoleApplication6.exe!0x003618BC()
    ConsoleApplication6.exe!0x00361828()
    ConsoleApplication6.exe!0x00361883()
    ConsoleApplication6.exe!0x00361F7E()
    ConsoleApplication6.exe!0x00361DE0()
    ConsoleApplication6.exe!0x00361C7D()
    ConsoleApplication6.exe!0x00361F98()
    kernel32.dll!BaseThreadInitThunk() + 0x12 bytes
    ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes
    ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes

Maybe somebody know a way to enable line number resolution.

Thanks

Firefly answered 22/6, 2017 at 19:46 Comment(1)
I'm using vs2019, but the option "Generate Debug Information (/DEBUG)" is NOT working. I changed it to "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)" and now it's working.Iphigenia
W
11

Try to disable partial PDB: in project properties click to Linker - All Options - Generate Debug Info, select "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)" instead of default "Generate Debug Information for faster links".

Wilhoit answered 23/6, 2017 at 15:16 Comment(2)
Thank you. "Generate Debug Info" is not enough. Changing it to: "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)" did it.Firefly
@pulp: I would hug you if I could. Just changing to /DEBUG:FULL did the trick for me as well, and saved me from deep desperation!Herzen
T
2

Just changing the linker settings to /DEBUG:FULL was not sufficient for me. Using /DEBUG:FASTLINK is ok.

However, I had to use a matching up-to-date dbghelp.dll from Visual Studio itself instead of the one coming with VLD (I am using VLD version 2.5.1 in x86 mode).

There are a few DLLs with that name. I took this one and copied it into my runtime folder of my project (replacing the one I had originally copied there from the VLD installation).

X:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\Cpp

Note: You might have to replace "Professional" with "Community" depending on the IDE version you have.

Tabathatabb answered 16/2, 2019 at 12:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.