1
0
Fork 0

DBG+GUI: fix many application verifier issues

This commit is contained in:
Duncan Ogilvie 2018-03-04 22:04:37 +01:00
parent 53e621c175
commit 49167e92c6
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
8 changed files with 18 additions and 6 deletions

View File

@ -103,7 +103,8 @@ static bool _patchrestore(duint addr)
static void _getcallstack(DBGCALLSTACK* callstack)
{
stackgetcallstack(GetContextDataEx(hActiveThread, UE_CSP), (CALLSTACK*)callstack);
if(hActiveThread)
stackgetcallstack(GetContextDataEx(hActiveThread, UE_CSP), (CALLSTACK*)callstack);
}
static void _getsehchain(DBGSEHCHAIN* sehchain)

View File

@ -90,7 +90,7 @@ extern "C" DLL_EXPORT bool _dbg_valfromstring(const char* string, duint* value)
extern "C" DLL_EXPORT bool _dbg_isdebugging()
{
return IsFileBeingDebugged();
return hDebugLoopThread && IsFileBeingDebugged();
}
extern "C" DLL_EXPORT bool _dbg_isjumpgoingtoexecute(duint addr)

View File

@ -2,6 +2,7 @@
#include "memory.h"
#include "threading.h"
#include "module.h"
#include "debugger.h"
std::map<DepthModuleRange, LOOPSINFO, DepthModuleRangeCompare> loops;

View File

@ -36,6 +36,9 @@ void MemUpdateMap()
do
{
if(!DbgIsDebugging())
return;
// Query memory attributes
MEMORY_BASIC_INFORMATION mbi;
memset(&mbi, 0, sizeof(mbi));
@ -106,6 +109,9 @@ void MemUpdateMap()
char curMod[MAX_MODULE_SIZE] = "";
for(int i = pagecount - 1; i > -1; i--)
{
if(!DbgIsDebugging())
return;
auto & currentPage = pageVector.at(i);
if(!currentPage.info[0] || (scmp(curMod, currentPage.info) && !bListAllPages)) //there is a module
continue; //skip non-modules
@ -331,7 +337,7 @@ bool MemoryReadSafePage(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer,
bool MemRead(duint BaseAddress, void* Buffer, duint Size, duint* NumberOfBytesRead, bool cache)
{
if(!MemIsCanonicalAddress(BaseAddress))
if(!MemIsCanonicalAddress(BaseAddress) || !DbgIsDebugging())
return false;
if(cache && !MemIsValidReadPtr(BaseAddress, true))
@ -383,7 +389,7 @@ bool MemReadUnsafePage(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer, S
bool MemReadUnsafe(duint BaseAddress, void* Buffer, duint Size, duint* NumberOfBytesRead)
{
if(!MemIsCanonicalAddress(BaseAddress) || BaseAddress < PAGE_SIZE)
if(!MemIsCanonicalAddress(BaseAddress) || BaseAddress < PAGE_SIZE || !DbgIsDebugging())
return false;
if(!Buffer || !Size)

View File

@ -358,5 +358,6 @@ void stackupdatesettings()
{
ShowSuspectedCallStack = settingboolget("Engine", "ShowSuspectedCallStack");
std::vector<CALLSTACKENTRY> dummy;
stackgetcallstack(GetContextDataEx(hActiveThread, UE_CSP), dummy, false);
if(hActiveThread)
stackgetcallstack(GetContextDataEx(hActiveThread, UE_CSP), dummy, false);
}

View File

@ -26,7 +26,7 @@
#define __DBG_MACRO_CONCAT(a, b) a##b
// Trigger an exception if the debugger is not currently active
#define ASSERT_DEBUGGING(message) ASSERT_TRUE(DbgIsDebugging(), message)
#define ASSERT_DEBUGGING(message) ASSERT_TRUE(IsFileBeingDebugged(), message)
// Trigger an exception if expression is false
#define ASSERT_TRUE(...) \

View File

@ -14,6 +14,7 @@ Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent), mDisassem
mMemPage = new MemoryPage(0, 0);
mInstBuffer.clear();
setDrawDebugOnly(true);
historyClear();

View File

@ -11,6 +11,8 @@ HexDump::HexDump(QWidget* parent)
memset(&data, 0, sizeof(SelectionData_t));
mSelection = data;
setDrawDebugOnly(true);
mGuiState = HexDump::NoState;
setRowCount(0);