How To Use






To plot an array during a debug session:
  • Set your breakpoint at desired location
  • Run your application and enter the breakpoint 
  • Open a new ArrayPlotter window from Debug->Windows->ArrayPlotter. Multiple windows are supported
  • Dock/move/resize the window to where you want it. Visual Studio will remember the location preferences like any other window
  • In the Y: (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
    • ArrayPlotter will remember successfully plotted arrays and you can use the dropdown to select them from a history 
  • 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. The options are:
    • Scalar - an array of standard numerical values
    • Complex - 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, Amplitude or Phase of each Complex pair
    • Stride - For plotting a single channel of interleaved data, ie stereo audio. ArrayPlotter will plot data Stride samples apart starting at Offset
  • Click Plot
  • To specify an array containing the X-axis values, click Show X and repeat the above steps in the X: row.
  • 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)
  • Click and drag the middle mouse button to pan whilst zoomed
  • If Auto Update is enabled, then any time debug mode is entered then the currently entered expression will be evaluated and re-plotted
To customise the plot colours:

  • Select Tools->ArrayPlotter
  • The Chart Background, Axis and Series colour can be set
Example C++ and C# solutions are available below: 

16 comments:

  1. Thank you for this plugin, it really comes in handy when working with signals. It took me a while to realize you can easily use for C++ std::vectors<> as well. Just use Y: myvector.data() and Length: myvector.size() to plot the whole vector. One great feature would be a checkbox so NaN values are ignored in the plot.

    ReplyDelete
  2. Love this tool. Is there a workaround to install it into the new VS2017?

    ReplyDelete
    Replies
    1. I have heard rumours of one user doing the following:
      - Rename the VSIX file to .zip
      - Edit the extension.vsixmanifest file and
      -- Add a new SupportedProducts entry for Version "15.0" (just copy one of the existing entries)
      - Save and rename zip to .vsix
      - Double-click the VSIX to install

      Note that I have not tested this.

      I will be working on a VS2017 release shortly, but that requires I install 2017 first!

      Delete
    2. FYI ArrayPlotter 0.8 has been released and now supports Visual Studio 2017.

      Delete
  3. I would love to love this tool and am super impressed with what you've done! I've tried your demo solution and it works fine (Visual Studio 2017). However, when debugging C# code while attached to a Unity instance, I cannot seem to get the plotter to recognize my array in the Y: expression. I have an array: float[] bufferCheck, and when I enter &bufferCheck[0], the plotter debug panel provides this information: "Error evaluating expression [&bufferCheck[0]] : Type expected". I know it can see bufferCheck because I can put bufferCheck.Length/2 in the Length expression box and it appropriately reports "Length is 2500" of a 5000 member array. And the array type is selected as Float/Scalar.

    I believe I've read through all of the comments and help questions (and apologize if I missed it), but haven't found any similar instances/problems. Any thoughts?

    ReplyDelete
    Replies
    1. Hi o2deprived,

      Sadly the problem isn't with you! Unfortunately I've found that ArrayPlotter isn't compatible with debugging when the debugged application is being executed on a remote application/target. I've had someone have similar issue when attempting to use VisualGDB within Visual Studio.

      My understanding is that Visual GDB (and seemingly Unity Editor) publish things like variables, callstack etc to Visual Studio via a debugging API, that means Visual Studio doesn't actually have access to the raw memory of the ultimately debugged application.

      ArrayPlotter requires access to the raw memory to copy over in chunks. So in this case I assume that the Y Pointer expression fails due to being unable to return a memory address. Alternatively I could build the array up element by element... But that would be rather slow.

      I may look into this in the future, in the cases where direct memory copy fails. But for now, sorry, but it doesn't look like ArrayPlotter supports debugging of Unity applications. Sorry!

      Delete
    2. Thanks for the explanation Rodney -- really appreciate the quick response! And there is absolutely no need to apologize. I'm debugging some audio analysis code and being able to visualize the mountains of data is paramount to understanding where things are going wrong. For now, I'm getting by, selecting the data in a watch view and simply copying it to Excel and graphing it there. It's a bit cumbersome, but it does work. I saw your plug-in and thought it would be the holy grail for what I was needing -- but such is the way of things. Thanks again for your efforts on this project and if you ever decide to see about making this work, I for one will be all over it! ;) Thanks again, YOU ROCK!

      Delete
  4. Awesome tool! Is there any way to make it work with Intel compilers ? I would love to use this with Fortran applications.

    ReplyDelete
    Replies
    1. Hey there, that is an interesting idea. I have a theory for how I might be able to make it work with external toolsets (ie Visual GDB is the previous example that has been asked), but it would be slow (see comment above).

      So at the moment, I don't know how to make it work, but I may be able to do so in the future.

      Delete
  5. How would one go about plotting 5 series of 10 points each based on C# array 'double a[5,10]'? I could swear i was able to do this in the past....

    ReplyDelete
    Replies
    1. Hmm you may have done something like '&a[0][0]' or '&a[1][0]' or '&a[2][0]' etc in the Y Pointer field?

      Delete
    2. Thanks Rodney. Unfortunately those do not work with a 2D array. I was, however, able to make Array Visualizer work with 2017 and this complements Array Plotter nicely. Your plotter can handle large arrays much better an Visualizer handles plotting multidimensional arrays rather nicely.

      Delete
  6. Thanks for your tool.
    I used arraydebugview.
    My colleague modified it and it included the options of saving/loading the array into/from files. This way, I can easily export data to Matlab to test it or import external data to a running session. He couldn't make it working with addresses beyond 32 bits.
    Is there a way you can add save to file option?
    Thank you.

    ReplyDelete
    Replies
    1. Hi Sorin,

      having the ability to export array contents to file (CSV, raw, MATLAB) is something I have on my plan for the next release.

      I had not considered loading INTO arrays, or if that was even possible.

      Delete
  7. Hello, great tool! I'm looking to chart single scalar values, keeping a history of the previous values on the chart. Is this possible?

    ReplyDelete
  8. Hi,

    I have a C++ std::vector v; filled with values.
    ArrayPlotter gives this debug info when I use these Pointer Expressions:

    v.data()
    0 bytes of yData retrieved in 45 ms @ 0 kb/s
    Unable to evaluate pointer address

    &v[0]
    882 bytes of yData retrieved in 51 ms @ 17 kb/s
    Unable to get memory at address for yData:
    Unable to obtain 882 bytes of memory at address 13496DF3920

    According to a comment above, it should be possible to use std::vectors.
    Is this correct or do I have a bad installation?

    ReplyDelete