Parcourir la source

Fixed multimap support

Brian Fiete il y a 5 ans
Parent
commit
2fdb6ddff6
2 fichiers modifiés avec 18 ajouts et 9 suppressions
  1. 8 7
      BeefySysLib/util/Dictionary.h
  2. 10 2
      IDEHelper/WinDebugger.cpp

+ 8 - 7
BeefySysLib/util/Dictionary.h

@@ -119,17 +119,18 @@ public:
 		{
 			int_cosize hashCode = (int_cosize)BeefHash<TKey>()(key) & 0x7FFFFFFF;
 
-			while ((uintptr)mIdx < (uintptr)mDictionary->mCount)
-			{
-				if (mDictionary->mEntries[mIdx].mHashCode < 0)
+			while (mCurrentIdx >= 0)
+			{	
+				mCurrentIdx = mDictionary->mEntries[mCurrentIdx].mNext;
+				if (mCurrentIdx < 0)
 					break;
 
-				mCurrentIdx = mIdx;
-				mIdx++;
-
 				if ((mDictionary->mEntries[mCurrentIdx].mHashCode == hashCode) &&
-					(mDictionary->mEntries[mCurrentIdx].mKey == key))
+					((*(TKey*)&mDictionary->mEntries[mCurrentIdx].mKey) == key))
+				{
+					mIdx = mCurrentIdx;
 					return true;
+				}				
 			}
 
 			mIdx = mDictionary->mCount + 1;

+ 10 - 2
IDEHelper/WinDebugger.cpp

@@ -853,8 +853,16 @@ void WinDebugger::ValidateBreakpoints()
 			usedBreakpoints.Add(breakpoint->mAddr);
 
 			WdBreakpoint* foundBreakpoint = NULL;
-			mBreakpointAddrMap.TryGetValue(breakpoint->mAddr, &foundBreakpoint);
-			BF_ASSERT(breakpoint == foundBreakpoint);
+			auto itr = mBreakpointAddrMap.Find(breakpoint->mAddr);
+			bool found = false;
+			while (itr != mBreakpointAddrMap.end())
+			{
+				WdBreakpoint* foundBreakpoint = itr->mValue;
+				found |= foundBreakpoint == breakpoint;
+				itr.NextWithSameKey(breakpoint->mAddr);
+			}
+
+			BF_ASSERT(found);
 		}
 
 		auto checkSibling = (WdBreakpoint*)breakpoint->mLinkedSibling;