public static void BitmapMouseUp(MouseEventArgs MouseEvents) { if (OwnerWindow.MemoryBitmapZoomRowsButton.Checked && MouseEvents.Button == MouseButtons.Left && FStreamInfo.GlobalInstance != null) { bZoomSelectionInProgress = false; OwnerWindow.MemoryBitmapZoomRowsButton.Checked = false; ZoomSelectionStartY = Math.Max(ZoomSelectionStartY, 0); ZoomSelectionEndY = Math.Max(ZoomSelectionEndY, 0); int Top = Math.Min(ZoomSelectionStartY, ZoomSelectionEndY); int Height = Math.Abs(ZoomSelectionEndY - ZoomSelectionStartY) + 1; // believe it or not, bytesPerLine easily exceeds 2GB in a 64-bit memory space long BytesPerLine = ( long )BytesPerPixel * ( long )MemoryBitmap.Width; Debug.Assert(BytesPerLine > 0); ZoomSelectionMemoryBase = FMemoryBitmapParser.GetPointerFromPixel(MemoryBitmap.Width, BytesPerPixel, 0, Top); ZoomSelectionMemorySize = ( ulong )(Height * BytesPerLine); bZoomSelectionActive = true; ZoomLevels.Add(new FMemorySpace(ZoomSelectionMemoryBase, ZoomSelectionMemorySize)); OwnerWindow.MemoryBitmapUndoZoomButton.Enabled = true; OwnerWindow.MemoryBitmapResetButton.Enabled = true; RefreshMemoryBitmap(); } }
public static void UnsafeBitmapClick(MouseEventArgs e) { OwnerWindow.MemoryBitmapCallStackListView.Items.Clear(); OwnerWindow.MemoryBitmapAllocationHistoryListView.BeginUpdate(); OwnerWindow.MemoryBitmapAllocationHistoryListView.Items.Clear(); ulong PointerFromPixel = FMemoryBitmapParser.GetPointerFromPixel(MemoryBitmap.Width, BytesPerPixel, e.X - MEMORY_BITMAP_LEFT_MARGIN, e.Y); string FilterText = OwnerWindow.FilterTextBox.Text.ToUpperInvariant(); using (FScopedLogTimer ParseTiming = new FScopedLogTimer("FMemoryBitmapParser.UnsafeBitmapClick")) { foreach (FCallStack CallStack in FStreamInfo.GlobalInstance.CallStackArray) { if (CallStack.RunFilters(FilterText, OwnerWindow.Options.ClassGroups, OwnerWindow.IsFilteringIn(), OwnerWindow.SelectedMemoryPool)) { foreach (FAllocationLifecycle AllocLifecycle in CallStack.CompleteLifecycles) { ProcessLifecycleForPixel(PointerFromPixel, CallStack, AllocLifecycle, true); } foreach (KeyValuePair <ulong, FAllocationLifecycle> AllocLifecycle in CallStack.IncompleteLifecycles) { ProcessLifecycleForPixel(PointerFromPixel, CallStack, AllocLifecycle.Value, false); } } } } // Pointers that were malloced and then realloced by a different callstack will have missing end frames // (marked with "-1"), but those end frames are guaranteed to be the same as the start frame of the // following allocation at this pointer, so we can just go over the list and fix up the references. for (int ItemIndex = 0; ItemIndex < OwnerWindow.MemoryBitmapAllocationHistoryListView.Items.Count; ItemIndex++) { if (OwnerWindow.MemoryBitmapAllocationHistoryListView.Items[ItemIndex].SubItems.Count > 0 && OwnerWindow.MemoryBitmapAllocationHistoryListView.Items[ItemIndex].SubItems[1].Text == "-1" && ItemIndex + 1 < OwnerWindow.MemoryBitmapAllocationHistoryListView.Items.Count) { OwnerWindow.MemoryBitmapAllocationHistoryListView.Items[ItemIndex].SubItems[1].Text = OwnerWindow.MemoryBitmapAllocationHistoryListView.Items[ItemIndex + 1].Text; } } OwnerWindow.MemoryBitmapAllocationHistoryListView.EndUpdate(); if (OwnerWindow.MemoryBitmapAllocationHistoryListView.Items.Count > 0) { OwnerWindow.MemoryBitmapAllocationHistoryListView.Items[GetMemoryBitmapActiveAllocationForStreamIndex(OwnerWindow.CurrentSnapshot.StreamIndex)].Selected = true; } else { // refresh panel to clear selection OwnerWindow.MemoryBitmapPanel.Invalidate(); } }