From df6b4ff956e07d5c23c4188a8c1c82f0f5b5ad18 Mon Sep 17 00:00:00 2001 From: Bill Williams Date: Thu, 8 Dec 2016 16:10:01 -0600 Subject: [PATCH] Add windows-ish implementation for process-level getRTLibName. --- dyninstAPI/src/pdwinnt.C | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dyninstAPI/src/pdwinnt.C b/dyninstAPI/src/pdwinnt.C index 9de53ca015..8351ee08db 100644 --- a/dyninstAPI/src/pdwinnt.C +++ b/dyninstAPI/src/pdwinnt.C @@ -34,6 +34,7 @@ #include "common/src/headers.h" #include "dyninstAPI/src/os.h" #include "dyninstAPI/src/addressSpace.h" +#include "binaryEdit.h" #include "common/src/stats.h" #include "common/src/Types.h" #include "dyninstAPI/src/debug.h" @@ -1057,3 +1058,30 @@ void OS::get_sigaction_names(std::vector &names) { //names.push_back("signal"); } + +bool PCProcess::getDyninstRTLibName() +{ + startup_printf("Begin getDyninstRTLibName\n"); + bool use_abi_rt = false; +#if defined(arch_64bit) + use_abi_rt = (getAddressWidth() == 4); +#endif + + std::vector rt_paths; + std::string rt_base = "dyninstAPI_RT"; + if(use_abi_rt) rt_base += "_m32"; + rt_base += ".dll"; + if(!BinaryEdit::getResolvedLibraryPath(rt_base, rt_paths) || rt_paths.empty()) + { + startup_printf("%s[%d]: Could not find %s in search path\n", FILE__, __LINE__. rt_base.c_str()); + return false; + } + for(auto i = rt_paths.begin(); + i != rt_paths.end(); + ++i) + { + startup_printf("%s[%d]: Candidate RTLib is %s\n", FILE__, __LINE__, i->c_str()); + } + dyninstRT_name = rt_paths[0]; + return true; +}