Merge "logcat: add hidden --debug flag and cleanup"
am: c097c79b77
Change-Id: I50d28c3fc5f7ffbf1186ece2748e944bfdcf8a9f
This commit is contained in:
commit
c8124d1592
3 changed files with 13 additions and 2 deletions
|
|
@ -1055,6 +1055,7 @@ LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer(
|
||||||
outRemaining--;
|
outRemaining--;
|
||||||
/* pretend we ate all the data to prevent log stutter */
|
/* pretend we ate all the data to prevent log stutter */
|
||||||
inCount = 0;
|
inCount = 0;
|
||||||
|
if (result > 0) result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eat the silly terminating '\n' */
|
/* eat the silly terminating '\n' */
|
||||||
|
|
@ -1078,7 +1079,7 @@ LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer(
|
||||||
|
|
||||||
entry->message = messageBuf;
|
entry->message = messageBuf;
|
||||||
|
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,9 @@ static void bswrite_test(const char *message) {
|
||||||
EXPECT_TRUE(NULL != logformat);
|
EXPECT_TRUE(NULL != logformat);
|
||||||
AndroidLogEntry entry;
|
AndroidLogEntry entry;
|
||||||
char msgBuf[1024];
|
char msgBuf[1024];
|
||||||
|
if (length != total) {
|
||||||
|
fprintf(stderr, "Expect \"Binary log entry conversion failed\"\n");
|
||||||
|
}
|
||||||
int processBinaryLogBuffer = android_log_processBinaryLogBuffer(
|
int processBinaryLogBuffer = android_log_processBinaryLogBuffer(
|
||||||
&log_msg.entry_v1, &entry, NULL, msgBuf, sizeof(msgBuf));
|
&log_msg.entry_v1, &entry, NULL, msgBuf, sizeof(msgBuf));
|
||||||
EXPECT_EQ((length == total) ? 0 : -1, processBinaryLogBuffer);
|
EXPECT_EQ((length == total) ? 0 : -1, processBinaryLogBuffer);
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ static pcrecpp::RE* g_regex;
|
||||||
static size_t g_maxCount;
|
static size_t g_maxCount;
|
||||||
static size_t g_printCount;
|
static size_t g_printCount;
|
||||||
static bool g_printItAnyways;
|
static bool g_printItAnyways;
|
||||||
|
static bool g_debug;
|
||||||
|
|
||||||
enum helpType {
|
enum helpType {
|
||||||
HELP_FALSE,
|
HELP_FALSE,
|
||||||
|
|
@ -188,7 +189,7 @@ static void processBuffer(log_device_t* dev, struct log_msg *buf)
|
||||||
} else {
|
} else {
|
||||||
err = android_log_processLogBuffer(&buf->entry_v1, &entry);
|
err = android_log_processLogBuffer(&buf->entry_v1, &entry);
|
||||||
}
|
}
|
||||||
if (err < 0) {
|
if ((err < 0) && !g_debug) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -619,6 +620,7 @@ int main(int argc, char **argv)
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
// list of long-argument only strings for later comparison
|
// list of long-argument only strings for later comparison
|
||||||
static const char pid_str[] = "pid";
|
static const char pid_str[] = "pid";
|
||||||
|
static const char debug_str[] = "debug";
|
||||||
static const char id_str[] = "id";
|
static const char id_str[] = "id";
|
||||||
static const char wrap_str[] = "wrap";
|
static const char wrap_str[] = "wrap";
|
||||||
static const char print_str[] = "print";
|
static const char print_str[] = "print";
|
||||||
|
|
@ -627,6 +629,7 @@ int main(int argc, char **argv)
|
||||||
{ "buffer", required_argument, NULL, 'b' },
|
{ "buffer", required_argument, NULL, 'b' },
|
||||||
{ "buffer-size", optional_argument, NULL, 'g' },
|
{ "buffer-size", optional_argument, NULL, 'g' },
|
||||||
{ "clear", no_argument, NULL, 'c' },
|
{ "clear", no_argument, NULL, 'c' },
|
||||||
|
{ debug_str, no_argument, NULL, 0 },
|
||||||
{ "dividers", no_argument, NULL, 'D' },
|
{ "dividers", no_argument, NULL, 'D' },
|
||||||
{ "file", required_argument, NULL, 'f' },
|
{ "file", required_argument, NULL, 'f' },
|
||||||
{ "format", required_argument, NULL, 'v' },
|
{ "format", required_argument, NULL, 'v' },
|
||||||
|
|
@ -691,6 +694,10 @@ int main(int argc, char **argv)
|
||||||
g_printItAnyways = true;
|
g_printItAnyways = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (long_options[option_index].name == debug_str) {
|
||||||
|
g_debug = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (long_options[option_index].name == id_str) {
|
if (long_options[option_index].name == id_str) {
|
||||||
setId = optarg && optarg[0] ? optarg : NULL;
|
setId = optarg && optarg[0] ? optarg : NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue