Commit f56ad8e6 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Add java_deobfuscate support for NoSuchFieldError

Came up in crbug/917004. Although these changes don't help crash server,
it's nice to have them work locally.

Change-Id: I7208b95bc1ea784b2f3050b7f2f8a8e223133e9f
Reviewed-on: https://chromium-review.googlesource.com/c/1437539
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarSam Maier <smaier@chromium.org>
Commit-Queue: Sam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626220}
parent af67f6eb
...@@ -40,13 +40,17 @@ public class FlushingReTrace { ...@@ -40,13 +40,17 @@ public class FlushingReTrace {
// Normal stack trace lines look like: // Normal stack trace lines look like:
// \tat org.chromium.chrome.browser.tab.Tab.handleJavaCrash(Tab.java:682) // \tat org.chromium.chrome.browser.tab.Tab.handleJavaCrash(Tab.java:682)
+ "(?:.*?(?::|\\bat)\\s+%c\\.%m\\s*\\(\\s*%s(?:\\s*:\\s*%l\\s*)?\\))|" + "(?:.*?(?::|\\bat)\\s+%c\\.%m\\s*\\(\\s*%s(?:\\s*:\\s*%l\\s*)?\\))|"
// E.g.: VFY: unable to resolve new-instance 3810 (LSome/Framework/Class;) in Lfoo/Bar;
+ "(?:.*L%C;.*)|"
// E.g.: Caused by: java.lang.NullPointerException: Attempt to read from field 'int bLA' // E.g.: Caused by: java.lang.NullPointerException: Attempt to read from field 'int bLA'
// on a null object reference // on a null object reference
+ "(?:.*java\\.lang\\.NullPointerException.*[\"']%t\\s*%c\\.(?:%f|%m\\(%a\\))[\"'].*)|" + "(?:.*java\\.lang\\.NullPointerException.*[\"']%t\\s*%c\\.(?:%f|%m\\(%a\\))[\"'].*)|"
// E.g.: java.lang.VerifyError: bLA // E.g.: java.lang.VerifyError: bLA
+ "(?:java\\.lang\\.VerifyError: %c)|" + "(?:java\\.lang\\.VerifyError: %c)|"
// E.g.: java.lang.NoSuchFieldError: No instance field e of type L...; in class LbxK;
+ "(?:java\\.lang\\.NoSuchFieldError: No instance field %f of type .*? in class L%C;)|"
// E.g.: Object of type Clazz was not destroyed... (See LifetimeAssert.java)
+ "(?:.*?Object of type %c .*)|"
// E.g.: VFY: unable to resolve new-instance 3810 (LSome/Framework/Class;) in Lfoo/Bar;
+ "(?:.*L%C;.*)|"
// E.g.: END SomeTestClass#someMethod // E.g.: END SomeTestClass#someMethod
+ "(?:.*?%c#%m.*?)|" + "(?:.*?%c#%m.*?)|"
// E.g.: The member "Foo.bar" // E.g.: The member "Foo.bar"
...@@ -56,6 +60,8 @@ public class FlushingReTrace { ...@@ -56,6 +60,8 @@ public class FlushingReTrace {
// Special-case for a common junit logcat message: // Special-case for a common junit logcat message:
// E.g.: java.lang.NoClassDefFoundError: SomeFrameworkClass in isTestClass for Foo // E.g.: java.lang.NoClassDefFoundError: SomeFrameworkClass in isTestClass for Foo
+ "(?:.* isTestClass for %c)|" + "(?:.* isTestClass for %c)|"
// E.g.: Caused by: java.lang.RuntimeException: Intentional Java Crash
+ "(?:Caused by: %c:.*)|"
// E.g.: java.lang.RuntimeException: Intentional Java Crash // E.g.: java.lang.RuntimeException: Intentional Java Crash
+ "(?:%c:.*)|" + "(?:%c:.*)|"
// All lines that end with a class / class+method: // All lines that end with a class / class+method:
......
...@@ -26,7 +26,10 @@ LINE_PREFIXES = [ ...@@ -26,7 +26,10 @@ LINE_PREFIXES = [
TEST_MAP = """\ TEST_MAP = """\
this.was.Deobfuscated -> FOO: this.was.Deobfuscated -> FOO:
int[] FontFamily -> a int[] mFontFamily -> a
1:3:void someMethod(int,android.os.Bundle):65:67 -> bar
never.Deobfuscated -> NOTFOO:
int[] mFontFamily -> a
1:3:void someMethod(int,android.os.Bundle):65:67 -> bar 1:3:void someMethod(int,android.os.Bundle):65:67 -> bar
""" """
...@@ -45,6 +48,7 @@ TEST_DATA = [ ...@@ -45,6 +48,7 @@ TEST_DATA = [
"END FOO#bar", "END FOO#bar",
"new-instance 3810 (LSome/Framework/Class;) in LFOO;", "new-instance 3810 (LSome/Framework/Class;) in LFOO;",
"FOO: Error message", "FOO: Error message",
"Caused by: FOO: Error message",
"\tat FOO.bar(PG:1)", "\tat FOO.bar(PG:1)",
"\t at\t FOO.bar\t (\t PG:\t 1\t )", "\t at\t FOO.bar\t (\t PG:\t 1\t )",
("Unable to start activity ComponentInfo{garbage.in/here.test}:" ("Unable to start activity ComponentInfo{garbage.in/here.test}:"
...@@ -53,6 +57,9 @@ TEST_DATA = [ ...@@ -53,6 +57,9 @@ TEST_DATA = [
("Caused by: java.lang.NullPointerException: Attempt to read from field" ("Caused by: java.lang.NullPointerException: Attempt to read from field"
" 'int[] FOO.a' on a null object reference"), " 'int[] FOO.a' on a null object reference"),
"java.lang.VerifyError: FOO", "java.lang.VerifyError: FOO",
('java.lang.NoSuchFieldError: No instance field a of type '
'Ljava/lang/Class; in class LFOO;'),
"NOTFOO: Object of type FOO was not destroyed...",
] ]
EXPECTED_OUTPUT = [ EXPECTED_OUTPUT = [
...@@ -70,6 +77,7 @@ EXPECTED_OUTPUT = [ ...@@ -70,6 +77,7 @@ EXPECTED_OUTPUT = [
"END this.was.Deobfuscated#someMethod", "END this.was.Deobfuscated#someMethod",
"new-instance 3810 (LSome/Framework/Class;) in Lthis/was/Deobfuscated;", "new-instance 3810 (LSome/Framework/Class;) in Lthis/was/Deobfuscated;",
"this.was.Deobfuscated: Error message", "this.was.Deobfuscated: Error message",
"Caused by: this.was.Deobfuscated: Error message",
"\tat this.was.Deobfuscated.someMethod(Deobfuscated.java:65)", "\tat this.was.Deobfuscated.someMethod(Deobfuscated.java:65)",
("\t at\t this.was.Deobfuscated.someMethod\t " ("\t at\t this.was.Deobfuscated.someMethod\t "
"(\t Deobfuscated.java:\t 65\t )"), "(\t Deobfuscated.java:\t 65\t )"),
...@@ -78,8 +86,11 @@ EXPECTED_OUTPUT = [ ...@@ -78,8 +86,11 @@ EXPECTED_OUTPUT = [
" 'void this.was.Deobfuscated.someMethod(int,android.os.Bundle)' on a null" " 'void this.was.Deobfuscated.someMethod(int,android.os.Bundle)' on a null"
" object reference"), " object reference"),
("Caused by: java.lang.NullPointerException: Attempt to read from field" ("Caused by: java.lang.NullPointerException: Attempt to read from field"
" 'int[] this.was.Deobfuscated.FontFamily' on a null object reference"), " 'int[] this.was.Deobfuscated.mFontFamily' on a null object reference"),
"java.lang.VerifyError: this.was.Deobfuscated", 'java.lang.VerifyError: this.was.Deobfuscated',
('java.lang.NoSuchFieldError: No instance field mFontFamily of type '
'Ljava/lang/Class; in class Lthis/was/Deobfuscated;'),
"NOTFOO: Object of type this.was.Deobfuscated was not destroyed...",
] ]
TEST_DATA = [s + "\n" for s in TEST_DATA] TEST_DATA = [s + "\n" for s in TEST_DATA]
EXPECTED_OUTPUT = [s + "\n" for s in EXPECTED_OUTPUT] EXPECTED_OUTPUT = [s + "\n" for s in EXPECTED_OUTPUT]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment