Make LD_DEBUG more user-friendly.
This is more self-explanatory than arbitrary integers, actually does
explain itself if you typo or say LD_DEBUG=help, and makes statistics
and timing available without recompilation.
Some of the groups could probably use a little tweaking, and we could
probably use some more groups, but I think this is already better than
what we have, and the initial change moving LD_DEBUG from integers to
names should probably minimize the amount of change that regard.
There's also the continuing question of whether statistics and timing
should just be deleted. They're not super useful as-is, and we should
think about whether we want to make them more useful or just remove them.
The timing stuff in particular is probably questionable, because
systrace is probably a better way to do anything like that? But that too
sounds like a question for another day.
Bug: http://b/309528372
Test: adb shell LD_DEBUG=<various things> date
Change-Id: I52b96c4892a41f9d24873122aebe5c272f39cdae
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index 9abe542..f72716e 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -75,7 +75,7 @@
bool normalize_path(const char* path, std::string* normalized_path) {
// Input should be an absolute path
if (path[0] != '/') {
- PRINT("normalize_path - invalid input: \"%s\", the input path should be absolute", path);
+ DL_WARN("normalize_path - invalid input: \"%s\", the input path should be absolute", path);
return false;
}
@@ -144,7 +144,7 @@
}
const char* const path = normalized_path.c_str();
- TRACE("Trying zip file open from path \"%s\" -> normalized \"%s\"", input_path, path);
+ LD_DEBUG(any, "Trying zip file open from path \"%s\" -> normalized \"%s\"", input_path, path);
// Treat an '!/' separator inside a path as the separator between the name
// of the zip file on disk and the subdirectory to search within it.
@@ -157,7 +157,7 @@
char buf[512];
if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) {
- PRINT("Warning: ignoring very long library path: %s", path);
+ DL_WARN("ignoring very long library path: %s", path);
return false;
}