From 548db6644688660e14893cb4201466665d71bc1a Mon Sep 17 00:00:00 2001 From: felixzhou Date: Fri, 5 Jul 2019 19:58:44 +0800 Subject: [PATCH] Dev (#269) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * sample-android add removeUnusedResources * Dev apple (#155) (#158) * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md Dev apple (#156) * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md * change matrix-apple to matrix-iOS * update notice remove matrix-apple & sample-apple remove matrix-apple & sample-apple * update sample project (#160) * fix memory leak * Replace OSSpinLock with pthread_mutex_lock * [resource-canary] fix potential invalid class exception. * [resource-canary] fix potential invalid class exception. (#175) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * sample-android add removeUnusedResources * [resource-canary] fix potential invalid class exception. * fixed some small errors * Replace macro APP_NAME APP_BUNDLE with helper function * Rename bundleNameHelper with bundle_name_helper * Feature/dev (#186) * Hotfix/0.4.x (#133) (#134) * add stack parser * fix UnusedResourcesTask const resource id * fix UnusedResourcesTask const resource id * modify methodbeat & framebeat * optimize the TracePlugin * optimize the TracePlugin * backup codes for modify TraceDataUtils * fix tracedatautil * fix TraceDataUtils bug * fix UIThreadMonitor onStop * add memory share info * fix async start traceplugin * fix async start traceplugin * modify UIThreadMonitor /ActivityThreadHacker * fix onWindowfocuschange * finish opt * finish opt * update version * fix trim stack crash * fix trim stack crash * update 0.4.10.21 * update 0.4.10.21 * Dev (#142) * Hotfix/0.4.x (#140) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * Hotfix/0.4.x (#141) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * update version * fix getVmSize bug * fix trim stack bug * fix updatetime bug * opt gradle-plugin * opt gradle-plugin * update matrix version for build opt * update matrix version for build opt * update matrix version for build opt * update matrix version for build opt * fix trace bug * fix trace bug * fix filter package bug * fix monkey crash * fix throw runtime exception * fix throw runtime exception * fix bug * fix npe * fix setMessagePrinter * fix AppMethodBeat status * update version * fix bug * fix addlistener bug * fix anr without report stack key * fix bug * fix bug * try catch oom * fix bug * fix mi max 2 looper printer bug * fix bug * stop detecting task if there's no any recorded destroyed activity or we've been switched to background. * fix crash:http://mmtest.oa.com/androidcrashfile/crashfileview.php\?raw_path\=20190407_0x27000413_2450978833_1_32833013 * fix stack key bug * remoce log * add anr listener * add log * add anrlistener * remove useless code * remove useless codes * remove todo * Hotfix/0.4.x => dev (#188) * merge to hotfix/0.4.x from dev (#187) * Dev (#135) * add feature: battery , thread and meminfo sqlitelint remove abi x86_64 and arm64-v8a first * fix MethodTracer trace exception * fix FrameTracer doFrame bug * Update 开源公告.md * Temporarily use private repo instead of jcenter * fix formatter * typo * fix: translation error * Update issue_template.md * add armeabi-v7a x86 * add armeabi-v7a,x86 * bugfix(memory leak): 关于elfhook_close问题 #18 * bugfix: APK Checker 运行异常,提示无法删除 classes2.dex #13 * Update README.md * protect rule * change apk-canary from 0.4.7 to 0.4.10 * APK checker, fix bug In the windows environment * add arm64-v8a, x86_64 * style check and generate sourcejar * fix FindNonAlphaPngTask NullPointerException * fix UnStrippedSoCheckTask close file * remove unsupport abi x86_64 and arm_v8a yet * add codecc build config * add codecc build config * version code update to 0.4.10 * fix conflict * Bugfix: SqliteLint Support "arm64-v8a", "x86_64”. issue#50 * fix readme format * add circleci * fix indent * fix repo * add pwd * switch base image * add permission * fix path * switch image * fix directory * add missing dependency * fix dep * fix typo * update api level * shutdownNow * UnusedResourcesTask find resource cycle * add log-level * fix log * try to fix issue #33 * fix UnusedResourcesTask array data resource * bugfix: codecc check * update codecc * Hotfix/0.4.x (#75) * shutdownNow * UnusedResourcesTask find resource cycle * add log-level * fix log * try to fix issue #33 * fix UnusedResourcesTask array data resource * [resource-canary] fix bugs found by codecc. * Bugfix: wrong config key * Squashed commit of the following: commit f3cb6f22f0abea7db6ca15dcfee3a6750ad12883 Author: felixzhou Date: Thu Jan 10 15:32:27 2019 +0800 Bugfix: wrong config key commit 538d36c2edd1458e51ae943eae0846883616a69c Author: jqctop1 Date: Wed Jan 9 10:50:41 2019 +0800 Hotfix/0.4.x (#75) * shutdownNow * UnusedResourcesTask find resource cycle * add log-level * fix log * try to fix issue #33 * fix UnusedResourcesTask array data resource commit 7299f8d15059f6a0ae923669eea52d69846103d3 Author: felixzhou Date: Wed Jan 9 10:45:39 2019 +0800 update codecc commit 6f5ad088ed70f3317b677e2b386302f37d45f82c Author: felixzhou Date: Tue Jan 8 21:53:18 2019 +0800 bugfix: codecc check commit d6e7ed2314cf8e4a1a2e4a5ccfa1137fb28ae111 Author: felixzhou Date: Mon Jan 7 21:02:44 2019 +0800 update api level commit 7bb9743ce4b7c216e8362a7044cd99fde875ac7b Merge: 6085c25 e9ca978 Author: felixzhou Date: Fri Jan 4 19:11:31 2019 +0800 Merge pull request #65 from gengjiawen/feature/ci add CI commit e9ca97858d0b996777ccb2e227b31f42287c31c9 Author: gengjiawen Date: Thu Jan 3 20:39:36 2019 +0800 fix typo commit 87e461225a93a91a36dc7ad9fadfa6f9ada43255 Author: gengjiawen Date: Thu Jan 3 20:34:37 2019 +0800 fix dep commit 176ecd27352fd41e1b42a440075f86f93f0d3811 Author: gengjiawen Date: Thu Jan 3 20:30:24 2019 +0800 add missing dependency commit b71995bf7b3d2740c667c596a7a2ff72fd4e07e8 Author: gengjiawen Date: Thu Jan 3 20:16:50 2019 +0800 fix directory commit 7edcfc27632b6100c45099ddb4428c59ad51e100 Author: gengjiawen Date: Thu Jan 3 20:10:29 2019 +0800 switch image commit 119ff4cfd5e5cf1e4cb553e506ea6ae116b9b6d1 Author: gengjiawen Date: Wed Jan 2 23:17:02 2019 +0800 fix path commit 772850f4eefb44769169837725824e38db8353b2 Author: gengjiawen Date: Wed Jan 2 23:11:41 2019 +0800 add permission commit 7b16a75001e83603186869577cecb850bd787c7b Author: gengjiawen Date: Wed Jan 2 23:11:16 2019 +0800 switch base image commit de35ba33ec5f308e22263e9b16cd8393dd241a2e Author: gengjiawen Date: Wed Jan 2 23:09:07 2019 +0800 add pwd commit 7ab8e631495ab5fdac89d31f0bd7c52a257c7f30 Author: gengjiawen Date: Wed Jan 2 23:06:32 2019 +0800 fix repo commit 7ccb407fce213a166a8f08b45d107f6dfda7150c Author: gengjiawen Date: Wed Jan 2 23:04:09 2019 +0800 fix indent commit 023b95737948a43471190fe18c6b0293fcf60b18 Author: gengjiawen Date: Wed Jan 2 23:01:30 2019 +0800 add circleci commit 6085c25e3bcabe17f7d9f3d1a5b33210592fd280 Merge: 30c0f45 f048485 Author: felixzhou Date: Thu Jan 3 20:47:25 2019 +0800 Merge pull request #64 from Tencent/hotfix/0.4.x Hotfix/0.4.x commit f0484853f97e623b8d8cbb86607c1a1fa506e859 Merge: 9e04207 30c0f45 Author: felixzhou Date: Thu Jan 3 20:38:24 2019 +0800 Merge branch 'dev' into hotfix/0.4.x # Conflicts: # README.md commit 9e04207d1938d109392be0032575b51eade5ceda Author: jixin.jia Date: Thu Jan 3 16:33:26 2019 +0800 fix readme format commit 267d654928845d2ee53b952d8482d509d438bd41 Author: felixzhou Date: Wed Jan 2 17:27:50 2019 +0800 Bugfix: SqliteLint Support "arm64-v8a", "x86_64”. issue#50 commit 073e3d430e6814012de5791a9f37344b70ec459e Author: felixzhou Date: Wed Jan 2 10:57:01 2019 +0800 fix conflict commit 5b58cd81f2ce8141721088c4efb81b4135f57792 Author: felixzhou Date: Wed Jan 2 10:50:22 2019 +0800 version code update to 0.4.10 commit 9ab2c2dd6b2a20b2b8979ce104e2ba1ee9f5439c Author: felixzhou Date: Sat Dec 29 15:33:37 2018 +0800 add codecc build config commit 317154393379c4ae7b8baa7622690f475bffa1ce Author: felixzhou Date: Sat Dec 29 15:40:26 2018 +0800 add codecc build config commit 38a7e6a40606242e31714a2a3c142cf3a7cd9dfb Author: felixzhou Date: Sat Dec 29 14:40:37 2018 +0800 remove unsupport abi x86_64 and arm_v8a yet commit f07ab3a785ed9e65459e8bd0e0c1c8cc875b6c2f Author: williamjin Date: Sat Dec 29 13:27:54 2018 +0800 fix UnStrippedSoCheckTask close file commit 951df4711c1fd8038ce5f0810dd7cd462e8859dd Author: williamjin Date: Sat Dec 29 13:26:22 2018 +0800 fix FindNonAlphaPngTask NullPointerException commit 36afa0a663c1ae19e7dbf9153f2d2ec9b0c34ccc Author: felixzhou Date: Fri Dec 28 21:18:32 2018 +0800 style check and generate sourcejar commit 5261b753355d63de69f7b6f68508ecee57c51a81 Author: hamberluo Date: Thu Dec 27 10:09:53 2018 +0800 add arm64-v8a, x86_64 commit efe3a99b5458e98f5b05a1fe6746590d58a77c95 Author: felixzhou Date: Wed Dec 26 20:44:26 2018 +0800 APK checker, fix bug In the windows environment commit 6c189966aff534b0689a002523d89b6cc905fe40 Author: felixzhou Date: Wed Dec 26 20:39:03 2018 +0800 change apk-canary from 0.4.7 to 0.4.10 commit ac52f81d7c0c2b6fa6f1cfd340d298d94dfa192d Author: felixzhou Date: Wed Dec 26 19:16:55 2018 +0800 protect rule commit b52d8d53b240b89228aaed493d215eafc154eb96 Author: astrozhou Date: Wed Dec 26 19:14:38 2018 +0800 Update README.md commit cd144ffc187a2addf4409e05ff8a77c6b4ad1776 Author: felixzhou Date: Wed Dec 26 18:01:28 2018 +0800 bugfix: APK Checker 运行异常,提示无法删除 classes2.dex #13 commit f1eb5f5ee3f1e91d434fdc196f114633a38225cf Author: felixzhou Date: Wed Dec 26 16:54:56 2018 +0800 bugfix(memory leak): 关于elfhook_close问题 #18 commit 3a3a1b29536acd11455f13bce4be8044bca77baf Author: astrozhou Date: Tue Dec 25 19:45:30 2018 +0800 add armeabi-v7a,x86 commit 60f49bb3a6889744c54055e7ce1497ced2ab613d Author: astrozhou Date: Tue Dec 25 19:10:15 2018 +0800 add armeabi-v7a x86 commit b100fc4f2296057c36e82d51827e940f488631f7 Author: felixzhou Date: Tue Dec 25 17:27:00 2018 +0800 Update issue_template.md commit 798b5ff414f7e9898fd9a86731d2d791e5f7b8c7 Author: felixzhou Date: Tue Dec 25 17:19:06 2018 +0800 fix: translation error commit 12176131f42c19c7c6c0c2804ba1a65d8774ffce Author: guoling Date: Tue Dec 25 17:07:47 2018 +0800 typo commit 36c5b0b1cb76ee50a3be1c4e6d5d234ff251534d Author: astrozhou Date: Tue Dec 25 16:26:38 2018 +0800 fix formatter commit 149089361f2c1edf38abfba62c5107146cceea0a Author: felixzhou Date: Tue Dec 25 15:13:30 2018 +0800 Temporarily use private repo instead of jcenter commit 822fa932d77cb4c620783cb7de645c8e468cb69e Author: felixzhou Date: Tue Dec 25 11:43:56 2018 +0800 Update 开源公告.md commit 0d0fbf3cb3e2de132f051281f307c09b44979b71 Author: changelcai Date: Thu Jan 3 18:39:53 2019 +0800 fix FrameTracer doFrame bug commit 0f7a32773ae0ac02b836bd9be7bb6f7f468eb7fb Author: changelcai Date: Thu Jan 3 18:40:16 2019 +0800 fix MethodTracer trace exception commit 30c0f451edf27cc88ea5e5eb9f8f92804b2818f8 Merge: d834a83 fb92c82 Author: astrozhou Date: Thu Jan 3 17:09:55 2019 +0800 Merge pull request #54 from jasonross/dev fix readme format commit fb92c8233c51dce12b4ea39111a0a3835cfa567e Author: jixin.jia Date: Thu Jan 3 16:33:26 2019 +0800 fix readme format commit d834a83154c0341b9752efd02c4f8e0874fe9811 Author: felixzhou Date: Wed Jan 2 17:27:50 2019 +0800 Bugfix: SqliteLint Support "arm64-v8a", "x86_64”. issue#50 commit 43b43ff5f8ffad95a0015328fcb96a0d9e6404b1 Author: felixzhou Date: Wed Jan 2 10:57:01 2019 +0800 fix conflict commit 83d5a54a0fa54e546630fc2803d35ae5636c9839 Author: felixzhou Date: Wed Jan 2 10:50:22 2019 +0800 version code update to 0.4.10 commit 00a780a5d8f9172a2337677a549cd29245af724f Author: felixzhou Date: Sat Dec 29 15:33:37 2018 +0800 add codecc build config commit 16f33dad7a0740ff600b08a2dc05896ad564d4a1 Merge: 516e5dc 21bfba1 Author: felixzhou Date: Wed Jan 2 10:46:11 2019 +0800 Merge pull request #48 from Tencent/dev Dev commit 21bfba14eda0e52ab2661889a0fcc7a648746948 Merge: a93b95b 516e5dc Author: felixzhou Date: Wed Jan 2 10:45:51 2019 +0800 Merge branch 'master' into dev commit a93b95bc410b0af047256569d23418085cc06518 Author: felixzhou Date: Sat Dec 29 15:40:26 2018 +0800 add codecc build config commit e1c0442c3a48e9fdb08dda8fbbc4784dab23efc6 Author: felixzhou Date: Sat Dec 29 14:40:37 2018 +0800 remove unsupport abi x86_64 and arm_v8a yet commit 516e5dc205c852572105978ebc3b7a88163ca9b1 Merge: 5d51c87 7b2095e Author: felixzhou Date: Sat Dec 29 14:12:26 2018 +0800 Merge pull request #43 from jqctop1/dev_jqctop1 [bugfix] ApkChecker commit 7b2095e3c16e81b2e2fb2e63b42c0ae9c68b52c6 Author: williamjin Date: Sat Dec 29 13:27:54 2018 +0800 fix UnStrippedSoCheckTask close file commit f8ebb65f8919b65d2e302e67657501dea3851c6e Author: williamjin Date: Sat Dec 29 13:26:22 2018 +0800 fix FindNonAlphaPngTask NullPointerException commit 5d51c87d1cf7522ffc008c1803f262c636f2041c Author: felixzhou Date: Wed Dec 26 20:44:26 2018 +0800 APK checker, fix bug In the windows environment commit c9a04e103a1679883d2b13e5d45917cb1e6e46d6 Author: felixzhou Date: Wed Dec 26 20:39:03 2018 +0800 change apk-canary from 0.4.7 to 0.4.10 commit d1ef28c6a57522f6a8f9c1e90065dfa60513804a Author: astrozhou Date: Wed Dec 26 19:14:38 2018 +0800 Update README.md commit 7eaf1da5b55f244eec5696fc2e092f8d680d0c27 Author: felixzhou Date: Tue Dec 25 17:27:00 2018 +0800 Update issue_template.md commit 42b8fee50601df92a4b05ab061f6a74f17074fae Author: felixzhou Date: Tue Dec 25 17:19:06 2018 +0800 fix: translation error commit 1e4605036b5a5bd0d6c68d46e4f2c6a747fefead Author: astrozhou Date: Tue Dec 25 16:26:38 2018 +0800 fix formatter commit d9b0b33d7e67a523ae0e5da4c3502ddefa634338 Author: felixzhou Date: Tue Dec 25 15:13:30 2018 +0800 Temporarily use private repo instead of jcenter commit 5c26c221bd5cc34e2dea3bff03c81d9b5caa25c0 Author: felixzhou Date: Tue Dec 25 11:43:56 2018 +0800 Update 开源公告.md * remove abi: armeabi * fix UnusedAssetsTask * fix build.gradle * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 (#110) * use relative path * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * Hotfix/0.4.x (#119) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * bugfix: protect startService invocation in MatrixJobIntentService in case system throw an exception in some edge case. * fix SecurityException when startService in MatrixJobIntentService. (#120) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * bugfix: protect startService invocation in MatrixJobIntentService in case system throw an exception in some edge case. * adapt StartUpTracer for Android 9.0 * revert VERSION_NAME_PREFIX to 0.4.10 * Hotfix/0.4.x (#122) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * bugfix: protect startService invocation in MatrixJobIntentService in case system throw an exception in some edge case. * adapt StartUpTracer for Android 9.0 * revert VERSION_NAME_PREFIX to 0.4.10 * Dev (#123) * Update 开源公告.md * Temporarily use private repo instead of jcenter * fix formatter * fix: translation error * Update issue_template.md * Update README.md * change apk-canary from 0.4.7 to 0.4.10 * APK checker, fix bug In the windows environment * fix FindNonAlphaPngTask NullPointerException * fix UnStrippedSoCheckTask close file * remove unsupport abi x86_64 and arm_v8a yet * add codecc build config * add codecc build config * version code update to 0.4.10 * fix conflict * Bugfix: SqliteLint Support "arm64-v8a", "x86_64”. issue#50 * fix readme format * fix MethodTracer trace exception * fix FrameTracer doFrame bug * Update 开源公告.md * Temporarily use private repo instead of jcenter * fix formatter * typo * fix: translation error * Update issue_template.md * add armeabi-v7a x86 * add armeabi-v7a,x86 * bugfix(memory leak): 关于elfhook_close问题 #18 * bugfix: APK Checker 运行异常,提示无法删除 classes2.dex #13 * Update README.md * protect rule * change apk-canary from 0.4.7 to 0.4.10 * APK checker, fix bug In the windows environment * add arm64-v8a, x86_64 * style check and generate sourcejar * fix FindNonAlphaPngTask NullPointerException * fix UnStrippedSoCheckTask close file * remove unsupport abi x86_64 and arm_v8a yet * add codecc build config * add codecc build config * version code update to 0.4.10 * fix conflict * Bugfix: SqliteLint Support "arm64-v8a", "x86_64”. issue#50 * fix readme format * add circleci * fix indent * fix repo * add pwd * switch base image * add permission * fix path * switch image * fix directory * add missing dependency * fix dep * fix typo * update api level * shutdownNow * UnusedResourcesTask find resource cycle * add log-level * fix log * try to fix issue #33 * fix UnusedResourcesTask array data resource * bugfix: codecc check * update codecc * Hotfix/0.4.x (#75) * shutdownNow * UnusedResourcesTask find resource cycle * add log-level * fix log * try to fix issue #33 * fix UnusedResourcesTask array data resource * [resource-canary] fix bugs found by codecc. * Bugfix: wrong config key * fix UnusedAssetsTask * fix build.gradle * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 (#110) * use relative path * Hotfix/0.4.x (#119) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * fix SecurityException when startService in MatrixJobIntentService. (#120) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * bugfix: protect startService invocation in MatrixJobIntentService in case system throw an exception in some edge case. * Hotfix/0.4.x (#122) * [IOCanary][bug-fix]CloseGuardHooker.tryHook没有适配9.0 #86 * fix FrameTracer doFrame bug # Conflicts: # matrix/matrix-android/matrix-trace-canary/src/main/java/com/tencent/matrix/trace/tracer/FrameTracer.java * fix MethodTracer trace exception * bugfix: protect startService invocation in MatrixJobIntentService in case system throw an exception in some edge case. * adapt StartUpTracer for Android 9.0 * revert VERSION_NAME_PREFIX to 0.4.10 * no need file: HackCallback.java * fix UnusedResourcesTask const resource id * Hotfix/0.4.x (#133) * add stack parser * fix UnusedResourcesTask const resource id * fix UnusedResourcesTask const resource id * style check * Hotfix/0.4.x (#141) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * Hotfix/0.4.x (#151) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * Dev (#152) * Hotfix/0.4.x (#139) * fix trimstack stackover bug * fix trimstack stackover bug * Hotfix/0.4.x (#140) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * Hotfix/0.4.x (#141) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * Hotfix/0.4.x (#151) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * Dev apple (#154) * Hotfix/0.4.x (#139) * fix trimstack stackover bug * fix trimstack stackover bug * Hotfix/0.4.x (#140) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * Hotfix/0.4.x (#141) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * Hotfix/0.4.x (#151) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md * Dev apple (#155) * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md * Dev apple (#155) (#158) * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md Dev apple (#156) * update readme * feat(matrix-apple): source code & sample * update podspec * Update README.md * Update README.md * Update README.md * rename(PodSpec): matrix-apple -> matrix-wechat * update(sample): matrix-apple -> matrix-wechat * update readme.md * change matrix-apple to matrix-iOS * update notice remove matrix-apple & sample-apple remove matrix-apple & sample-apple * update sample project (#160) * fix memory leak * Replace OSSpinLock with pthread_mutex_lock * [resource-canary] fix potential invalid class exception. (#175) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * java.lang.ArithmeticException: divide by zero * sample-android add removeUnusedResources * [resource-canary] fix potential invalid class exception. * fixed some small errors * Replace macro APP_NAME APP_BUNDLE with helper function * Rename bundleNameHelper with bundle_name_helper * Feature/dev (#186) * Hotfix/0.4.x (#133) (#134) * add stack parser * fix UnusedResourcesTask const resource id * fix UnusedResourcesTask const resource id * modify methodbeat & framebeat * optimize the TracePlugin * optimize the TracePlugin * backup codes for modify TraceDataUtils * fix tracedatautil * fix TraceDataUtils bug * fix UIThreadMonitor onStop * add memory share info * fix async start traceplugin * fix async start traceplugin * modify UIThreadMonitor /ActivityThreadHacker * fix onWindowfocuschange * finish opt * finish opt * update version * fix trim stack crash * fix trim stack crash * update 0.4.10.21 * update 0.4.10.21 * Dev (#142) * Hotfix/0.4.x (#140) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * Hotfix/0.4.x (#141) * fix trimstack stackover bug * fix trimstack stackover bug * fix trimstack crash and methodbeat * fix trim stack crash * update version * fix getVmSize bug * fix trim stack bug * fix updatetime bug * opt gradle-plugin * opt gradle-plugin * update matrix version for build opt * update matrix version for build opt * update matrix version for build opt * update matrix version for build opt * fix trace bug * fix trace bug * fix filter package bug * fix monkey crash * fix throw runtime exception * fix throw runtime exception * fix bug * fix npe * fix setMessagePrinter * fix AppMethodBeat status * update version * fix bug * fix addlistener bug * fix anr without report stack key * fix bug * fix bug * try catch oom * fix bug * fix mi max 2 looper printer bug * fix bug * stop detecting task if there's no any recorded destroyed activity or we've been switched to background. * fix crash:http://mmtest.oa.com/androidcrashfile/crashfileview.php\?raw_path\=20190407_0x27000413_2450978833_1_32833013 * fix stack key bug * remoce log * add anr listener * add log * add anrlistener * remove useless code * remove useless codes * remove todo * upgrade version to 0.5.1 * fix trace build bug (#199) * Hotfix/0.5.x (#200) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * Hotfix/0.5.x to dev (#207) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * Hotfix/0.5.x (#226) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * Dev (#208) * fix trace build bug (#199) * Hotfix/0.5.x (#200) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * Hotfix/0.5.x to dev (#207) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * fix(MemStat): USE_PRIVATE_API access nil pointer * fix(MemStat): do not “update_object_event” for g_matrix_block_monitor_dumping_thread_id * fix(MemStat): do not log the oc’event of dumping thread * fix(CrashBlock): free g_topStackAddressRepeatArray * gzip冲突修复 (#224) (#231) * 重命名GZIP文件,和cocoapods中其他GZIP pod冲突了 * 修改master的podspec,文件路径变化了 * fix(AppReboot): app_uuid() crash (#234) * gzip冲突修复 (#224) * 重命名GZIP文件,和cocoapods中其他GZIP pod冲突了 * 修改master的podspec,文件路径变化了 * fix(AppReboot): app_uuid() crash * Hotfix/0.5.x (#240) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * Dev (#208) * fix trace build bug (#199) * Hotfix/0.5.x (#200) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * Hotfix/0.5.x to dev (#207) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * fix(MemStat): USE_PRIVATE_API access nil pointer * fix(MemStat): do not “update_object_event” for g_matrix_block_monitor_dumping_thread_id * fix(MemStat): do not log the oc’event of dumping thread * fix(CrashBlock): free g_topStackAddressRepeatArray * [SQLiteLint]fix 一些不好的、潜在sql注入风险的代码 * [SQLiteLint]sample默认采取Hook模式,fix之前没有进行sql分析 * [SQLiteLint]去除sample中无用的代码 * fix TraceConfig#getSplashActivities method's NullPointException on Android. fix #238 (#239) * Fix syscall 0xf0002 is blocked by seccomp filter in android o/p armv8-64 so (#230) * Hotfix/0.5.x (#266) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * Dev (#208) * fix trace build bug (#199) * Hotfix/0.5.x (#200) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * Hotfix/0.5.x to dev (#207) * fix trace build bug * fix CheckedDatabaseListActivity 兼容性crash * try catch OutOfMemoryError * fix npe * fix permission crash * 1. style check 2. upload 0.5.2 to jcenter 3. add ‘armeabi’ back to abiFilters * fix(MemStat): USE_PRIVATE_API access nil pointer * fix(MemStat): do not “update_object_event” for g_matrix_block_monitor_dumping_thread_id * fix(MemStat): do not log the oc’event of dumping thread * fix(CrashBlock): free g_topStackAddressRepeatArray * [SQLiteLint]fix 一些不好的、潜在sql注入风险的代码 * [SQLiteLint]sample默认采取Hook模式,fix之前没有进行sql分析 * [SQLiteLint]去除sample中无用的代码 * Do not modify R.txt * 0.5.1 => 0.5.2 * not support abi: armeabi * docs(Script): add script to fomate KS’ json report --- README.md | 16 +- .../task/RemoveUnusedResourcesTask.groovy | 4 +- matrix/matrix-iOS/Script/ks2apple.py | 844 ++++++++++++++++++ .../tencent/matrix/MatrixApplication.java | 5 - 4 files changed, 855 insertions(+), 14 deletions(-) create mode 100644 matrix/matrix-iOS/Script/ks2apple.py diff --git a/README.md b/README.md index ef8c1e621..85acb5cae 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![Matrix-icon](assets/img/readme/header.png) -[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/matrix/blob/master/LICENSE)[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/matrix/pulls)[![WeChat Approved](https://img.shields.io/badge/Wechat%20Approved-0.5.1-red.svg)](https://github.com/Tencent/matrix/wiki) +[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/matrix/blob/master/LICENSE)[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/matrix/pulls)[![WeChat Approved](https://img.shields.io/badge/Wechat%20Approved-0.5.2-red.svg)](https://github.com/Tencent/matrix/wiki) (中文版本请参看[这里](#matrix_cn)) @@ -172,7 +172,7 @@ At this point, Matrix has been integrated into the app and is beginning to colle 1. Configure `MATRIX_VERSION` in gradle.properties. ``` gradle - MATRIX_VERSION=0.5.1 + MATRIX_VERSION=0.5.2 ``` 2. Add `matrix-gradle-plugin` in your build.gradle: @@ -289,11 +289,11 @@ You can get more about Matrix output at the wiki [The output of Matrix](https:// #### APK Checker Usage -APK Checker can run independently in Jar ([matrix-apk-canary-0.5.1.jar](https://jcenter.bintray.com/com/tencent/matrix/matrix-apk-canary/0.5.1/matrix-apk-canary-0.5.1.jar)) mode, usage: +APK Checker can run independently in Jar ([matrix-apk-canary-0.5.2.jar](https://jcenter.bintray.com/com/tencent/matrix/matrix-apk-canary/0.5.2/matrix-apk-canary-0.5.2.jar)) mode, usage: ```shell -java -jar matrix-apk-canary-0.5.1.jar +java -jar matrix-apk-canary-0.5.2.jar Usages: --config CONFIG-FILE-PATH or @@ -352,7 +352,7 @@ Matrix is under the BSD license. See the [LICENSE](https://github.com/Tencent/Ma # Matrix ![Matrix-icon](assets/img/readme/header.png) -[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/matrix/blob/master/LICENSE)[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/matrix/pulls) [![WeChat Approved](https://img.shields.io/badge/Wechat%20Approved-0.5.1-red.svg)](https://github.com/Tencent/matrix/wiki) +[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/matrix/blob/master/LICENSE)[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/matrix/pulls) [![WeChat Approved](https://img.shields.io/badge/Wechat%20Approved-0.5.2-red.svg)](https://github.com/Tencent/matrix/wiki) **Matrix** 是一款微信团队研发并日常使用的应用性能接入框架,支持iOS, macOS和Android。 Matrix 通过接入各种性能监控方案,对性能监控项的异常数据进行采集和分析,输出相应的问题分析、定位与优化建议,从而帮助开发者开发出更高质量的应用。 @@ -510,7 +510,7 @@ Matrix-android 当前监控范围包括:应用安装包大小,帧率变化 1. 在你项目根目录下的 gradle.properties 中配置要依赖的 Matrix 版本号,如: ``` gradle - MATRIX_VERSION=0.5.1 + MATRIX_VERSION=0.5.2 ``` 2. 在你项目根目录下的 build.gradle 文件添加 Matrix 依赖,如: @@ -624,10 +624,10 @@ Matrix 分析后的输出字段的含义请查看 [Matrix 输出内容的含义 #### APK Checker -APK Check 以独立的 jar 包提供 ([matrix-apk-canary-0.5.1.jar](https://jcenter.bintray.com/com/tencent/matrix/matrix-apk-canary/0.5.1/matrix-apk-canary-0.5.1.jar)),你可以运行: +APK Check 以独立的 jar 包提供 ([matrix-apk-canary-0.5.2.jar](https://jcenter.bintray.com/com/tencent/matrix/matrix-apk-canary/0.5.2/matrix-apk-canary-0.5.2.jar)),你可以运行: ```cmd -java -jar matrix-apk-canary-0.5.1.jar +java -jar matrix-apk-canary-0.5.2.jar ``` 查看 Usages 来使用它。 diff --git a/matrix/matrix-android/matrix-gradle-plugin/src/main/groovy/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.groovy b/matrix/matrix-android/matrix-gradle-plugin/src/main/groovy/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.groovy index 2ad4f95f9..2845b6a44 100644 --- a/matrix/matrix-android/matrix-gradle-plugin/src/main/groovy/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.groovy +++ b/matrix/matrix-android/matrix-gradle-plugin/src/main/groovy/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.groovy @@ -237,7 +237,9 @@ public class RemoveUnusedResourcesTask extends DefaultTask { //Log.d(TAG, "styleable %s", styleableMap.keySet().size()); String newResTxtFile = resTxtFile.getParentFile().getAbsolutePath() + "/" + resTxtFile.getName().substring(0, resTxtFile.getName().indexOf('.')) + "_shrinked.txt"; shrinkResourceTxtFile(newResTxtFile, resourceMap, styleableMap); - new File(newResTxtFile).renameTo(resTxtFile); + + //Other plugins such as "Tinker" may depend on the R.txt file, so we should not modify R.txt directly . + //new File(newResTxtFile).renameTo(resTxtFile); } } finally { diff --git a/matrix/matrix-iOS/Script/ks2apple.py b/matrix/matrix-iOS/Script/ks2apple.py new file mode 100644 index 000000000..259c0462d --- /dev/null +++ b/matrix/matrix-iOS/Script/ks2apple.py @@ -0,0 +1,844 @@ +#!/usr/bin/env python2.7 +#-*- coding: utf-8 -*- +''' +@Author: mattzheng +@since: 2019-05-13 11:46:33 +@lastTime: 2019-07-01 18:06:08 +@LastAuthor: Do not edit +''' + + +import json +import os +import sys +import cgi +import optparse +import traceback +from datetime import datetime + + +reload(sys) +sys.setdefaultencoding('utf-8') + +device_map = { + 'iPod1,1' : 'iPod touch 1G', + 'iPod2,1' : 'iPod touch 2G', + 'iPod3,1' : 'iPod touch 3G', + 'iPod4,1' : 'iPod touch 4G', + 'iPod5,1' : 'iPod touch 5G', + + 'iPad2,5' : 'iPad mini 1G', + 'iPad2,6' : 'iPad mini 1G', + 'iPad2,7' : 'iPad mini 1G', + 'iPad4,4' : 'iPad mini 2G', + 'iPad4,5' : 'iPad mini 2G', + 'iPad4,6' : 'iPad mini 2G', + + 'iPad1,1' : 'iPad 1G', + 'iPad2,1' : 'iPad 2', + 'iPad2,2' : 'iPad 2', + 'iPad2,3' : 'iPad 2', + 'iPad2,4' : 'iPad 2', + 'iPad3,1' : 'iPad 3', + 'iPad3,2' : 'iPad 3', + 'iPad3,3' : 'iPad 3', + 'iPad3,4' : 'iPad 4', + 'iPad3,5' : 'iPad 4', + 'iPad3,6' : 'iPad 4', + 'iPad4,1' : 'iPad Air', + 'iPad4,2' : 'iPad Air', + 'iPad4,3' : 'iPad Air', + + + 'iPhone1,1' : 'iPhone', + 'iPhone1,2' : 'iPhone 3G', + 'iPhone2,1' : 'iPhone 3GS', + 'iPhone3,1' : 'iPhone 4', + 'iPhone3,2' : 'iPhone 4', + 'iPhone3,3' : 'iPhone 4', + 'iPhone4,1' : 'iPhone 4s', + 'iPhone5,1' : 'iPhone 5', + 'iPhone5,2' : 'iPhone 5', + 'iPhone5,3' : 'iPhone 5c', + 'iPhone5,4' : 'iPhone 5c', + 'iPhone6,1' : 'iPhone 5s', + 'iPhone6,2' : 'iPhone 5s', + + 'iPhone7,1' : 'iPhone 6 Plus', + 'iPhone7,2' : 'iPhone 6', + 'iPhone8,1' : 'iPhone 6s', + 'iPhone8,2' : 'iPhone 6s Plus', + 'iPhone8,4' : 'iPhone SE', + 'iPhone9,1' : 'iPhone 7', + 'iPhone9,3' : 'iPhone 7', + 'iPhone9,2' : 'iPhone 7 Plus', + 'iPhone9,4' : 'iPhone 7 Plus', + 'iPhone10,1' : 'iPhone 8', + 'iPhone10,4' : 'iPhone 8', + 'iPhone10,2' : 'iPhone 8 Plus', + 'iPhone10,5' : 'iPhone 8 Plus', + 'iPhone10,3' : 'iPhone X', + 'iPhone10,6' : 'iPhone X', + 'iPhone11,2' : 'iPhone XS', + 'iPhone11,4' : 'iPhone XS Max', + 'iPhone11,6' : 'iPhone XS Max', + 'iPhone11,8' : 'iPhone XR', +} + +def dump_json(obj): + return json.dumps(obj, indent=4, + sort_keys=True, separators=(',',': ')) + +def get_system_info(report): + '''Get system information from report''' + return report.get('system', None) + +def get_report_info(report): + '''Get report information from report''' + return report.get('report', None) + +def get_crash_info(report): + '''Get crash information from report''' + return report.get('crash', None) + +def get_cpu_type(arch): + return {'arm64': 'ARM-64', + 'arm': 'ARM', + 'x86': 'X86', + 'x86_64': 'X86_64'}.get(arch, 'Unknow') + +def get_cpu_arch(report): + system = get_system_info(report) + arch = system.get('cpu_arch', '') + return get_cpu_type(arch) + +def get_app_name(report): + system = get_system_info(report) + return system.get('CFBundleExecutable', 'unknown') + +def get_binary_img_info(report): + # key: name, value: uuid + img_info = {} + + images = report.get('binary_images', []) + for image in images: + name = os.path.basename(image["name"]) + uuid = image['uuid'].lower().replace('-', '') + + if name not in img_info: + img_info[str(name)] = str(uuid) + + return img_info + +def get_belong_img(report, addr): + images = report.get('binary_images', []) + for img in images: + if img['image_addr'] <= addr <= (img['image_addr'] + img['image_size']): + return img + + return None + +CPU_TYPE_ARM = 12 +CPU_ARCH_ABI64 = 0x01000000 +CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64 +CPU_TYPE_X86 = 7 +CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64 + +CPU_SUBTYPE_ARM_V6 = 6 +CPU_SUBTYPE_ARM_V7 = 9 +CPU_SUBTYPE_ARM_V7F = 10 +CPU_SUBTYPE_ARM_V7S = 11 +CPU_SUBTYPE_ARM_V7K = 12 +CPU_SUBTYPE_ARM_V6M = 14 +CPU_SUBTYPE_ARM_V7M = 15 +CPU_SUBTYPE_ARM_V7EM = 16 +CPU_SUBTYPE_ARM_V8 = 13 + +CPU_ARM_TYPES = { + CPU_SUBTYPE_ARM_V6: 'armv6', + CPU_SUBTYPE_ARM_V7: 'armv7', + CPU_SUBTYPE_ARM_V7F: 'armv7f', + CPU_SUBTYPE_ARM_V7S: 'armv7s', + CPU_SUBTYPE_ARM_V7K: 'armv7k', + CPU_SUBTYPE_ARM_V6M: 'armv6m', + CPU_SUBTYPE_ARM_V7M: 'armv7m', + CPU_SUBTYPE_ARM_V7EM: 'armv7em', + CPU_SUBTYPE_ARM_V8: 'armv8', +} + +def get_detail_cpu_arch(major, minor): + if major == CPU_TYPE_ARM: + return CPU_ARM_TYPES.get(minor, 'arm') + elif major == CPU_TYPE_ARM64: + return 'arm64' + elif major == CPU_TYPE_X86: + return 'i386' + elif major == CPU_TYPE_X86_64: + return 'x86_64' + + return 'unknown({0},{1})'.format(major, minor) + +def get_last_exception(report): + report_info = get_report_info(report) + process = report_info.get('process', None) + if not process: + return None + return process.get('last_dealloced_nsexception', None) + +def get_time(report): + '''Get crash time from report + @return time like "2015-12-28 17:48:03 +0800" + ''' + + info = get_report_info(report) + timestamp = info.get('timestamp', None) + if not timestamp: + return '' + + if type(timestamp) == type(0): + return datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S") + else: + return timestamp + + #from dateutil import parser, tz + #date = parser.parse(timestamp) + #return date.astimezone(tz.tzlocal())\ + # .strftime('%Y-%m-%d %H:%M:%S.000 %z') + +def get_crash_thread(report): + crash = get_crash_info(report) + if not crash: + return [] + #print crash + threads = crash['threads'] + for thread in threads: + crashed = thread.get('crashed', False) + if crashed: + return thread + + return crash.get('crashed_thread', None) + + +def parse_user_info(report): + user_info = report.get("user", None) + if not user_info: + return [] + + result = ['\nUser Info: {'] + if user_info and user_info.get(APP_NAME): + uin = user_info[APP_NAME].get("uin", None) + if uin: + result.append(show_color(' Uin: {0}'.format(uin))) + if user_info[APP_NAME].get("UsrName"): + result.append(' UsrName: {0}'.format(user_info[APP_NAME].get("UsrName"))) + if user_info[APP_NAME].get("heavyUser", -1) != -1: + result.append(' heavyUser: {0}'.format(user_info[APP_NAME].get("heavyUser"))) + if user_info[APP_NAME].get("heavyUserType", -1) != -1: + result.append(' heavyUserType: {0}'.format(user_info[APP_NAME].get("heavyUserType"))) + if user_info[APP_NAME].get("heavyPoint", -1) != -1: + result.append(' heavyPoint: {0}'.format(user_info[APP_NAME].get("heavyPoint"))) + if user_info[APP_NAME].get("DumpType", -1) != -1: + result.append(' dumpType: {0}'.format(user_info[APP_NAME].get("DumpType"))) + if user_info[APP_NAME].get("blockTime"): + result.append(' blockTime: {0}'.format(user_info[APP_NAME].get("blockTime"))) + if user_info[APP_NAME].get("LastScene"): + result.append(' LastScene: {0}'.format(user_info[APP_NAME].get("LastScene"))) + if user_info[APP_NAME].get("SecondLastScene"): + result.append(' SecondLastScene: {0}'.format(user_info[APP_NAME].get("SecondLastScene"))) + if user_info[APP_NAME].get("WeAppScene"): + result.append(' WeAppScene: {0}'.format(user_info[APP_NAME].get("WeAppScene"))) + if user_info[APP_NAME].get("ExistWeAppCount"): + result.append(' ExistWeAppCount: {0}'.format(user_info[APP_NAME].get("ExistWeAppCount"))) + if len(result) < 2: + result.append(json.dumps(user_info, indent=4)) + result.append('}') + return result + +def parse_system_info(report): + '''Parse system information from report. + @return header lines + ''' + + sys = get_system_info(report) + if not sys: + return [] + info = get_report_info(report) + + _s = lambda x: sys.get(x, '') + _i = lambda x: info.get(x, '') + + headers = ['System Info: {'] + device = _s('machine') + if device_map.has_key(device): + device = device_map[device] + headers.append(' Device: {0}'.format(device)) + headers.append(' OS Version: {0} {1} ({2})'.format(_s('system_name'), _s('system_version'), _s('os_version'))) + + user_info = report.get("user", None) + if user_info and user_info.get('WeChat'): + jb_info = user_info.get('WeChat').get('Jailbreak', None) + if jb_info: + headers.append(' Jailbreak: {0}'.format(jb_info)) + + mem = sys.get("memory") + if mem: + fmt = lambda x: " Mem {0:6}: {1:4} M".format(x, int(mem[x])/1024/1024) + headers.append(fmt("usable")) + headers.append(show_color(fmt("free"))) + headers.append(fmt("size")) + + headers.append('}') + return headers +def show_color(str,color='blue'): + return str + # return '%s'%(color,str) + +def zombie_exception(report): + crash = get_crash_info(report) + error = crash['error'] + mach = error['mach'] + exc_name = mach.get('exception_name', '0') + code_name = mach.get('code_name', '0x00000000') + + if exc_name != 'EXC_BAD_ACCESS' or code_name != 'KERN_INVALID_ADDRESS': + return False + + last_exception = get_last_exception(report) + if not last_exception: + return False + + last_addr = last_exception['address'] + thread = get_crash_thread(report) + registers = thread['registers']['basic'] + for reg, addr in registers: + if addr == last_addr: + return True + + return False + + +def parse_error_info(report): + crash = get_crash_info(report) + if not crash: + return [] + error = crash.get('error') + if not error: + print "waring: no error found in crash" + return [] + mach = error['mach'] + signal = error['signal'] + + exc_name = mach.get('exception_name', '0') + sig_name = signal.get('name', None) + if not sig_name: + sig_name = signal.get('signal', '') + + code_name = mach.get('code_name', '0x00000000') + addr = error.get('address', '0') + + crash_thread = 0 + thread = get_crash_thread(report) + if thread: + crash_thread = thread['index'] + + result = [''] + result.append('Exception Type: {0} ({1})'.format(exc_name, sig_name)) + result.append('Exception Codes: {0} at {1:016x}'.format(code_name, int(addr))) + result.append('Crashed Thread: {0}'.format(crash_thread)) + + diagnosis = crash.get('diagnosis', None) + #print "fuck haha", diagnosis + if diagnosis: + result.append('\nCrashDoctor Diagnosis: {0}'.format(diagnosis)) + #print result + return result + +def parse_crash_reason(report): + result = [''] + reason_fmt = ("Application Specific Information" + "*** Terminating app due to uncaught exception '{0}', " + "reason: '{1}'") + fmt = lambda x, y: reason_fmt.format(x, y) + + crash = get_crash_info(report) + if not crash: + return [] + + error = crash.get('error') + if not error: + print "warning: no error found in crash" + return [] + crash_type = error['type'] + + user_exception = error.get('user_reported', None) + ns_exception = error.get('nsexception', None) + if ns_exception: + result.append(fmt(ns_exception['name'], error.get('reason', ''))) + elif zombie_exception(report): + last_exception = get_last_exception(report) + if (last_exception): + result.append(fmt(last_exception['name'], last_exception['reason'])) + elif user_exception: + result.append(fmt(user_exception['name'], error['reason'])) + line = user_exception.get('line_of_code', None) + backtrace = user_exception.get('backtrace', []) + if line or backtrace: + result.append('Custom Backtrace:') + if line: + result.append('Line: {0}'.format(line)) + for entry in backtrace: + result.append(entry) + + elif crash_type == 'cpp_exception': + #cpp_exception = error['cppexception'] + cpp_exception = error.get('cppexception', None) + if cpp_exception and cpp_exception.get('name'): + result.append(fmt(cpp_exception['name'], error['reason'])) + elif crash_type == 'deadlock': + result.append('Application main thread deadlocked') + return result + +def parse_backtrace(report, backtrace): + num = 0 + result = [] + for trace in backtrace.get('contents', []): + try: + pc = trace['instruction_addr'] + except: + traceback.print_exc() + continue + + img = get_belong_img(report, pc) + if not img: + print "error, no img found for pc: %s" % pc + result.append('{0:<4}{1:31} 0x{2:016x}'.format(num, 'unknown', pc)) + num += 1 + continue + + # uuid = img['uuid'].lower().replace('-', '') + obj_addr = img['image_addr'] + offset = pc - obj_addr + obj_name = os.path.basename(img['name']) + + symbol_name = trace.get('symbol_name', None) + # symbol_addr = trace.get('symbol_addr', 0) + + preamble = '{0:<4}{1:31} 0x{2:016x}'.format(num, obj_name, pc) + unsymbolicated = '0x{0:04x} + {1}'.format(obj_addr, offset) + symbolicated = '(null)' + is_unsymbolicated = False + if symbol_name: + symbolicated = '{0}'.format(symbol_name) + #symbolicated = '{0} + {1}'.format(symbol_name, pc-symbol_addr) + else: + is_unsymbolicated = True + if symbol_name == '': + is_unsymbolicated = True + + if is_unsymbolicated: + result.append('{0} {1}'.format(preamble, unsymbolicated)) + else: + result.append('{0} {1:30} ({2})'.format(preamble, unsymbolicated, symbolicated)) + + num += 1 + + return result + +def parse_thread_info(thread, report): + result = [] + crashed = thread.get('crashed', False) + index = thread.get('index', -1) + if index == -1: + return result + + name = thread.get('name', None) + queue = thread.get('dispatch_queue', None) + + if name: + result.append('Thread {0} name: {1}'.format(index, name)) + elif queue: + result.append('Thread {0} name: Dispatch queue: {1}'\ + .format(index, queue)) + if crashed: + result.append('Thread {0} Crashed:'.format(index)) + else: + result.append('Thread {0}:'.format(index)) + + if "backtrace" in thread: + backtrace = parse_backtrace(report, thread['backtrace']) + result += backtrace + + return result + +def parse_thread_list(report): + crash = get_crash_info(report) + if not crash: + return [] + #print dump_json( crash) + threads = crash['threads'] + + result = [] + for thread in threads: + result.append('') + result += parse_thread_info(thread, report) + + return result + +def get_register_order(cpu): + cpu = cpu.lower() + #print "cpu %s" % cpu + arm = [ 'x'+str(i) for i in range(30)] + ['fp','sp', 'lr', 'pc', + 'cpsr'] + x86 = ['eax', 'ebx', 'ecx', 'edx', 'edi', 'esi', 'ebp', + 'esp', 'ss', 'eflags', 'eip', 'cs', 'ds', 'es', + 'fs', 'gs'] + x86_64 = ['rax', 'rbx', 'rcx', 'rdx', 'rdi', 'rsi', 'rbp', + 'rsp', 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', + 'r14', 'r15', 'rip', 'rflags', 'cs', 'fs', 'gs'] + if cpu.startswith('arm'): + return arm + elif cpu in ('x86', 'i386', 'i486', 'i686'): + return x86 + elif cpu == 'x86_64': + return x86_64 + else: + return arm + +def parse_cpu_state(report): + result = [''] + crashed = get_crash_thread(report) + if not crashed: + return result + index = crashed['index'] + + system = get_system_info(report) + cpu = get_detail_cpu_arch(system['binary_cpu_type'], + system['binary_cpu_subtype']) + cpu = get_cpu_type(cpu) + result.append('Thread {0} crashed with {1} Thread State:'.format(index, cpu)) + + registers = crashed.get('registers', {}).get('basic', {}) + order = get_register_order(cpu) + if not order: + return result + + line = '' + for i, reg in enumerate(order): + if (i != 0) and (i % 4 == 0): + result.append(line[:-1]) + line = '' + try: + line += '{0:>6}: 0x{1:016x} '.format(reg, registers.get(reg, 0)) + except: + continue + + if line: + result.append(line[:-1]) + + return result + +def parse_binary_images(report): + result = ['\nBinary Images:'] + system = get_system_info(report) + if not system: + return result + + exe_path = system['CFBundleExecutablePath'] + + images = report.get('binary_images', []) + images = sorted(images, key=lambda k: k['image_addr']) + + image_count = 0 + for image in images: + try: + image_count = image_count + 1 + cpu = image.get('cpu_type') + if not cpu: + cpu = image.get('cpuType') + #cpu_sub = image['cpu_subtype'] + addr = image['image_addr'] + size = image['image_size'] + path = image['name'] + name = os.path.basename(path) + uuid = image['uuid'].lower().replace('-', '') + is_base = '+' if path==exe_path else ' ' + if False:#image_count <=10 and not is_image_wechat(name) and simple_symbol_find.uuid_find(uuid) == False: + #name = "%s"%name + result.append('{0:>#18x} - {1:>#18x} {2}{3} <{4}> {5}'\ + .format(addr, addr+size-1, is_base, name, + uuid, path)) + else: + if name == 'WeChat': + print '{0:>#18x} - {1:>#18x} {2}{3} <{4}> {5}'.format(addr, addr+size-1, is_base, name,uuid, path) + result.append('{0:>#18x} - {1:>#18x} {2}{3} <{4}> {5}'\ + .format(addr, addr+size-1, is_base, name, + uuid, path)) + except: + traceback.print_exc() + continue + + return result + +def parse_mem_info(report): + result = ['\nMemory: {'] + system = get_system_info(report) + mem = system.get("memory") + + fmt = lambda x: " {0:6}: {1:4} M,".format(x, int(mem[x])/1024/1024) + result.append(fmt("usable")) + result.append(fmt("free")) + result.append(fmt("size")[:-1]) + result.append('}') + + return result + +def parse_app_info(report): + result = ['\nApplication Info:{'] + system = get_system_info(report) + if not system: + return [] + + _s = lambda x: system.get(x, '') + info = get_report_info(report) + _i = lambda x: info.get(x, '') + + app_stats = system.get('application_stats', None) + if not app_stats: + return [] + try: + if app_stats.get('app_launch_time'): + app_stats['app_launch_time'] = datetime.fromtimestamp(app_stats.get('app_launch_time')).strftime("%Y-%m-%d %H:%M:%S") + app_stats['app_crash__time'] = get_time(report) + + app_stats['Process'] = '{0} [{1}]'.format(_s('process_name'), _s('process_id')) + app_stats["Identifier"] = '{0}'.format(_i('id')) + app_stats['Version'] = '{0} ({1})'.format(_s('CFBundleShortVersionString'), _s('CFBundleVersion')) + + except: + traceback.print_exc() + + user_info = report.get("user", None) + if user_info and user_info.get(APP_NAME): + commit_id = user_info[APP_NAME].get("commit_id", None) + if commit_id: + app_stats['Commit ID'] = '{0}'.format(commit_id) + wcdb_commit_id = user_info[APP_NAME].get("wcdb_commit_id", None) + if wcdb_commit_id: + app_stats['WCDB_Commit ID'] = '{0}'.format(wcdb_commit_id) + app_stats['Code Type'] = '{0}'.format(get_cpu_arch(report)) + + reason = "".join(parse_crash_reason(report)) + if reason: + asi = 'Application Specific Information' + app_stats[asi] = reason.replace(asi, '') + + for item in parse_error_info(report): + if not item: + continue + items = item.split(':') + if len(items) == 2: + app_stats[items[0].strip()] = items[1].strip() + + if app_stats: + #result.append('\nApplication Info:\n{0}'\ + # .format(dump_json(app_stats).replace('"', ''))) + + for key in sorted(app_stats): + fmt = lambda x: " {0:36}: {1}".format(key, app_stats[key]) + result.append(fmt(key)) + # if key in ['Crashed Thread','Application Specific Information','Exception Type','Version','app_crash__time','app_launch_time']: + # result.append(show_color(fmt(key))) + # else: + # result.append(fmt(key)) + + result.append('}\n') + return result + + +def parse_extra_info(report): + result = ['', 'Extra Information:'] + crash = get_crash_info(report) + if not crash: + return [] + error = crash.get('error') + if not error: + return [] + ns_exception = error.get('nsexception', None) + if ns_exception: + ref_obj = ns_exception.get('referenced_object', None) + if ref_obj: + result.append('Object referenced by NSException:') + result.append(dump_json(ref_obj)) + + crashed = get_crash_thread(report) + if crashed: + stack = crashed.get('stack', None) + if stack: + result.append('Stack Dump (0x{0:08x}-0x{1:08x}):'\ + .format(stack['dump_start'], stack['dump_end'])) + result.append('') + result.append(stack.get('contents', '')) + notable_addr = crashed.get('notable_addresses', None) + if notable_addr: + for _tmp_stack in notable_addr: + if notable_addr[_tmp_stack].get('address', None): + notable_addr[_tmp_stack]['address'] = hex(notable_addr[_tmp_stack]['address']) + result.append('Notable Addresses:\n{0}'\ + .format(dump_json(notable_addr))) + last_exception = get_last_exception(report) + if last_exception: + addr = last_exception['address'] + name = last_exception['name'] + reason = last_exception['reason'] + + result.append('\nLast deallocated NSException (0x{0:016x}): {1}: {2}'\ + .format(addr, name, reason)) + + ref_obj = last_exception.get('referenced_object', None) + if ref_obj: + result.append('Referenced object:\n{0}'\ + .format(dump_json(ref_obj))) + info = get_report_info(report) + app = info['process_name'] + backtrace = parse_backtrace(crashed['backtrace'], app) + result += backtrace + + ''' + app_stats = system.get('application_stats', None) + if app_stats: + result.append('\nApplication Stats:\n{0}'\ + .format(dump_json(app_stats))) + ''' + + return result + +def parse_log_info(report): + result = ['', 'MMLog:'] + user_info = report.get("user", None) + if not user_info or not user_info.get(APP_NAME, None) or not user_info[APP_NAME].get("log"): + result.append("no log found...") + return result + + log_list = user_info[APP_NAME]["log"] + result += log_list + + return result + +def parse_click_info(report): + result = ['', 'Click:'] + user_info = report.get("user", None) + if not user_info or not user_info.get(APP_NAME, None) or not user_info[APP_NAME].get("click"): + result.append("no click found...") + return [] + + click_list = user_info[APP_NAME]["click"] + result += click_list + + return result + +def parse_other_info(report): + result = [''] + user_info = report.get("user", None) + if not user_info or not user_info.get(APP_NAME, None) or not user_info[APP_NAME].get("log"): + print "no log found..." + return result + + log_list = user_info[APP_NAME]["log"][-2:] + result += log_list + + return result + +def ks_json_2_apple(report, fout): + global IMG_INFO_MAP, APP_NAME + IMG_INFO_MAP = get_binary_img_info(report) + APP_NAME = get_app_name(report) + + headers = parse_system_info(report) + for line in headers: + fout.write(line+'\n') + + try: + errors = parse_error_info(report) + except: + traceback.print_exc() + errors = [] + for line in errors: + line = cgi.escape(line) + fout.write(line+'\n') + + try: + reason = parse_crash_reason(report) + except: + traceback.print_exc() + reason = [] + for line in reason: + line = cgi.escape(line) + fout.write(line+'\n') + + try: + user_info = parse_user_info(report) + for line in user_info: + fout.write(line+'\n') + except: + traceback.print_exc() + + ''' + try: + mems = parse_mem_info(report) + for line in mems: + fout.write(line+'\n') + except: + traceback.print_exc() + ''' + + app_info = parse_app_info(report) + for line in app_info: + fout.write(line+'\n') + #fout.write('\n\n') + + #other_info = parse_other_info(report) + #for line in other_info: + # fout.write(line+'\n') + click_info = parse_click_info(report) + for line in click_info: + line = cgi.escape(line) + fout.write(line+'\n') + + threads = parse_thread_list(report) + for line in threads: + line = cgi.escape(line) + fout.write(line+'\n') + + cpu_state = parse_cpu_state(report) + for line in cpu_state: + line = cgi.escape(line) + fout.write(line+'\n') + + images = parse_binary_images(report) + for line in images: + #line = cgi.escape(line) + fout.write(line+'\n') + + extra = parse_extra_info(report) + for line in extra: + line = cgi.escape(line) + fout.write(line+'\n') + + log_info = parse_log_info(report) + for line in log_info: + line = cgi.escape(line) + fout.write(line+'\n') + +if __name__ == '__main__': + parser = optparse.OptionParser() + parser.add_option("-i","--input_file", help="input ks json file") + parser.add_option("-o","--output_file", help="output file") + (options, args) = parser.parse_args() + if not (options.input_file and options.output_file): + parser.print_help() + sys.exit(1) + + report = json.load(open(options.input_file)) + fout = open(options.output_file, 'w') + ks_json_2_apple(report, fout) + fout.close() \ No newline at end of file diff --git a/samples/sample-android/app/src/main/java/sample/tencent/matrix/MatrixApplication.java b/samples/sample-android/app/src/main/java/sample/tencent/matrix/MatrixApplication.java index b2f0d9075..610329417 100644 --- a/samples/sample-android/app/src/main/java/sample/tencent/matrix/MatrixApplication.java +++ b/samples/sample-android/app/src/main/java/sample/tencent/matrix/MatrixApplication.java @@ -18,9 +18,6 @@ import android.app.Application; import android.content.Context; -import android.os.Build; -import android.os.Debug; -import android.os.SystemClock; import com.tencent.matrix.Matrix; import com.tencent.matrix.iocanary.IOCanaryPlugin; @@ -34,8 +31,6 @@ import com.tencent.sqlitelint.SQLiteLintPlugin; import com.tencent.sqlitelint.config.SQLiteLintConfig; -import java.util.HashSet; - import sample.tencent.matrix.config.DynamicConfigImplDemo; import sample.tencent.matrix.listener.TestPluginListener; import sample.tencent.matrix.sqlitelint.TestSQLiteLintActivity;