1
0
Fork 0

DBG: Attempt at fixing issue #284

This commit is contained in:
Nukem 2015-04-24 15:00:50 -04:00
parent fd845c97ac
commit 250827ec8c
5 changed files with 11 additions and 3 deletions

View File

@ -48,7 +48,8 @@ extern "C" DLL_EXPORT bool _dbg_memwrite(duint addr, const unsigned char* src, d
extern "C" DLL_EXPORT bool _dbg_memmap(MEMMAP* memmap) extern "C" DLL_EXPORT bool _dbg_memmap(MEMMAP* memmap)
{ {
CriticalSectionLocker locker(LockMemoryPages); SHARED_ACQUIRE(LockMemoryPages);
int pagecount = (int)memoryPages.size(); int pagecount = (int)memoryPages.size();
memset(memmap, 0, sizeof(MEMMAP)); memset(memmap, 0, sizeof(MEMMAP));
memmap->count = pagecount; memmap->count = pagecount;

View File

@ -236,9 +236,15 @@ bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module)
bpInfo.addr += ModBaseFromName(bpInfo.mod); bpInfo.addr += ModBaseFromName(bpInfo.mod);
bpInfo.active = MemIsValidReadPtr(bpInfo.addr); bpInfo.active = MemIsValidReadPtr(bpInfo.addr);
// Lock must be released due to callback sub-locks
SHARED_RELEASE()
// Execute the callback // Execute the callback
if(!EnumCallback(&bpInfo)) if(!EnumCallback(&bpInfo))
callbackStatus = false; callbackStatus = false;
// Restore the breakpoint map lock
SHARED_REACQUIRE(LockBreakpoints);
} }
return callbackStatus; return callbackStatus;

View File

@ -32,7 +32,7 @@ bool CommentSet(uint Address, const char* Text, bool Manual)
comment.manual = Manual; comment.manual = Manual;
comment.addr = Address - ModBaseFromAddr(Address); comment.addr = Address - ModBaseFromAddr(Address);
// Insert into list // Key generated from module hash
const uint key = ModHashFromAddr(Address); const uint key = ModHashFromAddr(Address);
EXCLUSIVE_ACQUIRE(LockComments); EXCLUSIVE_ACQUIRE(LockComments);

View File

@ -22,7 +22,7 @@ bool bListAllPages = false;
void MemUpdateMap(HANDLE hProcess) void MemUpdateMap(HANDLE hProcess)
{ {
CriticalSectionLocker locker(LockMemoryPages); EXCLUSIVE_ACQUIRE(LockMemoryPages);
MEMORY_BASIC_INFORMATION mbi; MEMORY_BASIC_INFORMATION mbi;
SIZE_T numBytes; SIZE_T numBytes;
uint MyAddress = 0, newAddress = 0; uint MyAddress = 0, newAddress = 0;

View File

@ -29,6 +29,7 @@ bool waitislocked(WAIT_ID id);
#define EXCLUSIVE_RELEASE() __ThreadLock.Unlock(); #define EXCLUSIVE_RELEASE() __ThreadLock.Unlock();
#define SHARED_ACQUIRE(Index) SectionLocker<SectionLock::##Index, true> __SThreadLock; #define SHARED_ACQUIRE(Index) SectionLocker<SectionLock::##Index, true> __SThreadLock;
#define SHARED_REACQUIRE(Index) __SThreadLock.Lock();
#define SHARED_RELEASE() __SThreadLock.Unlock(); #define SHARED_RELEASE() __SThreadLock.Unlock();
enum SectionLock enum SectionLock