Use full path when loading SourceLevelDebugger library

Change-Id: I27f7ee2b8944b9890ab4b141c06e9c2f0a8dffb1
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-10-30 13:42:13 +01:00
committed by sys_ocldev
parent 17b2a29945
commit 4df533f63a
8 changed files with 61 additions and 4 deletions

View File

@@ -23,6 +23,11 @@ OsLibrary *OsLibrary::load(const std::string &name) {
}
return ptr;
}
const std::string OsLibrary::createFullSystemPath(const std::string &name) {
return name;
}
namespace Linux {
OsLibrary::OsLibrary(const std::string &name) {

View File

@@ -32,6 +32,7 @@ class OsLibrary {
virtual ~OsLibrary() = default;
static OsLibrary *load(const std::string &name);
static const std::string createFullSystemPath(const std::string &name);
ConvertibleProcAddr operator[](const std::string &name) {
return ConvertibleProcAddr{getProcAddress(name)};

View File

@@ -19,9 +19,20 @@ OsLibrary *OsLibrary::load(const std::string &name) {
return ptr;
}
const std::string OsLibrary::createFullSystemPath(const std::string &name) {
CHAR buff[MAX_PATH];
UINT ret = 0;
ret = Windows::OsLibrary::getSystemDirectoryA(buff, MAX_PATH);
buff[ret] = '\\';
buff[ret + 1] = 0;
strncat_s(&buff[0], sizeof(buff), name.c_str(), _TRUNCATE);
return std::string(buff);
}
namespace Windows {
decltype(&LoadLibraryExA) OsLibrary::loadLibraryExA = LoadLibraryExA;
decltype(&GetModuleFileNameA) OsLibrary::getModuleFileNameA = GetModuleFileNameA;
decltype(&GetSystemDirectoryA) OsLibrary::getSystemDirectoryA = GetSystemDirectoryA;
extern "C" IMAGE_DOS_HEADER __ImageBase;
__inline HINSTANCE GetModuleHINSTANCE() { return (HINSTANCE)&__ImageBase; }

View File

@@ -24,6 +24,7 @@ class OsLibrary : public NEO::OsLibrary {
bool isLoaded();
void *getProcAddress(const std::string &procName);
static decltype(&GetSystemDirectoryA) getSystemDirectoryA;
protected:
HMODULE loadDependency(const std::string &dependencyFileName) const;