Tracing an Android Application
Once your device has been correctly set up with MGD, you will need to connect to the device in order to trace your application.
If your device is both visible over ADB and the MGD Android Application has been installed, you can use the Device Manager to connect to your device by following the instructions in Connecting to Your Device.
If you want to connect to a device using ADB, open a terminal on your host device and run:
adb forward tcp:5002 tcp:5002In this case, the target IP will be 127.0.0.1:5002.
If you are using the MGD Android Application, start it, and switch the Enable MGD Daemon option in the App List tab to the ON state.
If you are using the mgddaemon application on a rooted device, you should:
- Open a terminal on your host device.
Open a shell as a super user on your target device by running:
adb shell su
If you are going to be tracing a Vulkan application, run:
setprop debug.vulkan.layers VK_LAYER_ARM_MGD:This command tells the Vulkan loader to load the layer with the name VK_LAYER_ARM_MGD, which should have been installed in /data/local/debug/vulkan.
Start the daemon by running:
- Follow the instructions in Connect to an IP to connect to the target IP.
Once a connection has been established, you can start the Android application that you want to trace. If you have correctly packaged the interceptor or Vulkan layer with your application, or if your device is rooted and the interceptor or Vulkan layer have been installed on your device, the application will show up in the MGD Android Application's list of all traceable applications.
If an application is started before the daemon is started, only the function calls made from the time when the daemon was started will be traced. In this case, the state and assets of any traced applications will be incomplete when viewed in MGD.
If an OpenCL or Vulkan application is started before tracing begins, the state and assets of any traced applications will be incomplete when viewed in MGD. OpenGL ES applications started before tracing begins can have their state recovered. For more information, see Tracing an Application That Is Already Running.