Friday, July 25, 2014

ArrayPlotter 0.1 Released

ArrayPlotter 0.1 has been released and is available on the Visual Studio Gallery:
Download

ArrayPlotter is a debugger visualisation tool that allows you to dynamically plot the contents of your C++/C# arrays and IEnumerables within the Visual Studio debugger.

Features:

  • Plot C++ or C# array or IEnumerable contents into a zoomable chart. Supported datatypes:
    • float
    • double
    • unsigned/signed int
    • unsigned/signed short
    • unsigned/signed char
  • Handles complex number of above datatypes (can plot real / imaginary / magnitude)
  • Auto Update feature will automatically plot array upon entering break mode
  • ArrayPlotter window is a standard dockable/moveable Visual Studio window
  • Chart supports auto or manual y-scaling
  • Both array pointer and length expressions are supported, ie length can be a fixed integer or a variable with a constantly changing value. Pointer and numerical arithmetic can also be applied
ArrayPlotter 0.1

How to Use:

  • Set your breakpoint at desired location
  • Run your application and enter the breakpoint 
  • Open the window from Debug->Windows->ArrayPlotter
  • Dock/move/resize the window to where you want it (Visual Studio will remember the location preferences like any other window)
  • In the Pointer Expression box enter the array pointer:
    • For C++ this is simply the pointer variable name
    • For C# you will have to enter the address of the first element, ie &cSharpArray[0]
    • For C# IEnumerable types you must include .ToArray() in the pointer expression, ie &floatEnumerable.ToArray()[0]
    • For both you can perform pointer arithmetic, ie &cSharpArray[0]+20 means start at the 20th element
  • In the Length Expression box enter the length of the array as either:
    • An Integer, ie 1024
    • An expression, ie arrayLength, DATA_LENGTH, or even dataStruct.NumSamples
    • For IEnumerable types you can include .Count() method, ie floatEnumberable.Count()
    • Also, numerical arithmetic can be performed, ie dataStruct.NumSamples/2 will plot half of the array
  • From the Format drop down select the data type
  • From the Structure drop down select the data type. This will typically be Scalar UNLESS you are using array of Complex values which are defined to be pairs of the same data type laid out in memory as <real1,imag1,real2,imag2,real3,imag3,...>. In this case you can select if you want to plot the Real, Imaginary or Amplitude components
  • Click Plot
  • To zoom in on the chart press and hold left-mouse and select the desired zoom region and release. Double click to reset zoom. Alternatively the mousewheel can be used to zoom in/out on cursor location (Mousewheel VS2012+ only)
  • If Auto Update is enabled, then any time debug mode is entered then the currently entered expression will be evaluated and re-plotted

Introduction

For several years now I have been using a Visual Studio extension called ArrayDebugView by Joachim Eibl that allows you to plot the contents of a C++ array when stopped at a breakpoint within Visual Studio. This extension was designed for VS2005 and VS2008, yet I managed to get it running on VS2010.

ArrayDebugView by Joachim Eibl
ArrayDebugView by Joachim Eibl

 For years I found it very useful for development of signal processing algorithms. However, the interface is a bit clunky (has a broken tab order and is a modal dialog), and worst of all, it is NOT compatible with VS2012/2013 which our recent projects at work are now developed in. Furthermore, most of our development is now in C#.

Thus an update to ArrayDebugView was in order. Unfortunately the last release (1.42) was in early 2010. I attempted to rebuild the solution from source with the aim of making it compatible with VS2012/2013 but I did not have much success.

So I decided to develop my own array plotting debug extension, utilising the new Visual Studio Extension (VSIX) framework to ensure ease of installation. The main benefit is that I then have the ability to improve the functionality and include new features etc.

Keep your eyes out for ArrayPlotter in the Visual Studio Gallery soon!

ArrayPlotter by Rodney Thomson
ArrayPlotter by Rodney Thomson