adb logcat打印内核调试信息
2012-08-07 15:16
555 查看
在调试内核的时候,如果用串口总要费县到串口,如果能直接用adb logcat 命令就好了,插上USB就可以了,也省去了飞线的步骤:
如何才能实现呢,经过搜索找到了如下的方法:
更改logcat.cpp文件:
第一步:添加头文件 #include <sys/klog.h> //add
第二步:添加宏 #define KERNEL_TAG "Kernel"
第三部:修改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 }; // If we oversleep it's ok, i.e. ignore EINTR.
FD_ZERO(&readset);
for
(dev=devices; dev; dev = dev->next) {
FD_SET(dev->fd,
&readset);
}
result
= select(max + 1, &readset, NULL, NULL, sleep ? NULL : &timeout);
}
while (result == -1 && errno == EINTR);
if
(result >= 0) {
for
(dev=devices; dev; dev = dev->next) {
if
(FD_ISSET(dev->fd, &readset)) {
queued_entry_t*
entry = new queued_entry_t();
如何才能实现呢,经过搜索找到了如下的方法:
更改logcat.cpp文件:
第一步:添加头文件 #include <sys/klog.h> //add
第二步:添加宏 #define KERNEL_TAG "Kernel"
第三部:修改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 }; // If we oversleep it's ok, i.e. ignore EINTR.
FD_ZERO(&readset);
for
(dev=devices; dev; dev = dev->next) {
FD_SET(dev->fd,
&readset);
}
result
= select(max + 1, &readset, NULL, NULL, sleep ? NULL : &timeout);
}
while (result == -1 && errno == EINTR);
if
(result >= 0) {
for
(dev=devices; dev; dev = dev->next) {
if
(FD_ISSET(dev->fd, &readset)) {
queued_entry_t*
entry = new queued_entry_t();
相关文章推荐
- Android 让adb logcat打印内核调试信息
- 让adb logcat打印内核调试信息
- 让adb logcat打印内核调试信息
- 让adb logcat打印内核调试信息
- Android 让adb logcat打印内核调试信息
- Android 让adb logcat打印内核调试信息
- android adb logcat打印内核调试信息
- 让adb logcat打印内核调试信息
- adb打印内核调试信息dmsg和kmsg说明
- Android 用adb 打印linux内核调试信息dmesg和kmsg命令
- Android 用adb 打印linux内核调试信息dmesg和kmsg命令
- 使用adb logcat 打印 trace信息
- Android打印调试信息几种方法===>Log
- 函数调试用函数printk打印内核信息的方法
- android调试输出log打印信息到本地文件
- JNI开发之c代码中LOG打印调试信息
- 实时打印 android 模拟器的内核log信息
- Android Studio真机调试时不打印Log信息的解决方法
- 图形界面终端下打印内核调试信息
- adb查看内核LOG信息