在默认情况下,adb logcat只能显示应用程序的调试信息,我把logcat.cpp修改了一下,让它同时可以打印内核调试信息:
修改的文件:system/core/logcat/logcat.cpp
1、首先先加入头文件
#include <sys/klog.h> //add by
2、定义所使用的TAG
#define KERNEL_TAG "Kernel"
修改的文件:system/core/logcat/logcat.cpp
1、首先先加入头文件
#include <sys/klog.h> //add by
2、定义所使用的TAG
#define KERNEL_TAG "Kernel"
3、替换readLogLines函数
- static void readLogLines(log_device_t* devices)
- {
- log_device_t* dev;
- int max = 0;
- int ret;
- int queued_lines = 0;
- bool sleep = true;
- char buffer[256] = {0}; //add by zhaofei
- int result;
- fd_set readset;
- for (dev=devices; dev; dev = dev->next) {
- if (dev->fd > max) {
- max = dev->fd;
- }
- }
- while (1) {
- do {
- timeval timeout = { 0, 5000 /* 5ms */ }; // If we oversleep it's ok, i.e. ignore EINTR.
- FD_ZERO(&readset); </