Trac is being migrated to new services! Issues can be found in our new
YouTrack instance and WIKI pages can be found on our
website.
- Timestamp:
-
Jun 7, 2012, 12:46:51 PM (12 years ago)
- Author:
-
michaelz
- Comment:
-
Added steps on configuring gdb and starting a debug session.
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
1 | 1 | = debugging native code in Android. = |
| 2 | |
| 3 | (setting this up is not needed to do java debugging, you just can't step into native functions.) |
| 4 | |
| 5 | == before starting == |
| 6 | |
| 7 | You should at first compile the library yourself. |
| 8 | |
| 9 | Then, go to the android ndk directory. There should be a file ndk-gdb. Copy it, name the copy ndk-gdb-eclipse, and remove the following, last line: |
| 10 | $GDBCLIENT -x `native_path $GDBSETUP` |
| 11 | |
| 12 | == in Eclipse == |
| 13 | * Open the External Tools Configuration Dialog. |
| 14 | * Add a new Program by double-clicking on Program on the left side. |
| 15 | * Select the ndk-gdb-eclipse script you just created. |
| 16 | * Select the build tab, and disable Build before launch. |
| 17 | * Hit Apply, Close. |
| 18 | |
2 | 19 | |
3 | 20 | * (skip for Testclient) Set android:debuggable="true" in your application definition in the AndroidManifest.xml. |
… |
… |
|
7 | 24 | * Enter im.pidgin.libpurple as Project name |
8 | 25 | * Enter Android/libim.pidgin.libpurple.so as C/C++ Application name (or just click on Search project... to find it) |
| 26 | * Select Disable auto build |
9 | 27 | * Go to the debugger tab. |
10 | 28 | * Select gdbserver as Debugger. |
… |
… |
|
12 | 30 | * As command file, select the gdb.setup file in the native directory. |
13 | 31 | * In the connection tab, enter TCP as connection type, localhost as target and 5039 as port. |
| 32 | * Hit apply. |
| 33 | |
| 34 | * Create a new Launch group by double-clicking on Launch group. |
| 35 | * Add the Program launcher you created. You should set "Post launch action" to "Wait until terminated". |
| 36 | * Add your Debug configuration we just created |
| 37 | * Give it a nice name. |
14 | 38 | * Close the dialog by hitting Apply and Close. |
| 39 | == Start debugging == |
| 40 | |
| 41 | When you want to debug native code, do the following: |
| 42 | |
| 43 | * Add a breakpoint before initializing libpurple, e.g. in your Applications onCreate(). |
| 44 | |
| 45 | * Start your application in the normal Android debug mode. It should pause at that breakpoint. |
| 46 | |
| 47 | * Then start your debug configuration, by clicking on Debug Configurations..., selecting the Launch group you created and hitting Debug. |
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!