DynamoRIO / DynamoRIO/drmemory

missing frames in 64-bit Windows callstacks with VS2017 ucrt

Open
#2,064 3 comments 0 reactions 0 assignees View on GitHub
OpSys-Windows OpSys-x64
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

Take this trivial example code:

```
int *foo()
{
new char[100];
return new int(42);
}

int main()
{
static int *bar = foo();

return *bar;
}
```

Compile it (I use qmake, but these are the effective compile flags:)

```
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ex_leak.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\ex_leak -I. -IC:\Qt\5.9.2\msvc2017_64\include -IC:\Qt\5.9.2\msvc2017_64\include\QtGui -IC:\Qt\5.9.2\msvc2017_64\include\QtANGLE -IC:\Qt\5.9.2\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.9.2\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\milian\AppData\Local\Temp\main.obj.3992.0.jom
main.cpp
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\ex_leak.exe @C:\Users\milian\AppData\Local\Temp\ex_leak.exe.3992.109.jom
```

Then run it through drmemory and look at the leak report:

```
Error #1: LEAK 100 direct bytes 0x000002a8b63b0290-0x000002a8b63b02f4 + 0 indirect bytes
# 0 replace_operator_new_array [d:\drmemory_package\common\alloc_replace.c:2928]
# 1 ucrtbased.dll!__crt_fast_decode_pointer<> [minkernel\crts\ucrt\devdiv\vcruntime\inc\internal_shared.h:498]
# 2 ucrtbased.dll!_initterm_e [minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp:40]
# 3 KERNEL32.dll!BaseThreadInitThunk
```

Note how it does not show any frame in the file I wrote at all. Both main and foo are nowhere to be found. In a debugger like from Visual Studio, I see the frames properly when I step through the execution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.