Difference between revisions of "Programming Howto:Programmatically wait for the Debugger in a BCI2000 Module"

From BCI2000 Wiki
Jump to: navigation, search
(Next step)
Line 1: Line 1:
In the VeryNiceFilter constructor, add a line with a SuggestDebugging statement, and rebuild
+
==Back==
 +
To [[Programming Howto:Building and Customizing BCI2000|this howto's overview page]].
 +
 
 +
==Insert <tt>SuggestDebugging</tt>==
 +
In the <tt>VeryNiceFilter</tt> constructor, add a line with a <tt>SuggestDebugging</tt> statement, and rebuild.
  
 
[[File:suggest_debugging_1.png|center]]
 
[[File:suggest_debugging_1.png|center]]
  
Double-click the VeryNiceSignalProcessing batch file you created earlier
+
==Run BCI2000==
 +
Double-click the "VeryNiceSignalProcessing" batch file you created earlier.
  
 
[[File:suggest_debugging_2.png|center]]
 
[[File:suggest_debugging_2.png|center]]
  
A SuggestDebugging dialog box will pop up, and stay in the front -- you may move it out of the way, but otherwise leave it alone
+
The <tt>VeryNiceFilter</tt> constructor is executed at module startup, so a "SuggestDebugging" dialog box will pop up immediately. The dialog box will stay in the front -- you may move it out of the way, but otherwise leave it alone.
  
 
[[File:suggest_debugging_3.png|center]]
 
[[File:suggest_debugging_3.png|center]]
  
In the VisualStudio IDE, choose "Attach to Process..." from the "Debug" menu
+
==Attach the debugger==
 +
In the VisualStudio IDE, choose "Attach to Process..." from the "Debug" menu.
  
 
[[File:suggest_debugging_4.png|center]]
 
[[File:suggest_debugging_4.png|center]]
  
Select the "Very Nice Signal Processing" process, click "Attach", and finally dismiss the SuggestDebugging dialog box by clicking "yes"
+
Select the "Very Nice Signal Processing" process, click "Attach", and finally dismiss the "SuggestDebugging" dialog box by clicking "yes".
  
 
[[File:suggest_debugging_5.png|center]]
 
[[File:suggest_debugging_5.png|center]]
  
In the call stack, your own code will appear some frames below the top
+
In the call stack, your own code will appear some frames below the top.
  
 
[[File:suggest_debugging_6.png|center]]
 
[[File:suggest_debugging_6.png|center]]
  
Double-clicking your own code's frame will take you to the location of the SuggestDebugging statement
+
Double-clicking your own code's frame will take you to the location of the SuggestDebugging statement.
  
 
[[File:suggest_debugging_7.png|center]]
 
[[File:suggest_debugging_7.png|center]]
  
You may now set a breakpoint and choose "Continue" from the "Debug" menu
+
You may now step through the code, set breakpoints, etc. When you are done, don't forget to "Quit" the Operator module from its "File" menu to terminate any BCI2000 modules that are still running.
 
 
[[File:suggest_debugging_8.png|center]]
 
 
 
As before, the debugger will stop when the breakpoint is hit
 
  
[[File:suggest_debugging_9.png|center]]
+
[[File:debug_10.png|center]]
  
 
==Next step==
 
==Next step==

Revision as of 15:31, 16 August 2018

Back

To this howto's overview page.

Insert SuggestDebugging

In the VeryNiceFilter constructor, add a line with a SuggestDebugging statement, and rebuild.

Suggest debugging 1.png

Run BCI2000

Double-click the "VeryNiceSignalProcessing" batch file you created earlier.

Suggest debugging 2.png

The VeryNiceFilter constructor is executed at module startup, so a "SuggestDebugging" dialog box will pop up immediately. The dialog box will stay in the front -- you may move it out of the way, but otherwise leave it alone.

Suggest debugging 3.png

Attach the debugger

In the VisualStudio IDE, choose "Attach to Process..." from the "Debug" menu.

Suggest debugging 4.png

Select the "Very Nice Signal Processing" process, click "Attach", and finally dismiss the "SuggestDebugging" dialog box by clicking "yes".

Suggest debugging 5.png

In the call stack, your own code will appear some frames below the top.

Suggest debugging 6.png

Double-clicking your own code's frame will take you to the location of the SuggestDebugging statement.

Suggest debugging 7.png

You may now step through the code, set breakpoints, etc. When you are done, don't forget to "Quit" the Operator module from its "File" menu to terminate any BCI2000 modules that are still running.

Debug 10.png

Next step

As a next step, learn how to deploy a release version of a BCI2000 module.

See also

Programming Howto:Building and Customizing BCI2000