1
0
Fork 0

DBG+GUI: some formatting...

This commit is contained in:
Mr. eXoDia 2015-08-13 15:29:38 +02:00
parent 9340cb45a8
commit cd6c113b0f
9 changed files with 27 additions and 26 deletions

View File

@ -101,15 +101,15 @@ public:
*/
static inline bool CopyData(ListInfo* listInfo, const std::vector<Type> & listData)
{
if (!listInfo)
if(!listInfo)
return false;
listInfo->count = int(listData.size());
listInfo->size = listInfo->count * sizeof(Type);
if (listInfo->count)
if(listInfo->count)
{
listInfo->data = BridgeAlloc(listInfo->size);
Type* curItem = reinterpret_cast<Type*>(listInfo->data);
for (const auto & item : listData)
for(const auto & item : listData)
{
*curItem = item;
++curItem;

View File

@ -965,7 +965,7 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
{
STRING_TYPE strtype;
char string[MAX_STRING_SIZE];
if(disasmgetstringat((uint)param1, &strtype, string, string, MAX_STRING_SIZE-3))
if(disasmgetstringat((uint)param1, &strtype, string, string, MAX_STRING_SIZE - 3))
{
if(strtype == str_ascii)
sprintf((char*)param2, "\"%s\"", string);

View File

@ -103,11 +103,11 @@ SCRIPT_EXPORT bool Script::Module::SectionListFromAddr(duint addr, ListOf(Module
{
SHARED_ACQUIRE(LockModules);
MODINFO* modInfo = ModInfoFromAddr(addr);
if (!modInfo)
if(!modInfo)
return false;
std::vector<ModuleSectionInfo> scriptSectionList;
scriptSectionList.reserve(modInfo->sections.size());
for (const auto & section : modInfo->sections)
for(const auto & section : modInfo->sections)
{
ModuleSectionInfo scriptSection;
scriptSection.addr = section.addr;
@ -169,7 +169,7 @@ SCRIPT_EXPORT bool Script::Module::GetList(ListOf(ModuleInfo) listInfo)
ModGetList(modList);
std::vector<ModuleInfo> modScriptList;
modScriptList.reserve(modList.size());
for (const auto & mod : modList)
for(const auto & mod : modList)
{
ModuleInfo scriptMod;
scriptMod.base = mod.base;

View File

@ -77,18 +77,18 @@ static DWORD WINAPI memMapThread(void* ptr)
static DWORD WINAPI timeWastedCounterThread(void* ptr)
{
if (!BridgeSettingGetUint("Engine", "TimeWastedDebugging", &timeWastedDebugging))
if(!BridgeSettingGetUint("Engine", "TimeWastedDebugging", &timeWastedDebugging))
timeWastedDebugging = 0;
GuiUpdateTimeWastedCounter();
while (!bStopTimeWastedCounterThread)
while(!bStopTimeWastedCounterThread)
{
while (!DbgIsDebugging())
while(!DbgIsDebugging())
{
if (bStopTimeWastedCounterThread)
if(bStopTimeWastedCounterThread)
break;
Sleep(1);
}
if (bStopTimeWastedCounterThread)
if(bStopTimeWastedCounterThread)
break;
timeWastedDebugging++;
GuiUpdateTimeWastedCounter();
@ -713,7 +713,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
for(unsigned int i = 0; i < NumberOfCallBacks; i++)
{
uint callbackVA = TLSCallBacks()[i] - ImageBase + pDebuggedBase;
if (MemIsValidReadPtr(callbackVA))
if(MemIsValidReadPtr(callbackVA))
{
sprintf(command, "bp "fhex",\"TLS Callback %d\",ss", callbackVA, i + 1);
cmddirectexec(dbggetcommandlist(), command);
@ -721,7 +721,7 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
else
invalidCount++;
}
if (invalidCount)
if(invalidCount)
dprintf("%d invalid TLS callback addresses...\n", invalidCount);
}
}
@ -866,7 +866,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
char DLLDebugFileName[deflen] = "";
if(!GetFileNameFromHandle(LoadDll->hFile, DLLDebugFileName))
strcpy_s(DLLDebugFileName, "??? (GetFileNameFromHandle failed!)");
strcpy_s(DLLDebugFileName, "??? (GetFileNameFromHandle failed!)");
SafeSymLoadModuleEx(fdProcessInfo->hProcess, LoadDll->hFile, DLLDebugFileName, 0, (DWORD64)base, 0, 0, 0);
IMAGEHLP_MODULE64 modInfo;
@ -918,9 +918,9 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
for(unsigned int i = 0; i < NumberOfCallBacks; i++)
{
uint callbackVA = TLSCallBacks()[i] - ImageBase + (uint)base;
if (MemIsValidReadPtr(callbackVA))
if(MemIsValidReadPtr(callbackVA))
{
if (bIsDebuggingThis)
if(bIsDebuggingThis)
sprintf(command, "bp "fhex",\"TLS Callback %d\",ss", callbackVA, i + 1);
else
sprintf(command, "bp "fhex",\"TLS Callback %d (%s)\",ss", callbackVA, i + 1, modname);
@ -929,7 +929,7 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
else
invalidCount++;
}
if (invalidCount)
if(invalidCount)
dprintf("%s invalid TLS callback addresses...\n", invalidCount);
}
}

View File

@ -338,7 +338,7 @@ bool disasmgetstringat(uint addr, STRING_TYPE* type, char* ascii, char* unicode,
String escaped = StringUtils::Escape(asciiData);
// Copy data back to outgoing parameter
strncpy_s(unicode, min(int(escaped.length()) +1, maxlen), escaped.c_str(), _TRUNCATE);
strncpy_s(unicode, min(int(escaped.length()) + 1, maxlen), escaped.c_str(), _TRUNCATE);
return true;
}

View File

@ -338,7 +338,7 @@ bool MemFreeRemote(uint Address)
bool MemGetPageInfo(uint Address, MEMPAGE* PageInfo, bool Refresh)
{
// Update the memory map if needed
if (Refresh)
if(Refresh)
MemUpdateMap();
SHARED_ACQUIRE(LockMemoryPages);
@ -346,11 +346,11 @@ bool MemGetPageInfo(uint Address, MEMPAGE* PageInfo, bool Refresh)
// Search for the memory page address
auto found = memoryPages.find(std::make_pair(Address, Address));
if (found == memoryPages.end())
if(found == memoryPages.end())
return false;
// Return the data when possible
if (PageInfo)
if(PageInfo)
*PageInfo = found->second;
return true;
@ -359,7 +359,7 @@ bool MemGetPageInfo(uint Address, MEMPAGE* PageInfo, bool Refresh)
bool MemIsCodePage(uint Address, bool Refresh)
{
MEMPAGE PageInfo;
if (!MemGetPageInfo(Address, &PageInfo, Refresh))
if(!MemGetPageInfo(Address, &PageInfo, Refresh))
return false;
return (PageInfo.mbi.Protect & PAGE_EXECUTE) == PAGE_EXECUTE;
}

View File

@ -329,6 +329,6 @@ void ModGetList(std::vector<MODINFO> & list)
{
SHARED_ACQUIRE(LockModules);
list.clear();
for (const auto & mod : modinfo)
for(const auto & mod : modinfo)
list.push_back(mod.second);
}

View File

@ -287,7 +287,7 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
}
else
{
if (_strnicmp(cachePath, ".\\", 2) == 0)
if(_strnicmp(cachePath, ".\\", 2) == 0)
{
strncpy_s(szSymbolCachePath, dir, _TRUNCATE);
strncat_s(szSymbolCachePath, cachePath + 1, _TRUNCATE);

View File

@ -1,7 +1,8 @@
#include "ValidateExpressionThread.h"
ValidateExpressionThread::ValidateExpressionThread(QObject* parent) : QThread(parent), mExpressionChanged(false), mStopThread(false)
{ }
{
}
void ValidateExpressionThread::start(QString initialValue)
{