From 4f55ac0086c8ea3a39777807ff41f666a02fa986 Mon Sep 17 00:00:00 2001 From: Andy <550896603@qq.com> Date: Fri, 15 Dec 2023 19:46:51 +0800 Subject: [PATCH] Delete client/windows/test directory --- client/windows/test/test.cpp | 143 ---------------------- client/windows/test/test.vcxproj | 147 ----------------------- client/windows/test/test.vcxproj.filters | 22 ---- client/windows/test/test.vcxproj.user | 4 - 4 files changed, 316 deletions(-) delete mode 100644 client/windows/test/test.cpp delete mode 100644 client/windows/test/test.vcxproj delete mode 100644 client/windows/test/test.vcxproj.filters delete mode 100644 client/windows/test/test.vcxproj.user diff --git a/client/windows/test/test.cpp b/client/windows/test/test.cpp deleted file mode 100644 index 25d5395..0000000 --- a/client/windows/test/test.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../clink_cuda/export.h" -#include -#include -#include - -typedef CUresult(__stdcall* CUINIT)(unsigned int); -std::map> function_params_; - -int main() -{ - std::ifstream dump_file; - dump_file.open("C:\\Users\\cair\\Desktop\\output139015.bin"); - if (!dump_file.is_open()) { - return -1; - } - - FILE* pipe = _popen("cmd /c d:\\cuobjdump.exe --dump-elf C:\\Users\\cair\\AppData\\Local\\Temp\\eGoRXOELN2_cu.bin", "r"); - if (!pipe) - { - std::cerr << "popen() failed!" << std::endl; - return 1; - } - - char stream[1024]; - bool stop = true; - std::string func_name; - while (!feof(pipe)) - { - if (fgets(stream, 1024, pipe) != nullptr) { - std::string str = stream; - if (str.compare(0, 9, ".nv.info.") == 0) { - func_name = str.substr(9); - assert(function_params_.find(func_name) == function_params_.end()); - - std::deque param_sizes; - function_params_.insert(std::make_pair(func_name, std::move(param_sizes))); - stop = false; - } else if (str.compare(0, 27, "\tValue:\tIndex : 0x0\tOrdinal") == 0) { - str.pop_back(); - auto size = std::stoi(str.substr(str.size() - 3), nullptr, 16); - function_params_[func_name].push_front(size); - } - - if (str == ".nv.callgraph\n" && !stop) { - break; - } - } - } - - _pclose(pipe); - - std::string line; - while (std::getline(dump_file, line)) { - if (line.compare(0, 9, ".nv.info.") == 0) { - auto func_name = line.substr(9); - std::deque param_sizes; - while (std::getline(dump_file, line)) { - if (line == "") { - break; - } - - if (line == "\tAttribute:\tEIATTR_KPARAM_INFO") { - std::getline(dump_file, line); - assert(line == "\tFormat:\tEIFMT_SVAL"); - - std::getline(dump_file, line); - auto size = std::stoi(line.substr(line.size() - 3), nullptr, 16); - param_sizes.push_front(size); - } - } - function_params_[func_name] = std::move(param_sizes); - } - } - - - // 使用 VirtualAlloc 分配内存并启用 MEM_WRITE_WATCH - void* buffer = VirtualAlloc(NULL, 4096 * 2, MEM_COMMIT | MEM_RESERVE | MEM_WRITE_WATCH, PAGE_READWRITE); - if (!buffer) { - std::cerr << "VirtualAlloc failed with error: " << GetLastError() << std::endl; - return EXIT_FAILURE; - } - - // 写入分配的内存区域 - char* ptr = (char*)(buffer); - ptr[0] = 'A'; - ptr[3] = 'A'; - ptr[4096 - 1] = 'B'; - ptr[4099] = 'B'; - - // 获取写操作的地址 - ULONG_PTR addresses[2]; - ULONG_PTR count = _countof(addresses); - DWORD granularity; - - if (GetWriteWatch(0, buffer, 4096 * 2, (PVOID*)addresses, &count, &granularity) != 0) { - std::cerr << "GetWriteWatch failed with error: " << GetLastError() << std::endl; - VirtualFree(buffer, 0, MEM_RELEASE); - return EXIT_FAILURE; - } - - if (count > 0) { - std::cout << "Detected " << count << " write(s) at the following addresses:" << std::endl; - for (ULONG_PTR i = 0; i < count; ++i) { - std::cout << " " << (void*)addresses[i] << std::endl; - } - } - else { - std::cout << "No write operations detected." << std::endl; - } - - // 释放分配的内存 - VirtualFree(buffer, 0, MEM_RELEASE); - - HMODULE handle = LoadLibrary(L"nvcuda.dll"); - - if (handle) - { - printf("handle=%p\n", handle); - - //CUINIT cuinit = (CUINIT)GetProcAddress(handle, "cuInit"); - //if (cuinit) - //{ - // cuinit(0); - //} - - Sleep(5000); - FreeLibrary(handle); - } - else - { - printf("load failed\n"); - } -} \ No newline at end of file diff --git a/client/windows/test/test.vcxproj b/client/windows/test/test.vcxproj deleted file mode 100644 index a2751b9..0000000 --- a/client/windows/test/test.vcxproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {18534aef-e114-4b14-8d2f-860fdf9f75eb} - test - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/client/windows/test/test.vcxproj.filters b/client/windows/test/test.vcxproj.filters deleted file mode 100644 index eebbd43..0000000 --- a/client/windows/test/test.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/client/windows/test/test.vcxproj.user b/client/windows/test/test.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/client/windows/test/test.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file