• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ADB Debugging page
2
3## Address sanitizer
4
5### Host
6
7When you build you not only get an `adb` executable, you also get an `adb_asan`
8which is built with clang's address sanitizer.
9
10### Device
11
12Use HWASan (Hardware-assisted AddressSanitizer). This is done via `lunch`
13with an `hwasan` suffixed <product> (e.g.: `lunch aosp_panther_hwasan-trunk_staging-userdebug`)
14(for reminder, the lunch format is <product>-<release>-<variant>).
15
16## Logs
17
18### Host
19
20Enable logs and cycle the server.
21
22```
23$ export ADB_TRACE=all
24$ adb server nodaemon
25```
26
27The environment variable `ADB_TRACE` is also checked by the adb client.
28
29#### libusb
30Libusb log level can be increased via environment variable `LIBUSB_DEBUG=4` (and restarting the server).
31See libusb documentation for available [log levels](https://libusb.sourceforge.io/api-1.0/group__libusb__lib.html#ga2d6144203f0fc6d373677f6e2e89d2d2).
32
33### Device
34
35#### adbd
36On the device, `adbd` does not read `ADB_TRACE` env variable. Instead it checks property `persist.adb.trace_mask`.
37Set it and then cycle `adbd`.
38
39```
40$ adb shell su 0 setprop persist.adb.trace_mask 1
41$ adb shell su 0 pkill adbd
42```
43
44`adbd` will write logs in `/data/adb`. The filename depends on what time `adbd` started (e.g.:`adb-2024-10-08-17-06-21-4611`).
45
46#### Framework
47
48To log components living in Framework, several methods are available depending on how much
49needs to be seen.
50
51The log level of each component can be changed.
52```
53adb shell setprop log.tag.all VERBOSE
54adb shell setprop log.tag.AdbDebuggingManager D
55```
56
57Alternatively, components' log levels can be set directly on `logcat` command-line.
58```
59adb logcat AdbDebuggingManager:D *:S
60```
61
62#### mdnsResponder
63
64mdnsResponder is the lib in charge of mDNS service publishing on the device. Enabling logs
65requires recompiling it with the following changes.
66
67Change `mDNSDebug.c`.
68```
69mDNSexport int mDNS_LoggingEnabled = 1;
70```
71Change `Android.bp`.
72```
73-DMDNS_DEBUGMSGS=2
74```
75
76
77
78
79