安卓一些简单操作命令

147 阅读2分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

一、查看是否有挂载分区

cat /proc/mounts

二、驱动相关

c 代表字符型驱动 char类型 b代表块类型驱动 block类型

前面一个叫主设备号用于判断那个驱动,后面是次设备号,用于判断那个硬件

mek_8q:/ # ls -l /dev
total 12
drwx--x--x  2 root      root          3380 2022-05-20 20:51 __properties__
crw-rw-rw-  1 root      root       10, 125 2022-05-20 20:51 ashmem /*主设备号10 此次设备号 125*/
crw-rw-rw-  1 root      root       10, 125 2022-05-20 20:51 ashmem15f99089-24f8-4f88-a9ad-3787ae2aa4d0
crw-------  1 root      root       10, 235 2022-05-20 20:51 autofs
lrwxrwxrwx  1 root      root            20 2022-05-20 20:51 binder -> /dev/binderfs/binder
drwxr-xr-x  3 root      root             0 2022-05-20 20:51 binderfs
dr-xr-xr-x  3 system    system           0 2022-05-20 20:51 blkio
drwxr-xr-x  6 root      root          1540 2022-05-20 20:51 block
drwxr-xr-x  3 root      root            60 2022-05-20 20:51 boringssl
drwxr-xr-x  3 root      root            60 2022-05-20 20:51 bus
drwx--x--x  2 system    system          60 2022-05-20 20:51 cgroup_info
crw-------  1 root      root        5,   1 2022-05-20 20:51 console

三、查看log buffer size

logcat -g 
mek_8q:/ # logcat -g                                                           
main: ring buffer is 16 MiB (359 KiB consumed), max entry is 5120 B, max payload is 4068 B
system: ring buffer is 16 MiB (371 KiB consumed), max entry is 5120 B, max payload is 4068 B
crash: ring buffer is 16 MiB (0 B consumed), max entry is 5120 B, max payload is 4068 B
kernel: ring buffer is 16 MiB (43 KiB consumed), max entry is 5120 B, max payload is 4068 B

四、在.mk文件里面添加打印

Android.mk

+++ b/Android.mk
@@ -2,6 +2,8 @@ LOCAL_PATH := $(call my-dir)
 
 ifneq ($(BOARD_HAVE_BLUETOOTH_BCM),)
 
+$(warning "cluo---------the value of BOARD_HAVE_BLUETOOTH_BCM is $(BOARD_HAVE_BLUETOOTH_BCM)")  
+ 
 include $(CLEAR_VARS)

编译时打印

hardware/broadcom/libbt/Android.mk was modified, regenerating...
[ 41% 97/233] including hardware/broadcom/libbt/Android.mk ...
hardware/broadcom/libbt/Android.mk:5: warning: "cluo---------the value of BOARD_HAVE_BLUETOOTH_BCM is true"
[ 95% 222/233] including vendor/nxp-opensource/nn-imx/Android.mk ...

五、addr2line反编译

崩溃日志;

05-20 03:40:23.756  2098  2098 F DEBUG   :       #01 pc 0000000000265434  /system/lib64/libbluetooth.so (startup_timer_expired(void*)+188) (BuildId: 3fae33ca1eda89f10865aeb654a96422)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #02 pc 0000000000336e48  /system/lib64/libbluetooth.so (alarm_ready_generic(alarm_t*, std::__1::unique_lock<std::__1::mutex>&)+400) (BuildId: 3fae33ca1eda89f1086)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #03 pc 0000000000336c78  /system/lib64/libbluetooth.so (alarm_queue_ready(fixed_queue_t*, void*)+112) (BuildId: 3fae33ca1eda89f10865aeb654a96422)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #04 pc 000000000033c090  /system/lib64/libbluetooth.so (internal_dequeue_ready(void*)+88) (BuildId: 3fae33ca1eda89f10865aeb654a96422)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #05 pc 000000000033d714  /system/lib64/libbluetooth.so (run_reactor(reactor_t*, int)+388) (BuildId: 3fae33ca1eda89f10865aeb654a96422)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #06 pc 000000000033d560  /system/lib64/libbluetooth.so (reactor_start(reactor_t*)+88) (BuildId: 3fae33ca1eda89f10865aeb654a96422)
05-20 03:40:23.756  2098  2098 F DEBUG   :       #07 pc 000000000033f088  /system/lib64/libbluetooth.so

反编译:

out/target/product/mek_8q$ addr2line -e symbols/system/lib64/libbluetooth.so 0000000000265434
system/bt/hci/src/hci_layer.cc:389