tools:acrn-crashlog: unify the event analyzing process in crashlog

This patch unifies the event analyzing process in the
crashlog_sender functions:
a. analyze android events in android_events.c.
b. unify the analyzing output form of vm events and crash events.
c. concentrate the event analyzing process to the same function.

Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Liu, Xiaojing <xiaojing.liu@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu
2019-04-19 11:13:00 +08:00
committed by ACRN System Integration
parent 13d50c2296
commit 901ce53971
7 changed files with 204 additions and 114 deletions

View File

@@ -156,6 +156,39 @@ int strcnt(char *str, char c)
return cnt;
}
char *strings_ind(char *strings, size_t size, int index, size_t *slen)
{
int i = 0;
size_t len;
char *start = strings;
char *str_tail;
size_t left;
if (!strings || !size)
return NULL;
str_tail = memchr((void *)strings, '\0', size);
if (!str_tail)
return NULL;
while (1) {
len = str_tail - start;
if (i++ == index)
break;
left = strings + size - str_tail - 1;
if (!left)
return NULL;
start = str_tail + 1;
str_tail = memchr((void *)start, '\0', left);
if (!str_tail)
break;
}
if (slen)
*slen = len;
return start;
}
static int reg_match(const char *str, const char *pattern,
char *matched_sub, size_t matched_space,
size_t *end_off)