1
0
Fork 0

DBG: fixed with symbols

This commit is contained in:
Mr. eXoDia 2015-07-13 06:10:50 +02:00
parent 10ef4a841f
commit e4c497f582
6 changed files with 32 additions and 30 deletions

View File

@ -785,6 +785,8 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
entry = strtok(0, ",");
}
}
BridgeSettingGet("Symbols", "CachePath", szSymbolCachePath);
}
break;

View File

@ -24,13 +24,13 @@ SafeSymUnloadModule64(
return SymUnloadModule64(hProcess, BaseOfDll);
}
BOOL
SafeSymSetSearchPath(
SafeSymSetSearchPathW(
__in HANDLE hProcess,
__in_opt PCSTR SearchPath
__in_opt PCWSTR SearchPath
)
{
EXCLUSIVE_ACQUIRE(LockSym);
return SymSetSearchPath(hProcess, SearchPath);
return SymSetSearchPathW(hProcess, SearchPath);
}
DWORD
SafeSymSetOptions(
@ -41,14 +41,14 @@ SafeSymSetOptions(
return SymSetOptions(SymOptions);
}
BOOL
SafeSymInitialize(
SafeSymInitializeW(
__in HANDLE hProcess,
__in_opt PCSTR UserSearchPath,
__in_opt PCWSTR UserSearchPath,
__in BOOL fInvadeProcess
)
{
EXCLUSIVE_ACQUIRE(LockSym);
return SymInitialize(hProcess, UserSearchPath, fInvadeProcess);
return SymInitializeW(hProcess, UserSearchPath, fInvadeProcess);
}
BOOL
SafeSymRegisterCallback64(
@ -86,14 +86,14 @@ SafeSymGetModuleInfo64(
return SymGetModuleInfo64(hProcess, qwAddr, ModuleInfo);
}
BOOL
SafeSymGetSearchPath(
SafeSymGetSearchPathW(
__in HANDLE hProcess,
__out_ecount(SearchPathLength) PSTR SearchPath,
__out_ecount(SearchPathLength) PWSTR SearchPath,
__in DWORD SearchPathLength
)
{
EXCLUSIVE_ACQUIRE(LockSym);
return SymGetSearchPath(hProcess, SearchPath, SearchPathLength);
return SymGetSearchPathW(hProcess, SearchPath, SearchPathLength);
}
BOOL
SafeSymEnumSymbols(

View File

@ -20,18 +20,18 @@ SafeSymUnloadModule64(
__in DWORD64 BaseOfDll
);
BOOL
SafeSymSetSearchPath(
SafeSymSetSearchPathW(
__in HANDLE hProcess,
__in_opt PCSTR SearchPath
__in_opt PCWSTR SearchPath
);
DWORD
SafeSymSetOptions(
__in DWORD SymOptions
);
BOOL
SafeSymInitialize(
SafeSymInitializeW(
__in HANDLE hProcess,
__in_opt PCSTR UserSearchPath,
__in_opt PCWSTR UserSearchPath,
__in BOOL fInvadeProcess
);
BOOL
@ -58,9 +58,9 @@ SafeSymGetModuleInfo64(
__out PIMAGEHLP_MODULE64 ModuleInfo
);
BOOL
SafeSymGetSearchPath(
SafeSymGetSearchPathW(
__in HANDLE hProcess,
__out_ecount(SearchPathLength) PSTR SearchPath,
__out_ecount(SearchPathLength) PWSTR SearchPath,
__in DWORD SearchPathLength
);
BOOL

View File

@ -633,7 +633,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
GuiSymbolLogClear();
char szServerSearchPath[MAX_PATH * 2] = "";
sprintf_s(szServerSearchPath, "SRV*%s", szSymbolCachePath);
SafeSymInitialize(fdProcessInfo->hProcess, szServerSearchPath, false); //initialize symbols
SafeSymInitializeW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str(), false); //initialize symbols
SafeSymRegisterCallback64(fdProcessInfo->hProcess, SymRegisterCallbackProc64, 0);
SafeSymLoadModuleEx(fdProcessInfo->hProcess, CreateProcessInfo->hFile, DebugFileName, 0, (DWORD64)base, 0, 0, 0);

View File

@ -1473,8 +1473,8 @@ CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[])
}
char szModulePath[MAX_PATH] = "";
strcpy_s(szModulePath, StringUtils::Utf16ToUtf8(wszModulePath).c_str());
char szOldSearchPath[MAX_PATH] = "";
if(!SafeSymGetSearchPath(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
wchar_t szOldSearchPath[MAX_PATH] = L"";
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
{
dputs("SymGetSearchPath failed!");
return STATUS_ERROR;
@ -1483,26 +1483,26 @@ CMDRESULT cbDebugDownloadSymbol(int argc, char* argv[])
if(argc > 2)
szSymbolStore = argv[2];
sprintf_s(szServerSearchPath, "SRV*%s*%s", szSymbolCachePath, szSymbolStore);
if(!SafeSymSetSearchPath(fdProcessInfo->hProcess, szServerSearchPath)) //set new search path
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str())) //set new search path
{
dputs("SymSetSearchPath (1) failed!");
return STATUS_ERROR;
}
if(!SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)modbase)) //unload module
{
SafeSymSetSearchPath(fdProcessInfo->hProcess, szOldSearchPath);
SafeSymSetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath);
dputs("SymUnloadModule64 failed!");
return STATUS_ERROR;
}
if(!SafeSymLoadModuleEx(fdProcessInfo->hProcess, 0, szModulePath, 0, (DWORD64)modbase, 0, 0, 0)) //load module
{
dputs("SymLoadModuleEx failed!");
SafeSymSetSearchPath(fdProcessInfo->hProcess, szOldSearchPath);
SafeSymSetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath);
return STATUS_ERROR;
}
if(!SafeSymSetSearchPath(fdProcessInfo->hProcess, szOldSearchPath))
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath))
{
dputs("SymSetSearchPath (2) failed!");
dputs("SymSetSearchPathW (2) failed!");
return STATUS_ERROR;
}
GuiSymbolRefreshCurrent();

View File

@ -129,11 +129,11 @@ void SymDownloadAllSymbols(const char* SymbolStore)
return;
// Backup the current symbol search path
char oldSearchPath[MAX_PATH];
wchar_t oldSearchPath[MAX_PATH];
if(!SafeSymGetSearchPath(fdProcessInfo->hProcess, oldSearchPath, MAX_PATH))
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, oldSearchPath, MAX_PATH))
{
dputs("SymGetSearchPath failed!");
dputs("SymGetSearchPathW failed!");
return;
}
@ -141,9 +141,9 @@ void SymDownloadAllSymbols(const char* SymbolStore)
char customSearchPath[MAX_PATH * 2];
sprintf_s(customSearchPath, "SRV*%s*%s", szSymbolCachePath, SymbolStore);
if(!SafeSymSetSearchPath(fdProcessInfo->hProcess, customSearchPath))
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(customSearchPath).c_str()))
{
dputs("SymSetSearchPath (1) failed!");
dputs("SymSetSearchPathW (1) failed!");
return;
}
@ -173,8 +173,8 @@ void SymDownloadAllSymbols(const char* SymbolStore)
}
// Restore the old search path
if(!SafeSymSetSearchPath(fdProcessInfo->hProcess, oldSearchPath))
dputs("SymSetSearchPath (2) failed!");
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, oldSearchPath))
dputs("SymSetSearchPathW (2) failed!");
}
bool SymAddrFromName(const char* Name, uint* Address)