File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -215,9 +215,34 @@ def patchStackFrame = tasks.register("patchStackFrame") {
215215 }
216216}
217217
218+ def patchStackWalker = tasks. register(" patchStackWalker" ) {
219+ description = ' Patch stackWalker.cpp after copying'
220+ configure {
221+ dependsOn copyUpstreamFiles
222+ }
223+ doLast {
224+ def file = file(" ${ projectDir} /src/main/cpp-external/stackWalker.cpp" )
225+ if (! file. exists()) throw new GradleException (" File not found: ${ file} " )
226+
227+ def content = file. getText(' UTF-8' )
228+ def original = content
229+
230+ // Add no_sanitize to walkVM
231+ content = content. replaceAll(
232+ / (int\s +StackWalker::walkVM\s *\( )/ ,
233+ ' __attribute__((no_sanitize("address"))) int StackWalker::walkVM('
234+ )
235+
236+ if (content != original) {
237+ file. write(content, ' UTF-8' )
238+ println " Patched stackWalker.cpp"
239+ }
240+ }
241+ }
242+
218243def initSubrepoTask = tasks. register(' initSubrepo' ) {
219244 configure {
220- dependsOn copyUpstreamFiles, patchStackFrame
245+ dependsOn copyUpstreamFiles, patchStackFrame, patchStackWalker
221246 }
222247}
223248
You can’t perform that action at this time.
0 commit comments