Linux kernel code debugging on Android platforms

This topic does not seem to have good documentation for one place.

Here are the links without any solution. Someone can share their knowledge on how to debug and track in the Linux kernel and the Android platform.

Some links

+4
source share
2 answers

The traditional method (which I use most of the time) is to simply add printk to the appropriate sections of the code, and then read the code and fix the whole problem as soon as you narrow it down. I believe that this is usually what the developers of the MOST kernel do (of course, all 6 of my colleagues in my team and five six who work in another group). [I work with Linux on a PC, not on Android devices, but essentially it's the same kernel ...]

I'm sure kgdb can be used in some way, but it relies on having the right port (like serial or ethernet) to connect the debugger through, the serial number is hard to find on modern PCs and doesn't exist on everything in mobile phones. Ethernet will be fine, but most mobile phones (and other Android platforms) tend to only have Wi-Fi, and as I understand it, a whole other piece of software is needed on top of a regular IP stack to work properly. I do not believe kgdb supports Wi-Fi.

Sorry, I can’t give you a better answer. [I see from your links that you definitely did not find a good answer ...]

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

+4
source

I am writing Linux device drivers for Android. Using adb is the first tool of choice for Android developers. You can get kernel logs using the command "adb shell cat / proc / kmsg". If you are running on a platform that provides a serial terminal, you can get these kernel logs from this. Using printk and the kernel is just the tool I use to debug kernel code.

You can mount debugfs and get information about specific hardware.

Android comes with a set of tools, such as a stack utility, to get a stack trace, etc. I know that there is no documentation for developers of the Android platform. Most of the documentation is for application development.

+2
source

All Articles