diff options
author | Dimitry Ivanov <dimitry@google.com> | 2017-02-17 14:41:30 -0800 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2017-02-17 14:57:34 -0800 |
commit | fbe54c4fe8c35294d60efbe0d1d6466211d4dc40 (patch) | |
tree | 8907096bc43e2620b552ffefac25185607181d09 /linker/linker_logger.cpp | |
parent | fec0e015ce0369b3ad710547f3d6af343b2cd5e1 (diff) |
Fix debug.ld for apps with long names and services
1. There is no longer limit on property names - remove
the trimming the name of the property.
2. Make debug.ld work for processes with names ending with ":something"
This is naming convention for services:
https://developer.android.com/guide/components/services.html
Bug: http://b/35338922
Bug: http://b/33926793
Test: manual - set ld.debug.app property for the app
Test: from http://b/35338922 and see that it works
Test: for the service as well.
Change-Id: Ic7c6d4edce4a5a22f144496d5c0a3e458217c6e4
Diffstat (limited to 'linker/linker_logger.cpp')
-rw-r--r-- | linker/linker_logger.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/linker/linker_logger.cpp b/linker/linker_logger.cpp index 8190cc94f..08728afbb 100644 --- a/linker/linker_logger.cpp +++ b/linker/linker_logger.cpp @@ -90,21 +90,17 @@ void LinkerLogger::ResetState() { flags_ |= ParseProperty(value); // get process basename - std::string process_name = basename(g_argv[0]); + const char* process_name_start = basename(g_argv[0]); + // remove ':' and everything after it. This is naming convention for + // services: https://developer.android.com/guide/components/services.html + const char* process_name_end = strchr(process_name_start, ':'); - std::string property_name = std::string(kLdDebugPropertyPrefix) + process_name; - - // Property names are limited to PROP_NAME_MAX. + std::string process_name = (process_name_end != nullptr) ? + std::string(process_name_start, (process_name_end - process_name_start)) : + std::string(process_name_start); - if (property_name.size() >= PROP_NAME_MAX) { - size_t count = PROP_NAME_MAX - 1; - // remove trailing dots... - while (property_name[count-1] == '.') { - --count; - } + std::string property_name = std::string(kLdDebugPropertyPrefix) + process_name; - property_name = property_name.substr(0, count); - } value = property_get(property_name.c_str()); flags_ |= ParseProperty(value); } |