Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breakpoints in Android Platform source

Using Intellj-idea I'm trying to debug into the Android source API 17 but when I set breakpoints in the platform source they are being ignored when run. Looking at the breakpoint whilst debugging there is a cross in it with a message stating "no executable code found at line 15,508 in class android.view"

I've tried running against an emulator with API 17 set as well as a phone with Android 4.2.2 but both don't work. I can sort of debug into the methods but the cursor jumps around.

So I'm guessing that there is no debug info as well as some optimisations that have gone on. So my question:

Is there a way I can properly debug the Android Platform from the perspective of my application and set breakpoints that work in it? Maybe a an emulator that has been been built with debug info?

Any help would be appreciated?

Regards Lee

like image 616
LeeAlexander Avatar asked May 30 '13 09:05

LeeAlexander


People also ask

What is a breakpoint in Android?

Android Studio supports several types of breakpoints that trigger different debugging actions. The most common type is a line breakpoint that pauses the execution of your app at a specified line of code.

Which tool is used for debugging of Android platform?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

What are the types of breakpoints?

There are two types of breakpoints: hardware breakpoints based on the processor hardware capabilities and software breakpoints. For both types of breakpoints, the debugger apparently takes similar actions. When a breakpoint is added, the debugger needs to know the address in which to insert the breakpoint.


1 Answers

It depends on what application you are trying to debug: your own application, a system application such as android.process.acore.

To debug platform source running in your own application

The main issue is the line numbers of the platform source you have downloaded on your computer must match what is running on the device. Your best bet will be to debug on Google Nexus device such as the Nexus 5 or Nexus 7 since it should be running a compiled version of the source exactly as it was released by Google which you downloaded with the Android SDK. Just add the sourcepath to the sdk in IntelliJ, attach the debugger and set the breakpoint. Make sure you choose the same API level source as is running on the device. That should do it.

To debug platform source running in a system application

You will need eng build of the Android platform to debug system processes. If you haven't built and installed the Android platform before it is quite a bit of work and requires an unlocked bootloader. Maybe there are prebuilt eng builds of cyanogenmod or something that can be downloaded but I can't find any after some trivial Googling. You may also make an eng build of AOSP yourself and run the emulator on your machine. See Running emulator after building Android from source and the "Choose a target" section on the AOSP site for info on building your own eng build if you are feeling very ambitious.

like image 65
satur9nine Avatar answered Nov 08 '22 02:11

satur9nine