Skip to content

Commit 4370092

Browse files
committed
修复dump闪退
1 parent 158ac00 commit 4370092

14 files changed

Lines changed: 60 additions & 27 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,5 @@ if (propFile.canRead()) {
9494
println 'release build not found signing file'
9595
android.buildTypes.release.signingConfig = null
9696
}
97+
98+

xposedmodule/build.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ android {
1515
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1616
externalNativeBuild {
1717
cmake {
18-
cppFlags "-std=c++14","-fms-extensions"
18+
cppFlags "-std=c++14", "-fms-extensions"
1919
}
2020
}
2121
ndk {
22-
abiFilters "armeabi", "armeabi-v7a","arm64-v8a"
22+
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
2323
}
2424

2525
}
@@ -53,3 +53,13 @@ dependencies {
5353
repositories {
5454
mavenCentral()
5555
}
56+
task buildSo(dependsOn: "compileReleaseSources") {
57+
doLast {
58+
println "更新so"
59+
exec {
60+
ignoreExitValue true
61+
commandLine "pwd"
62+
commandLine "sh", "./script/so.sh"
63+
}
64+
}
65+
}

xposedmodule/script/so.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
result=$(ls build/intermediates/cmake/release/obj)|grep 'No such file or directory'
2+
echo $result
3+
if [ -z "${result}" ]; then
4+
echo '目录已生成'
5+
cp build/intermediates/cmake/release/obj/arm64-v8a/libnativeDump.so src/main/assets/nativeDumpV8a.so
6+
cp build/intermediates/cmake/release/obj/armeabi-v7a/libnativeDump.so src/main/assets/nativeDumpV7a.so
7+
cp build/intermediates/cmake/release/obj/armeabi/libnativeDump.so src/main/assets/nativeDump.so
8+
echo '完成'
9+
else
10+
echo '目录未生成'
11+
fi
115 KB
Binary file not shown.
114 KB
Binary file not shown.
115 KB
Binary file not shown.

xposedmodule/src/main/cpp/inlineHook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ created time: 2015-11-30
2525
#ifndef PAGE_SIZE
2626
#define PAGE_SIZE 4096
2727
#endif
28-
#define TAG "dumpDex->"
28+
#define TAG "developerhelper.native-->"
2929

3030
#define PAGE_START(addr) (~(PAGE_SIZE - 1) & (addr))
3131
#define SET_BIT0(addr) (addr | 1)

xposedmodule/src/main/cpp/native.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "native.h"
55
#include "inlineHook.h"
66

7-
#define TAG "dumpDex->"
7+
#define TAG "developerhelper.native-->"
88

99

1010
JNIEXPORT void JNICALL Java_com_wrbug_developerhelper_xposed_dumpdex_Native_dump

xposedmodule/src/main/cpp/util/deviceutils.cpp

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "deviceutils.h"
77
#include "fileutils.h"
88

9-
#define TAG "dumpDex->"
9+
#define TAG "developerhelper.native-->"
1010

1111
const static long DEX_MIN_LEN = 102400L;
1212
static int sdk_int = 0;
@@ -72,15 +72,17 @@ static void *new_arm64_open_common(uint8_t *base, size_t size, void *location,
7272
bool verify,
7373
bool verify_checksum,
7474
void *error_meessage, void *verify_result) {
75+
__android_log_print(ANDROID_LOG_ERROR, TAG, "new_arm64_open_common");
7576
if (size < DEX_MIN_LEN) {
7677
__android_log_print(ANDROID_LOG_ERROR, TAG, "size =%u", size);
77-
return nullptr;
78+
} else {
79+
__android_log_print(ANDROID_LOG_INFO, TAG, "保存64位apk dex文件:%p", base);
80+
save_dex_file(base, size);
7881
}
79-
save_dex_file(base, size);
8082
void *result = old_arm64_open_common(base, size, location, location_checksum,
81-
oat_dex_file, verify, verify_checksum,
82-
error_meessage,
83-
verify_result);
83+
oat_dex_file, verify, verify_checksum,
84+
error_meessage,
85+
verify_result);
8486
return result;
8587
}
8688
/////////////////////
@@ -89,21 +91,24 @@ static void *new_arm64_open_common(uint8_t *base, size_t size, void *location,
8991

9092
/////////////////////
9193
static void *(*old_arm64_open_memory)(uint8_t *base,
92-
size_t size, void *location,
93-
uint32_t location_checksum,
94-
void *mem_map,
95-
void *oat_dex_file, void *error_msg);
94+
size_t size, void *location,
95+
uint32_t location_checksum,
96+
void *mem_map,
97+
void *oat_dex_file, void *error_msg);
9698

9799
static void *
98100
(new_arm64_open_memory)(uint8_t *base, size_t size, void *location,
99101
uint32_t location_checksum, void *mem_map,
100102
void *oat_dex_file, void *error_msg) {
103+
__android_log_print(ANDROID_LOG_INFO, TAG, "new_arm64_open_memory");
104+
101105
if (size < DEX_MIN_LEN) {
102-
return nullptr;
106+
__android_log_print(ANDROID_LOG_INFO, TAG, "size < DEX_MIN_LEN");
107+
} else {
108+
save_dex_file(base, size);
103109
}
104-
save_dex_file(base, size);
105110
return (*old_arm64_open_memory)(base, size, location, location_checksum, mem_map,
106-
oat_dex_file, error_msg);
111+
oat_dex_file, error_msg);
107112
}
108113
/////////////////////
109114

@@ -120,10 +125,14 @@ static void *
120125
(new_nougat_open_memory)(void *DexFile_thiz, uint8_t *base, size_t size, void *location,
121126
uint32_t location_checksum, void *mem_map,
122127
void *oat_dex_file, void *error_msg) {
128+
__android_log_print(ANDROID_LOG_INFO, TAG, "new_nougat_open_memory");
129+
123130
if (size < DEX_MIN_LEN) {
124-
return nullptr;
131+
__android_log_print(ANDROID_LOG_INFO, TAG, "size < DEX_MIN_LEN");
132+
} else {
133+
__android_log_print(ANDROID_LOG_INFO, TAG, "保存64位nougat apk dex文件:%p", base);
134+
save_dex_file(base, size);
125135
}
126-
save_dex_file(base, size);
127136
return (*old_nougat_open_memory)(DexFile_thiz, base, size, location, location_checksum, mem_map,
128137
oat_dex_file, error_msg);
129138
}
@@ -140,10 +149,12 @@ static void *new_opencommon(void *DexFile_thiz, uint8_t *base, size_t size, void
140149
uint32_t location_checksum, void *oat_dex_file, bool verify,
141150
bool verify_checksum,
142151
void *error_meessage, void *verify_result) {
152+
__android_log_print(ANDROID_LOG_INFO, TAG, "new_opencommon");
143153
if (size < DEX_MIN_LEN) {
144-
return nullptr;
154+
__android_log_print(ANDROID_LOG_INFO, TAG, "size < DEX_MIN_LEN");
155+
} else {
156+
save_dex_file(base, size);
145157
}
146-
save_dex_file(base, size);
147158
return (*old_opencommon)(DexFile_thiz, base, size, location, location_checksum,
148159
oat_dex_file, verify, verify_checksum, error_meessage,
149160
verify_result);

xposedmodule/src/main/cpp/util/fileutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include "fileutils.h"
77

8-
#define TAG "dumpDex->"
8+
#define TAG "developerhelper.native-->"
99

1010
static char pname[256];
1111

0 commit comments

Comments
 (0)