diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-11-16 15:28:31 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-11-16 15:46:42 -0800 |
commit | 538bc12c0807ceb850749b8803546b058e049146 (patch) | |
tree | 8263d2d6d8a4d7d43159ad26cbab4905040fb94f /logcat/logcat.cpp | |
parent | e631e470e059d84388f3aacfe11a3fa60a584ba7 (diff) | |
download | system_core-538bc12c0807ceb850749b8803546b058e049146.tar.gz system_core-538bc12c0807ceb850749b8803546b058e049146.tar.bz2 system_core-538bc12c0807ceb850749b8803546b058e049146.zip |
logcat: add hidden --debug flag and cleanup
Allow us to debug corrupted log messages. Fix liblog to propagate
errors correctly and repair a gtest that failed.
Test: liblog-unit-tests --gtest_filter=liblog.__android_log_bswrite_and_print___max
logcat -b events --debug -t 50
Bug: 32903864
Change-Id: Ib4eb9f466777cd23b8b54728d36354590d07869a
Diffstat (limited to 'logcat/logcat.cpp')
-rw-r--r-- | logcat/logcat.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp index d0c693d31..41f228009 100644 --- a/logcat/logcat.cpp +++ b/logcat/logcat.cpp @@ -81,6 +81,7 @@ static pcrecpp::RE* g_regex; static size_t g_maxCount; static size_t g_printCount; static bool g_printItAnyways; +static bool g_debug; enum helpType { HELP_FALSE, @@ -188,7 +189,7 @@ static void processBuffer(log_device_t* dev, struct log_msg *buf) } else { err = android_log_processLogBuffer(&buf->entry_v1, &entry); } - if (err < 0) { + if ((err < 0) && !g_debug) { goto error; } @@ -619,6 +620,7 @@ int main(int argc, char **argv) int option_index = 0; // list of long-argument only strings for later comparison static const char pid_str[] = "pid"; + static const char debug_str[] = "debug"; static const char id_str[] = "id"; static const char wrap_str[] = "wrap"; static const char print_str[] = "print"; @@ -627,6 +629,7 @@ int main(int argc, char **argv) { "buffer", required_argument, NULL, 'b' }, { "buffer-size", optional_argument, NULL, 'g' }, { "clear", no_argument, NULL, 'c' }, + { debug_str, no_argument, NULL, 0 }, { "dividers", no_argument, NULL, 'D' }, { "file", required_argument, NULL, 'f' }, { "format", required_argument, NULL, 'v' }, @@ -691,6 +694,10 @@ int main(int argc, char **argv) g_printItAnyways = true; break; } + if (long_options[option_index].name == debug_str) { + g_debug = true; + break; + } if (long_options[option_index].name == id_str) { setId = optarg && optarg[0] ? optarg : NULL; break; |