You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'am trying to analyze a simple program written in c++ with the addition of the RInside library of R, i.e. an embedding of R for C++ programs. This is the program:
In order to simplify the compilation procedure I've created the following Makefile containing all the instructions for the linker and the compiler(mingw-w64-gcc version 8.3.0 from RTools):
Now if I open up a new command prompt and run main.exe everything works fine and I can see that both Test1 and Test2 are printed on the screen.
> main.exe
Test1
Test2
Now if I try to run the program using drmemory then main.exe crashes with an with abnormal code 0xc0000374.
Complete log
Here is a short part of the log of the execution. For the full log please refer to Pastebin
> C:/Users/user/Downloads/DrMemory/bin64/drmemory.exe -- main.exe
~~Dr.M~~ Dr. Memory version 2.5.0
~~Dr.M~~ Running "main.exe"
~~Dr.M~~ System call information is missing for this operating system: WinVer=105;Rel=2009;Build=19045;Edition=Core. Restarting to trigger auto-generation of system call information. Re-run with -ignore_kernel to attempt to continue instead.
WARNING: System call information is missing for this operating system version. Attempting to auto-generate system call information...
drsys_find_sysnum_libs: C:\Windows\system32\ntdll.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\kernelbase.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\kernel32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\gdi32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\imm32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\user32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\win32u.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\ntdll.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\kernelbase.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\kernel32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\gdi32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\imm32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\user32.dll is readable
drsys_find_sysnum_libs: C:\Windows\system32\win32u.dll is readable
Symbol cache directory is "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache"
Fetching symbols for "C:\Windows\system32\ntdll.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\ntdll.pdb\CCC0E36120F424BE044DE630C3BD80C41\ntdll.pdb"
Fetching symbols for "C:\Windows\system32\kernelbase.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\kernelbase.pdb\DAB9B69530E66325D8353875FB415CAD1\kernelbase.pdb"
Fetching symbols for "C:\Windows\system32\kernel32.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\kernel32.pdb\B85405D72580A929C2BB2C42AD2DF3C11\kernel32.pdb"
Fetching symbols for "C:\Windows\system32\gdi32.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\gdi32.pdb\2E920B123378678FB1B36D31F6078CCC1\gdi32.pdb"
Fetching symbols for "C:\Windows\system32\imm32.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\imm32.pdb\1F80564AD676C8D8443320276D4F67E91\imm32.pdb"
Fetching symbols for "C:\Windows\system32\user32.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\user32.pdb\B778230F766999847BC8B8E3441B2C211\user32.pdb"
Fetching symbols for "C:\Windows\system32\win32u.dll", attempt #0
Successfully fetched or found symbols at "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\symbols\win32u.pdb\771C2E28AD611FA7EDEE8227DA66C9351\win32u.pdb"
Searching for system calls in "C:\Windows\system32\ntdll.dll"
Found 472 system calls (0 usercalls) in "C:\Windows\system32\ntdll.dll"
Searching for system calls in "C:\Windows\system32\kernelbase.dll"
Found 0 system calls (0 usercalls) in "C:\Windows\system32\kernelbase.dll"
Searching for system calls in "C:\Windows\system32\kernel32.dll"
Found 0 system calls (0 usercalls) in "C:\Windows\system32\kernel32.dll"
Searching for system calls in "C:\Windows\system32\gdi32.dll"
Found 0 system calls (0 usercalls) in "C:\Windows\system32\gdi32.dll"
Searching for system calls in "C:\Windows\system32\imm32.dll"
Found 0 system calls (0 usercalls) in "C:\Windows\system32\imm32.dll"
Searching for system calls in "C:\Windows\system32\user32.dll"
Found 80 system calls (86 usercalls) in "C:\Windows\system32\user32.dll"
Searching for system calls in "C:\Windows\system32\win32u.dll"
Found 1316 system calls (0 usercalls) in "C:\Windows\system32\win32u.dll"
Writing to "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\syscalls_x64.txt"
Successfully wrote "C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\syscalls_x64.txt"
~~Dr.M~~ Auto-generation succeeded. Re-launching the application.
~~Dr.M~~ Dr. Memory version 2.5.0
~~Dr.M~~ Running "main.exe"
~~Dr.M~~ Using system call file C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\syscalls_x64.txt
~~Dr.M~~
~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS beyond top of stack: reading 0x00000000007cfae0-0x00000000007cfae8 8 byte(s)
~~Dr.M~~ # 0 .text [C:\Users\user\Downloads\example/main.cpp:11]
~~Dr.M~~ # 1 _pei386_runtime_relocator [D:/a/rtools-packages/rtools-packages/mingw-w64-crt-git/src/mingw-w64-v5.0.4/mingw-w64-crt/crt/pseudo-reloc.c:472]
~~Dr.M~~ # 2 __tmainCRTStartup [D:/a/rtools-packages/rtools-packages/mingw-w64-crt-git/src/mingw-w64-v5.0.4/mingw-w64-crt/crt/crtexe.c:280]
~~Dr.M~~ # 3 .l_start [D:/a/rtools-packages/rtools-packages/mingw-w64-crt-git/src/mingw-w64-v5.0.4/mingw-w64-crt/crt/crtexe.c:212]
~~Dr.M~~ # 4 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:02.315 in thread 2368
~~Dr.M~~ Note: 0x00000000007cfae0 refers to 696 byte(s) beyond the top of the stack 0x00000000007cfd98
~~Dr.M~~ Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Test1
~~Dr.M~~
~~Dr.M~~ Error #2: UNADDRESSABLE ACCESS beyond top of stack: reading 0x00000000007ce4b0-0x00000000007ce4b8 8 byte(s)
~~Dr.M~~ # 0 R.dll!? +0x0 (0x00007fff4f3af3f6 <R.dll+0x39f3f6>)
~~Dr.M~~ # 1 R.dll!? +0x0 (0x00007fff4f29fed1 <R.dll+0x28fed1>)
~~Dr.M~~ # 2 R.dll!? +0x0 (0x00007fff4f2a057d <R.dll+0x29057d>)
~~Dr.M~~ # 3 R.dll!? +0x0 (0x00007fff4f036528 <R.dll+0x26528>)
~~Dr.M~~ # 4 R.dll!? +0x0 (0x00007fff4f02e755 <R.dll+0x1e755>)
~~Dr.M~~ # 5 R.dll!? +0x0 (0x00007fff4f01bafd <R.dll+0xbafd>)
~~Dr.M~~ # 6 R.dll!? +0x0 (0x00007fff4f01bbc9 <R.dll+0xbbc9>)
~~Dr.M~~ # 7 libRInside.dll!RInside::initialize [D:/a/rtools-packages/rtools-packages/mingw-w64-crt-git/src/mingw-w64-v5.0.4/mingw-w64-crt/crt/crtdll.c:171]
~~Dr.M~~ # 8 libRInside.dll!RInside::RInside [D:/a/rtools-packages/rtools-packages/mingw-w64-crt-git/src/mingw-w64-v5.0.4/mingw-w64-crt/crt/crtdll.c:171]
~~Dr.M~~ # 9 main [C:\Users\user\Downloads\example/main.cpp:7]
~~Dr.M~~ Note: @0:00:11.155 in thread 2368
~~Dr.M~~ Note: 0x00000000007ce4b0 refers to 4072 byte(s) beyond the top of the stack 0x00000000007cf498
~~Dr.M~~ Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
..... Omitted ....
~~Dr.M~~ Error #105: UNADDRESSABLE ACCESS beyond top of stack: reading 0x00000000007bc920-0x00000000007bc928 8 byte(s)
~~Dr.M~~ # 0 R.dll!? +0x0 (0x00007fff4f3af40b <R.dll+0x39f40b>)
~~Dr.M~~ # 1 R.dll!? +0x0 (0x00007fff4f0f9109 <R.dll+0xe9109>)
~~Dr.M~~ # 2 R.dll!? +0x0 (0x00007fff4f115031 <R.dll+0x105031>)
~~Dr.M~~ # 3 R.dll!? +0x0 (0x00007fff4f11baba <R.dll+0x10baba>)
~~Dr.M~~ # 4 R.dll!? +0x0 (0x00007fff4f1592ba <R.dll+0x1492ba>)
~~Dr.M~~ # 5 R.dll!? +0x0 (0x00007fff4f159740 <R.dll+0x149740>)
~~Dr.M~~ # 6 R.dll!? +0x0 (0x00007fff4f159b3a <R.dll+0x149b3a>)
~~Dr.M~~ # 7 R.dll!? +0x0 (0x00007fff4f0fb761 <R.dll+0xeb761>)
~~Dr.M~~ # 8 R.dll!? +0x0 (0x00007fff4f115031 <R.dll+0x105031>)
~~Dr.M~~ # 9 R.dll!? +0x0 (0x00007fff4f11baba <R.dll+0x10baba>)
~~Dr.M~~ #10 R.dll!? +0x0 (0x00007fff4f109924 <R.dll+0xf9924>)
~~Dr.M~~ #11 R.dll!? +0x0 (0x00007fff4f115031 <R.dll+0x105031>)
~~Dr.M~~ #12 R.dll!? +0x0 (0x00007fff4f11baba <R.dll+0x10baba>)
~~Dr.M~~ #13 R.dll!? +0x0 (0x00007fff4f109924 <R.dll+0xf9924>)
~~Dr.M~~ #14 R.dll!? +0x0 (0x00007fff4f115031 <R.dll+0x105031>)
~~Dr.M~~ #15 R.dll!? +0x0 (0x00007fff4f11baba <R.dll+0x10baba>)
~~Dr.M~~ #16 R.dll!? +0x0 (0x00007fff4f1592ba <R.dll+0x1492ba>)
~~Dr.M~~ #17 R.dll!? +0x0 (0x00007fff4f15982c <R.dll+0x14982c>)
~~Dr.M~~ #18 R.dll!? +0x0 (0x00007fff4f159b3a <R.dll+0x149b3a>)
~~Dr.M~~ #19 R.dll!? +0x0 (0x00007fff4f0fb761 <R.dll+0xeb761>)
~~Dr.M~~ Note: @0:00:27.047 in thread 2368
~~Dr.M~~ Note: 0x00000000007bc920 refers to 5360 byte(s) beyond the top of the stack 0x00000000007bde10
~~Dr.M~~ Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
~~Dr.M~~ Fetching 2 symbol files...
~~Dr.M~~ [1/2] Fetching symbols for C:\Windows\System32\msvcp_win.dll
~~Dr.M~~ [2/2] Fetching symbols for C:\Windows\System32\msvcrt.dll
WARNING: drfront_sym_exit failed 6
~~Dr.M~~ Fetched 0 symbol files successfully
~~Dr.M~~ WARNING: application exited with abnormal code 0xc0000374 the stack 0x00000000007bde10
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Expected behavior
What I expect is the program to complete it's execution and print Test2. Note that thisis a 64 bit program.
The text was updated successfully, but these errors were encountered:
I tried to run drltrace.exe and drstrace.exe with main.exe and the program runs correctly, printing Test2.
> C:/Users/user/Downloads/DrMemory/bin64/drstrace.exe -- main.exe
WARNING: fetching symbol information (procedure may take some time).
<Using system call file C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\syscalls_x64.txt><drstrace log file is .\drstrace.main.exe.04500.0000.log>
Test1
Test2
> C:/Users/user/Downloads/DrMemory/bin64/drltrace.exe -- main.exe
INFO: C:\Users\user\Downloads\example\main.exe sucessfully started, waiting app forexit<Using system call file C:\Users\user\Downloads\DrMemory\drmemory\logs\symcache\syscalls_x64.txt><Found unknown types in the config file><drltrace log file is C:\Users\user\Downloads\example\drltrace.main.exe.05376.0000.log>
Test1
Test2
In order to better understand the issu I decided to recompile the R library from scratch using the same version of gcc and g++ as above, by including debugging symbols. The stack trace shows that on top of the stack there is always the same function call, i.e. ___chkstk_ms.
I'am trying to analyze a simple program written in c++ with the addition of the RInside library of R, i.e. an embedding of R for C++ programs. This is the program:
In order to simplify the compilation procedure I've created the following
Makefile
containing all the instructions for the linker and the compiler(mingw-w64-gcc version 8.3.0 from RTools):Now if I open up a new command prompt and run
main.exe
everything works fine and I can see that bothTest1
andTest2
are printed on the screen.Now if I try to run the program using drmemory then
main.exe
crashes with an with abnormal code0xc0000374
.Complete log
Here is a short part of the log of the execution. For the full log please refer to Pastebin
Expected behavior
What I expect is the program to complete it's execution and print
Test2
. Note that thisis a 64 bit program.The text was updated successfully, but these errors were encountered: