Friday, December 2, 2011

Debug built-in applications in Eclipse

Sometimes it is not possible to build platform application in Eclipse but you may want to debug it or framework layer. All you need is to flash device with “eng” build and to get the necessary source code.
“Eng” mode means that you can see all running processes including system_process in Devices view of DDMS perspective:

For example we want to debug Settings application.
  • Create Debug Configuration
  • Select “Remote Java Application/New configuration
  • Set port to number in second column in Devices view.
  • For process it is 8622 in our case
  • Press Debug

In Devices view you will see green bug near your process.
To attach source code select “Edit Source Lookup” on DalvikVM In Debug perspective
Add -> File System Directory -> select directory with your sources
  • Sources path should be placed over Default one
  • Select the folder for your sources containing the package structure (com/android/settings) not just settings
  • To set breakpoint open the source file and Toggle Breakpoint as usual. But there were no sing in sources on breakpoint line, you can see it in Breakpoints view or when the debugger will stop on it.
Debug Framework
Debug Framework is almost the same as single application debug with some special points:
  • system_process is used to debug framework services such as ActivityManagerService, InputMethodManagerService, WindowManagerService and so on.
  • is used to debug functionality placed under frameworks\base\packages\SystemUI\src\com\android\systemui folder (StatusBar and usb)
  • to debug source code under frameworks\base\core\java\android, for example TextView, EditText, SearchDialog, Activity you need to use application process in debug configuration since different views is launched from Application and have the same process ID.


  1. Is the procedure valid for "cpp" file in android framework like ""