I received a task to visualize an array from program, that is being debugged in VS. Is there any way to connect to Visual Studio debugging session from external program and get data from it?
-
Why does it have to be sent to an external program? Can't it be visualized from within VS? – Omer Raviv Jul 03 '12 at 06:42
-
Well, I want to send the variables to external program and then to MATLAB. I found the way to write visualizers for VS in C#, but but I have to debug unmanaged C++ code. Is there a way to send C++ variables? – Alexander Shishenko Jul 03 '12 at 16:15
2 Answers
Theoretically, you could use the Debugger.GetExpression API to read the values from the debugger and send them to MATLAB, but if we're talking about a relatively large amount of data (such as a large matrix or vector), the chances of this solution having reasonable performance are rather slim.
An easier solution could be to just take advantage of the fact you can call your own methods from the debugger - define a method in your code that sends the data to MATLAB, make sure it's defined in the same place where the data-structure you're serializing is defined (so that the debugger won't complain about accessibility issues), and then just execute that method from the Watch or Immediate windows.

- 11,409
- 5
- 43
- 82
This is not exactly from an external program, but useful nonetheless: msdn docs and an example (or sample for C++). Now if you really want an extarnal program to access the array, you can write a custom visualizer that does not visualize anything but sends the data over a socket/pipe to another program (I once used this principle to get arrays with audio data displayed in Labview during debugging session, very handy).

- 34,664
- 13
- 111
- 163
-
Well, I have unmanaged C++ code to visualize. Is there any way to do it? – Alexander Shishenko Jul 03 '12 at 16:46
-
see the sample for c++ I linked to, I used that as a base to send data over a socket to an external program graphing the data – stijn Jul 03 '12 at 18:16