From ba6161d63e0a86bf3caac0c5c2e50f2ff58f9259 Mon Sep 17 00:00:00 2001 From: Dragon-Git <1762578117@qq.com> Date: Mon, 1 Jul 2024 19:30:04 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0=20svuvm.cpp"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 942d5fa2e9d6ccf47193bda85b8d3041e5fc646b. --- src/pysvuvm/svuvm.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/pysvuvm/svuvm.cpp b/src/pysvuvm/svuvm.cpp index 6146554..3a67c5f 100644 --- a/src/pysvuvm/svuvm.cpp +++ b/src/pysvuvm/svuvm.cpp @@ -1,8 +1,5 @@ #include #include -#ifdef __APPLE__ -#include -#endif #include #include #include "svdpi.h" @@ -61,19 +58,10 @@ void py_func(const char* mod_name, const char* func_name, const char* mod_paths) } } #elif defined(__APPLE__) - uint32_t image_count = _dyld_image_count(); Dl_info dl_info; - - for(uint32_t i=0; i= (intptr_t)header) && ((intptr_t)header + _dyld_get_image_vmaddr_slide(i)) > (intptr_t)py_func) { - dir_path = dirname(const_cast(image_name)); - path.attr("append")(dir_path); - } - } + if (dladdr((void*)py_func, &dl_info)) { + dir_path = dirname(const_cast(dl_info.dli_fname)); + path.attr("append")(dir_path); } #else #error Platform not supported.