drmemory icon indicating copy to clipboard operation
drmemory copied to clipboard

Failed to take over all threads after multiple attempts.

Open karthyhu opened this issue 1 year ago • 1 comments

Hi all Thanks to release this useful lib for check dynamic memory when i tride compile with mingw32(msys2) and use dr.memory to debug

./drmemory.exe /d/static_test/G_memory_test/build/G_memory_test.exe

i got this error ~~Dr.M~~ Dr. Memory version 2.4.0 ~~Dr.M~~ Running "D:/static_test/G_memory_test/build/G_memory_test.exe" ~~Dr.M~~ Using system call file C:\Users\KARTHY\AppData\Roaming\Dr. Memory\symcache\syscalls_wow64.txt <Application D:\static_test\G_memory_test\build\G_memory_test.exe (12480). Failed to take over all threads after multiple att empts.> ~~Dr.M~~ WARNING: application exited with abnormal code 0x28

this is my CMakeFile and source file, thanks a lot!

`cmake_minimum_required(VERSION 3.5)

project(G_memory_test)

add_definitions(-ggdb) add_definitions(-static-libgcc) add_definitions(-static-libstdc++)

add_executable(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/main.cpp )`

`#include

void test1(); void test2(); void test3(); void test4();

int main() { test4(); std::cout << "ok" << std::endl; return 0; }

void test1() { char ptr; for (int i = 0; i<100; i++) { ptr = (char)malloc(i); if (i % 2){free(ptr)}; } }

void test2() { char x = (char)malloc(8); char c = *(x + 8); // buffer overlow free(x); c = *x; // read free memory }

typedef struct T_ { char a; char b; }T;

void test3() { T a, b; char x; a.a = 'a'; a.b = 'b'; b.a = x; if (b.a == 10) memcpy(&b, &a, sizeof(T)); }

void test4() { char * ptr = NULL; ptr = new char; free(ptr); free(ptr); }`

karthyhu avatar Nov 28 '22 03:11 karthyhu