Revert "Make java_deobfuscate not require being built first"
This reverts commit 962e70305e
.
Reason for revert: Failing on swarming
https://ci.chromium.org/p/chromium/builders/ci/android-pie-x86-fyi-rel/747
Original change's description:
> Make java_deobfuscate not require being built first
>
> Makes the tool easier to use, and easier to document how to use by not
> requiring it to be built first. We have only a single non-prebuilt .java
> file, so it's easy enough to just check in the .class file for it.
>
> Bug: 995290
> Change-Id: I7b934b3337eccb044a470dd92270ce7338b1fd20
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106257
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Sam Maier <smaier@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#750855}
TBR=agrieve@chromium.org,smaier@chromium.org
Change-Id: Ic279958503760f08a5a4885391705a89db8f982f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 995290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107680
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751026}
This commit is contained in:

committed by
Commit Bot

parent
8e0d54a73c
commit
0b8c0e6a09
@ -1460,7 +1460,12 @@ To disable filtering, (but keep coloring), use --verbose.
|
||||
def Run(self):
|
||||
deobfuscate = None
|
||||
if self.args.proguard_mapping_path and not self.args.no_deobfuscate:
|
||||
deobfuscate = deobfuscator.Deobfuscator(self.args.proguard_mapping_path)
|
||||
try:
|
||||
deobfuscate = deobfuscator.Deobfuscator(self.args.proguard_mapping_path)
|
||||
except OSError:
|
||||
sys.stderr.write('Error executing "bin/java_deobfuscate". '
|
||||
'Did you forget to build it?\n')
|
||||
sys.exit(1)
|
||||
|
||||
stack_script_context = _StackScriptContext(
|
||||
self.args.output_directory,
|
||||
|
@ -82,7 +82,7 @@ There are two main methods for deobfuscating Java stack traces locally:
|
||||
* `$OUT/bin/chrome_public_apk run` # Launch chrome and run adb logcat
|
||||
|
||||
2. Using `java_deobfuscate`
|
||||
* build/android/stacktrace/java_deobfuscate.py $OUT/apks/ChromePublic.apk.mapping < logcat.txt`
|
||||
* `$OUT/bin/java_deobfuscate $OUT/apks/ChromePublic.apk.mapping < logcat.txt`
|
||||
* ProGuard mapping files are located beside APKs (ex.
|
||||
`$OUT/apks/ChromePublic.apk` and `$OUT/apks/ChromePublic.apk.mapping`)
|
||||
|
||||
|
@ -20,8 +20,8 @@ _PROCESS_START_TIMEOUT = 10.0
|
||||
|
||||
class Deobfuscator(object):
|
||||
def __init__(self, mapping_path):
|
||||
script_path = os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android',
|
||||
'stacktrace', 'java_deobfuscate.py')
|
||||
script_path = os.path.join(
|
||||
constants.GetOutDirectory(), 'bin', 'java_deobfuscate')
|
||||
cmd = [script_path, mapping_path]
|
||||
# Allow only one thread to call TransformLines() at a time.
|
||||
self._lock = threading.Lock()
|
||||
@ -134,7 +134,7 @@ class Deobfuscator(object):
|
||||
|
||||
class DeobfuscatorPool(object):
|
||||
# As of Sep 2017, each instance requires about 500MB of RAM, as measured by:
|
||||
# /usr/bin/time -v build/android/stacktrace/java_deobfuscate.py \
|
||||
# /usr/bin/time -v out/Release/bin/java_deobfuscate \
|
||||
# out/Release/apks/ChromePublic.apk.mapping
|
||||
def __init__(self, mapping_path, pool_size=4):
|
||||
self._mapping_path = mapping_path
|
||||
|
@ -8,11 +8,8 @@ java_binary("java_deobfuscate") {
|
||||
main_class = "org.chromium.build.FlushingReTrace"
|
||||
sources = [ "java/org/chromium/build/FlushingReTrace.java" ]
|
||||
deps = [ "//third_party/proguard:retrace_java" ]
|
||||
|
||||
# Use the checked-in copy of the wrapper script & .jar rather than the built
|
||||
# one to simplify usage of the tool.
|
||||
data = [
|
||||
"java_deobfuscate.py",
|
||||
"java_deobfuscate.jar",
|
||||
"$root_build_dir/lib.java/build/android/stacktrace/java_deobfuscate.jar",
|
||||
"$root_build_dir/bin/java_deobfuscate",
|
||||
]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# java_deobfuscate.py
|
||||
# java_deobfuscate
|
||||
|
||||
A wrapper around ProGuard's ReTrace tool, which:
|
||||
|
||||
@ -7,16 +7,11 @@ A wrapper around ProGuard's ReTrace tool, which:
|
||||
|
||||
The second point here is what allows you to run:
|
||||
|
||||
adb logcat | build/android/stacktrace/java_deobfuscate.py out/Default/apks/ChromePublic.apk.mapping
|
||||
adb logcat | out/Default/bin/java_deobfuscate out/Default/apks/ChromePublic.apk.mapping
|
||||
|
||||
And have it actually show output without logcat terminating.
|
||||
|
||||
|
||||
## Update Instructions:
|
||||
|
||||
ninja -C out/Release java_deobfuscate
|
||||
cp out/Release/lib.java/build/android/stacktrace/java_deobfuscate.jar build/android/stacktrace
|
||||
|
||||
# stackwalker.py
|
||||
|
||||
Extracts Breakpad microdumps from a log file and uses `stackwalker` to symbolize
|
||||
|
Binary file not shown.
@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
"""Wrapper script for java_deobfuscate.
|
||||
|
||||
This is also a buildable target, but having it pre-built here simplifies usage.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
DIR_SOURCE_ROOT = os.path.normpath(
|
||||
os.path.join(os.path.dirname(__file__), '../../../'))
|
||||
|
||||
|
||||
def main():
|
||||
classpath = [
|
||||
os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'stacktrace',
|
||||
'java_deobfuscate.jar'),
|
||||
os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard', 'lib',
|
||||
'proguard603.jar'),
|
||||
os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard', 'lib',
|
||||
'retrace603.jar'),
|
||||
]
|
||||
java_path = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'jdk', 'current',
|
||||
'bin', 'java')
|
||||
|
||||
cmd = [
|
||||
java_path, '-classpath', ':'.join(classpath),
|
||||
'org.chromium.build.FlushingReTrace'
|
||||
]
|
||||
cmd.extend(sys.argv[1:])
|
||||
os.execvp(cmd[0], cmd)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -222,13 +222,19 @@ file as follows:
|
||||
**Googlers Only**: For official build mapping files, see
|
||||
[go/chromejavadeobfuscation](https://goto.google.com/chromejavadeobfuscation).
|
||||
|
||||
Once you have a .mapping file:
|
||||
Once you have a .mapping file, build the `java_deobfuscate` tool:
|
||||
|
||||
```shell
|
||||
ninja -C out/Default java_deobfuscate
|
||||
```
|
||||
|
||||
Then run it via:
|
||||
|
||||
```shell
|
||||
# For a file:
|
||||
build/android/stacktrace/java_deobfuscate.py PROGUARD_MAPPING_FILE.mapping < FILE
|
||||
out/Default/bin/java_deobfuscate PROGUARD_MAPPING_FILE.mapping < FILE
|
||||
# For logcat:
|
||||
adb logcat | build/android/stacktrace/java_deobfuscate.py PROGUARD_MAPPING_FILE.mapping
|
||||
adb logcat | out/Default/bin/java_deobfuscate PROGUARD_MAPPING_FILE.mapping
|
||||
```
|
||||
|
||||
## Get WebKit code to output to the adb log
|
||||
|
@ -265,7 +265,7 @@ out/Debug/bin/run_content_shell_test_apk --wait-for-java-debugger
|
||||
If running with `is_debug=false`, Java stacks from logcat need to be fixed up:
|
||||
|
||||
```shell
|
||||
build/android/stacktrace/java_deobfuscate.py out/Release/apks/ChromePublicTest.apk.mapping < stacktrace.txt
|
||||
out/Release/bin/java_deobfuscate out/Release/apks/ChromePublicTest.apk.mapping < stacktrace.txt
|
||||
```
|
||||
|
||||
Any stacks produced by test runner output will already be deobfuscated.
|
||||
|
Reference in New Issue
Block a user