Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Linux kernel code on Android platforms

It seems this subject doesn't have a nice fully one place documentation.

Here are references without any solution. Can anyone contribute his knowledge for how to debug and trace in linux kernel and Android platform.

Some Links

  • The State of Kernel Debugging Technology
  • Using kgdb, kdb and the kernel debugger internals
  • Android: Kernel Debugging with KGDB
  • Search for "kgdb" in Android-Kernel Google Group
  • Q: Android's Kernel Debugger in Android-Kernel Group
  • KDB at SGI
  • Debugging ARM Linux kernel and applications
  • Linux Kernel Debugging
  • KDB at eLinux
like image 234
0x90 Avatar asked Dec 24 '12 22:12

0x90


1 Answers

The traditional method (which I use most of the time) is to simply add printk to the relevant sections of the code, and then read the code and fix whatever the problem is once you have narrowed it down. I believe this is generally what MOST kernel developers do (certainly all 6 of my colleagues in my team, and the five-six that work in a different group). [I work with Linux on PC's, not in Android devices, but it's essentially the same kernel...]

I'm sure kgdb can be used in some way, but it relies on having a suitable port (e.g. serial or ethernet) to connect the debugger via, serial is hard to find on modern PC's, and don't exist at all in mobile phones. Ethernet will be fine, but most mobile phones (and other Android platforms) tend to only have WiFi, and as far as I understand, that requires a whole other lot of software on top of the regular IP stack to make it work right. I don't beleive kgdb supports wifi.

Sorry I can't give you a better answer. [I see from your links that you didn't exactly find a good answer...]

Edit: However, maybe this will help at least sometimes: http://bootloader.wikidot.com/android:kgdb

like image 145
Mats Petersson Avatar answered Nov 01 '22 15:11

Mats Petersson