System: ubuntu 14.04
1. download source code and build
This step is not hard. basically following the doc here:
https://source.android.com/source/building-running.html You should be able to run emulator after build. One tips for re-running emulator after closing the terminal window is to create script like below method 1:
build/envsetup.sh && lunch full-eng && emulator
method 2:
where to find the emulator?
2. debug android framework java source code
download the ADT eclipse ADT: http://developer.android.com/sdk/installing/index.html
it has the eclipse IDE and DDMS debugger
you can create a java project to import all the java source code into eclipse as described in https://source.android.com/source/using-eclipse.html
I have tried the red part below:
-
f Eclipse asks you for a workspace location, don't choose default, create the workspace at the android root.
-
If you have a "Welcome" screen, close it to reveal the Java perspective.
-
File > New > Java Project
-
Pick a project name, "android" or anything you like.
-
Select "Create project from existing source", enter the path to your Android root directory, and click Finish.
-
Wait while it sets up the project. (You'll see a subtle progress meter in the lower right corner.)
then, pick an app like setting app to debug. Set break point to the setting app's source code.
3. common command
- croot: Changes directory to the top of the tree.
- m: Makesfrom the top of the tree.
- mm: Builds all of the modules in the currentdirectory.
- mmm: Builds all of the modules in the supplieddirectories.
- cgrep: Greps on all local C/C++ files.
- hgrep: Greps on all local C/C++ header files.
- jgrep: Greps on all local Java files.
- mkgrep: Greps on all local make files.
- rcgrep: Greps on all local .rc files.
- resgrep: Greps on all local res/*.xml files.
- shgrep: Greps on all local .sh files.
- godir: Go to the directory containing a file.
good post:
http://apienthusiast.blogspot.com/2014/06/using-eclipse-to-browse-and-edit-aosp.html
andriod build system
http://elinux.org/Android_Build_System
use emulator
http://stackoverflow.com/questions/9022750/running-emulator-after-building-android-from-source
gdb & gdb server
http://www.thegeekstuff.com/2014/04/gdbserver-example/
http://thinksrc.com/2012/07/15/android-gdb-full-symbol/
http://www.kandroid.org/online-pdk/guide/debugging_gdb.html