0
点赞
收藏
分享

微信扫一扫

logwrapper  init.rc 相关语法


logwrapper

Android本地应用程序的调试信息一般通过LOGI、LOGD、LOGE等android logger提供的函数进行程序的debug,但是有时候某些本地应用使用的是printf等c库里的函数进行数据输出,如果这些程序是由init进程执行,那么使用printf等函数的输出内容无法显示在终端上(android在init中做了手脚),甚至某些进程可能会遇到段错误等意外退出的情况,这种情况常见于最初porting android源码时。

如何解决上面提到的问题呢?Android提供了一个小工具,叫做logwrapper,用来处理上面提到的情况,使用方法就是将可执行文件的路径作为logwrapper的参数,比如你可以在init.rc中这样写:

service adbd /system/bin/logwrapper /sbin/adbd

   

这样adbd中使用printf函数的输出都会从logcat中显示出来。


举报

相关推荐

init.rc解析脚本分析

0 条评论