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### Host 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
35On the device, `adbd` does not read `ADB_TRACE` env variable. Instead it checks property `persist.adb.trace_mask`.
36Set it and then cycle `adbd`.
37
38```
39$ adb shell su 0 setprop persist.adb.trace_mask 1
40$ adb shell su 0 pkill adbd
41```
42
43`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`).
44
45
46
47