summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Rowe <erowe@google.com>2015-06-08 12:08:33 -0700
committerEric Rowe <erowe@google.com>2015-06-08 12:08:33 -0700
commit69155df867ac697a430ab9a998400ef727cffa1b (patch)
tree09931b205bd7ba41782d409b864f71c202856b98 /src
parentc62fad09df43054df2d755ef7e43d6085656c04b (diff)
downloadloganalysis-69155df867ac697a430ab9a998400ef727cffa1b.tar.gz
Start parsing NCs from build fingerprint
Native crashes used to always start with "*** *** ... ***" but not anymore. The next line is always "Build fingerprint: ..." so start with that. Bug: 21642733 Change-Id: I0e1b7c6a70f646ea27f7da62f141d14b6c75dd58
Diffstat (limited to 'src')
-rw-r--r--src/com/android/loganalysis/parser/LogcatParser.java8
-rw-r--r--src/com/android/loganalysis/parser/NativeCrashParser.java14
2 files changed, 8 insertions, 14 deletions
diff --git a/src/com/android/loganalysis/parser/LogcatParser.java b/src/com/android/loganalysis/parser/LogcatParser.java
index 3c0f774..f64936c 100644
--- a/src/com/android/loganalysis/parser/LogcatParser.java
+++ b/src/com/android/loganalysis/parser/LogcatParser.java
@@ -274,13 +274,13 @@ public class LogcatParser implements IParser {
data.mLines.add(msg);
}
- // Native crashes are separated either by different PID/TIDs or when NativeCrashParser.START
- // matches a line. The newest entry is kept in the dataMap for quick lookup while all
- // entries are added to the list.
+ // Native crashes are separated either by different PID/TIDs or when
+ // NativeCrashParser.FINGERPRINT matches a line. The newest entry is kept in the dataMap
+ // for quick lookup while all entries are added to the list.
if (anyNativeCrashTagMatches(level, tag)) {
String key = encodeLine(pid, tid, level, tag);
LogcatData data;
- if (!mDataMap.containsKey(key) || NativeCrashParser.START.matcher(msg).matches()) {
+ if (!mDataMap.containsKey(key) || NativeCrashParser.FINGERPRINT.matcher(msg).matches()) {
data = new LogcatData(pid, tid, time, level, tag, mPreambleUtil.getLastTail(),
mPreambleUtil.getIdTail(pid));
mDataMap.put(key, data);
diff --git a/src/com/android/loganalysis/parser/NativeCrashParser.java b/src/com/android/loganalysis/parser/NativeCrashParser.java
index 3ad3034..f054504 100644
--- a/src/com/android/loganalysis/parser/NativeCrashParser.java
+++ b/src/com/android/loganalysis/parser/NativeCrashParser.java
@@ -26,15 +26,12 @@ import java.util.regex.Pattern;
*/
public class NativeCrashParser implements IParser {
- /** Matches: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- public static final Pattern START = Pattern.compile("^(?:\\*\\*\\* ){15}\\*\\*\\*$");
/** Matches: Build fingerprint: 'fingerprint' */
- private static final Pattern FINGERPRINT = Pattern.compile("^Build fingerprint: '(.*)'$");
+ public static final Pattern FINGERPRINT = Pattern.compile("^Build fingerprint: '(.*)'$");
/** Matches: pid: 957, tid: 963 >>> com.android.camera <<< */
private static final Pattern APP = Pattern.compile(
"^pid: (\\d+), tid: (\\d+)(, name: .+)? >>> (\\S+) <<<$");
-
/**
* {@inheritDoc}
*
@@ -46,16 +43,13 @@ public class NativeCrashParser implements IParser {
StringBuilder stack = new StringBuilder();
for (String line : lines) {
- Matcher m = START.matcher(line);
+ Matcher m = FINGERPRINT.matcher(line);
if (m.matches()) {
nc = new NativeCrashItem();
- }
+ nc.setFingerprint(m.group(1));
+ }
if (nc != null) {
- m = FINGERPRINT.matcher(line);
- if (m.matches()) {
- nc.setFingerprint(m.group(1));
- }
m = APP.matcher(line);
if (m.matches()) {
nc.setPid(Integer.valueOf(m.group(1)));