drmemory icon indicating copy to clipboard operation
drmemory copied to clipboard

Dr. Memory fails with "dbghelp.dll: library initializer failed.."

Open luna2718 opened this issue 1 year ago • 1 comments

Describe the bug When running drmemory with an executable compiled with the mingw toolchain pre-installed by CLion, the command drmemory app.exe immediately fails with Unable to load client library: dbghelp.dll: library initializer failed...

To Reproduce Steps to reproduce the behavior:

  1. To test, I used
#include <stdio.h>

int main(void) {
    printf("Hello, World!\n");
    return 0;
}
  1. I used the bundled CLion mingw toolchain, although this also happens with the bundled cygwin toolchain and simply using gcc on main.c. Then, I used drmemory app.exe.
  2. As output, I get
<Application C:\Users\nasie\CLionProjects\test_app\cmake-build-debug\test_app.exe (10612). Unable to load client library: dbghelp.dll: library initializer failed..>
~~Dr.M~~ WARNING: unable to locate results file: can't open C:\Users\nasie\AppData\Roaming\Dr. Memory/resfile.10612 (code=2).
Dr. Memory failed to start the target application, perhaps due to
interference from invasive security software.
Try disabling other software or running in a virtual machine.
~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff

Please also answer these questions drawn from https://drmemory.org/page_help.html#sec_narrow :

  • Does the problem go away when running in light mode (pass -light to Dr. Memory)? No
  • Does the problem go away when running with the options -leaks_only -no_count_leaks -no_track_allocs? No
  • Does the problem go away when running under plain DynamoRIO? Do this by running dynamorio/bin32/drrun -- <application and args> or dynamorio/bin64/drrun -- <application and args> depending on the bitwidth of your applicaiton. (Ignore warnings about "incomplete installation".) Yes, but logs don't appear.
  • What happens with the debug version of Dr. Memory and of its underlying engine DynamoRIO? Try this by passing -debug -dr_debug -pause_at_assert. As output,
<Starting application C:\Users\nasie\CLionProjects\test_app\cmake-build-debug\test_app.exe (5392)>
<Running on newer-than-this-build "Microsoft Windows 10-2009 x64">
<Early threads found>
<Initial options = -no_dynamic_options -logdir 'C:\Users\nasie\AppData\Roaming\Dr. Memory\dynamorio' -client_lib 'C:\Program Files (x86)\Dr. Memory\bin64\debug\drmemorylib.dll;0;`-pause_at_assert` -logdir `C:\Users\nasie\AppData\Roaming\Dr. Memory` -symcache_dir `C:\Users\nasie\AppData\Roaming\Dr. Memory\symcache` -lib_blocklist_default `C:\WINDOWS*.d??,C:\Program Files\Common Files\Microsoft Shared*.d??,C:\Program Files (x86)\Common Files\Microsoft Shared*.d??` -resfile 5392 ' -client_lib64 'C:\Program Files (x86)\Dr. Memory\bin64\debug\drmemorylib.dll;0;`-pause_at_assert` -logdir `C:\Users\nasie\AppData\Roaming\Dr. Memory` -symcache_dir `C:\Users\nasie\AppData\Roaming\Dr. Memory\symcache` -lib_blocklist_default `C:\WINDOWS*.d??,C:\Program Files\Common Files\Microsoft Shared*.d??,C:\Program Files (x86)\Common Files\Microsoft Shared*.d??` -resfile 5392 ' -code_api -probe_api -stack_size 56K -disable_traces -no_enable_traces -max_elide_jmp 0 -max_elide_call 0 -no_shared_traces -bb_ibl_targets -bb_single_restore_prefix -no_shared_trace_ibl_routine -no_enable_reset -no_reset_at_switch_to_os_at_vmm_limit -reset_at_vmm_percent_free_limit 0 -no_reset_at_vmm_full -reset_at_commit_free_limit 0B -reset_every_nth_pending 0 -vm_size 256M -no_early_inject -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
<Application C:\Users\nasie\CLionProjects\test_app\cmake-build-debug\test_app.exe (5392). Unable to load client library: dbghelp.dll: library initializer failed..>
~~Dr.M~~ WARNING: unable to locate results file: can't open C:\Users\nasie\AppData\Roaming\Dr. Memory/resfile.5392 (code=2).
Dr. Memory failed to start the target application, perhaps due to
interference from invasive security software.
Try disabling other software or running in a virtual machine.
~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff

Expected behavior I expect for the program to run normally and open a log file.

Versions

  • Dr. Memory versions: I've tried 2.6.20103, 2.6.0, 2.5.0, and 2.4.0
  • Does the latest version work?: No
  • Windows version: Microsoft Windows 11 Home, Version 10.0.26100 Build 26100
  • App version: 64-bit

Additional context Dr. Memory has worked on my computer in the past, but I last used it over a year ago.

luna2718 avatar Feb 01 '25 06:02 luna2718

I get the exact same error message for both a simple test program as above, or the more complicated application that I intend to debug. This is on a machine with Windows 11 Pro 24H2.

DrMemory seems to work just fine for these two executables on a different PC with Windows 10 Pro 22H2.

I tried to compile both with MSYS2 MinGW W64 GCC 9.1.0 and 15.2.0, but this did not seem to make a difference.

Test program source code:

#include <stdio.h>

int main(void) {
    printf("Hello!");
    return 0;
}

Build command for the test program: gcc -static-libgcc -static-libstdc++ -gdwarf-2 -o test.exe test.c.

Error message:

PS C:\Users\klein\Temp> drmemory.exe -- .\test.exe
<Application C:\Users\klein\Temp\test.exe (8772). Unable to load client library: dbghelp.dll: library initializer failed..>
~~Dr.M~~ WARNING: unable to locate results file: can't open C:\Users\klein\AppData\Roaming\Dr. Memory/resfile.8772 (code=2).
Dr. Memory failed to start the target application, perhaps due to
interference from invasive security software.
Try disabling other software or running in a virtual machine.
~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff

maxkl avatar Sep 19 '25 14:09 maxkl