Tutorial: Building and Debugging the native-plasma Project with VisualGDB

This tutorial shows how to build and debug the native-plasma sample provided by Android NDK.

For this tutorial, ensure that at least VisualGDB 2.0 or later version is installed with the Android Edition.

  1. Start Visual Studio. Go to File->New->Project. Choose VisualGDB->Android Project Wizard. Choose the name and location for the project as you wish. 01-newproject
  2. For this tutorial we are cloning a sample, so choose that option. Note that if you have not done so before, then you need to ‘Configure NDK/SDK locations’. Press ‘Next’ when done. 02-clonesample
  3. Choose the native-plasma sample and press ‘Next’. 03-sampleselection
  4. Choose at least SDK platform 8 for this project. We choose 2.3.3 as the latest of the 2.* versions. Press ‘Finish’ to exit the tutorial. 04-platformselection
  5. Open ‘plasma.c’ from Solution Explorer and set a breakpoint at line 114 by pressin the ‘f9’ key. Then go to Build->Build Solution to build the project. 05-build
  6. Connect an Android physical device or emulator and make sure it is started. Next go to Android->Debug Android App to start debugging on the device. 06-debug
  7. Once the debugging has started look at the screen of the debugging device. The screen should be filled with plasma. Click on the device’s screen to start animating the plasma. 07-emulator
  8. Now the breakpoint we set is hit as the fill_plasma function is called each time the plasma is redrawn. Congratulations, you are successfully debugging the native-plasma project. 08-breaking