Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit fae58f5

Browse files
committed
Document LD_DEBUG.
I forgot to document this when I made it more useful recently. Change-Id: I704d1c45c48b0ffe40ca945cbd8b7b4be78eda27
1 parent 0f4721d commit fae58f5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Diff for: android-changes-for-ndk-developers.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ symbols will not be made available to libraries loaded by later calls
108108
to dlopen(3) (as opposed to being referenced by DT_NEEDED entries).
109109

110110

111-
## GNU hashes (Availible in API level >= 23)
111+
## GNU hashes (Available in API level >= 23)
112112

113113
The GNU hash style available with `--hash-style=gnu` allows faster
114114
symbol lookup and is supported by Android's dynamic linker in API level 23 and
@@ -437,6 +437,8 @@ app-specific one. For example, to enable logging of all dlopen(3)
437437
adb shell setprop debug.ld.all dlerror,dlopen
438438
```
439439

440+
See also `LD_DEBUG`.
441+
440442

441443
## dlclose interacts badly with thread local variables with non-trivial destructors
442444

@@ -544,3 +546,20 @@ This was especially confusing (and hard to debug) because the restriction did
544546
_not_ apply if your app was debuggable. To be compatible with all API levels,
545547
always give files that need to be extracted a "lib" prefix and ".so" suffix,
546548
or avoid using `extractNativeLibs`.
549+
550+
551+
## The LD_DEBUG environment variable.
552+
553+
On devices running API level 37 or later you can also use the `LD_DEBUG`
554+
environment variable when running a stand-alone executable such as a unit test.
555+
The syntax is broadly similar to glibc, and you can get help for the specific
556+
version of Android you're on by using `LD_DEBUG=help`.
557+
You can also enable everything by using `LD_DEBUG=all`.
558+
559+
(Older versions of Android also supported `LD_DEBUG`,
560+
but used integers instead of strings.
561+
The meaning of those integers varied by release,
562+
and some releases compiled support for `LD_DEBUG` out of released builds,
563+
so the best advice is either "look at the corresponding source" or
564+
"start with `1` and keep increasing the number until you see what you want,
565+
or see no change in output from the previous value".)

0 commit comments

Comments
 (0)