Debugging the san-angeles project with Visual Studio

This tutorial shows how to build and debug the San-Angeles sample provided with Android NDK.

Before you begin, please install VisualGDB 2.0 or later (ensure that “Android Edition” is checked in the installer). If you are not familiar with VisualGDB, please first go through the Android Quickstart tutorial.

 Warning! The Android Emulator does
not support OpenGL. You will need a real device for this
tutorial.

  1. Start Visual Studio. Select File->New project->VisualGDB->Android Project Wizard.01-newprj
  2. Enter the path where you want to copy the sample and an arbitrary project name (e.g. SanAngelesTest).
  3. Select “Clone a sample from NDK”.02-clone
  4. Select “San-Angeles” from the sample list.03-sanangeles
  5. Keep the default Android 1.6 platform and press Finish.04-platform
  6. The san-angeles project folder includes files from Windows and Linux ports of the demo that won’t compile on Android. Select them in Solution Explorer, right-click and select “Remove”.05-remove
  7. Press “remove” in the confirmation window.06-confirm
  8. Build the project by selecting “Build->Build All”.
  9. Prepare your device for debugging (follow this manual if doing it for the first time) and connect it to PC.
  10. In Visual Studio select “Android->Debug Android App”.07-debug
  11. VisualGDB will deploy the app automatically and start it. If your device supports OpenGL, you will see the demo on the screen:08-run
  12. To test debugging functionality, set a breakpoint on the prepareFrame() function by navigating there in Visual Studio and pressing F9. The breakpoint will trigger almost immediately:09-stack
  13. You can use the usual Visual Studio tools to examine call stack, variables and threads, or the GDB Session window to send commands directly to GDB.
  14. To finish debugging, press Shift+F5.