Table of Contents
After the package had been deployed, you can debug either Java or native code in the application. Simultaneous Java + native debugging is a work in progress and will be available in a future release of WinGDB.
In all cases, the Debuggable attribute must be set to be able to debug (Application property page on the project node).
This section describes native code debugging in more detail.
Before starting debugging, you might want to set some options. They have default values which are appropriate in most cases. These options are located on the Debug property page for the project node.
The most important one is Debug target device. Ensure that emulator is entered here to debug on the emulator, or device for a single connected device. There might be also a device (or emulator process) name entered, as listed by adb devices command.
For native code debugging, Debug session type should be set to Native.
The emulator should be running before starting debugging. WinGDB does not start it, as the SDK already has appropriate user interface called AVD. You can create multiple emulator configurations in AVD, and then launch desired one. WinGDB works with any emulator that is started at the moment.
In order to be able to debug on a device, usually a debug mode must be enabled on it. Please consult Android SDK documentation on that topic.
You can debug in two modes:
Warning: as there are several kinds of systems, a couple of different Attach to process option variants are provided. It is currently impossible to unify them. You have to choose correct one for the system you are working with.
In case of Android, you must have Android WinGDB project opened and use Attach option from the Tools or Debug menu. Otherwise Visual Studio will open regular Attach dialog which is not suitable for Android processes. The proper Attach dialog is named explicitly Attach to Android process. If Visual Studio displays a different window, click on your Android project in Solution Explorer to explicitly select the project and choose the option again.
Also do not use the Attach option from WinGDB menu in Enterprise edition, as it opens a different Attach dialog, suitable for remote Linux or embedded systems development.
In many cases, Android system log is a very useful tool to diagnose problems. You can view it manually using the logcat command. WinGDB also offers some ways to view it without leaving Visual Studio. One way is to use Device monitor. The second one is to enable log dump into the Debug window during the debugging session.
To view the log in Debug window, set Display Android system log option to any other format than None. You can also set a filter for log messages -- consult logcat documentation on that topic.
Table of Contents