Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call_thread_read_maps的作用 #3

Open
StaringTheWorldAtMyRearView123 opened this issue May 17, 2022 · 0 comments
Open

call_thread_read_maps的作用 #3

StaringTheWorldAtMyRearView123 opened this issue May 17, 2022 · 0 comments

Comments

@StaringTheWorldAtMyRearView123

请问下面这段代码里的 call_thread_read_maps 的意义是不是在 maps 文件里找到 sp 所在的内存段? 如果是的话, 那么用 Process.findRangeByAddress 是不是也可以?
function stacktrace(pc, fp, sp) { let n = 0, stack_arr = [], fp_c = fp; stack_arr[n++] = pc; const mem_region = call_thread_read_maps(sp); while (n < MAX_STACK_TRACE_DEPTH) { if (parseInt(fp_c.toString()) < parseInt(sp.toString()) || fp_c < mem_region.start || fp_c > mem_region.end) { break } let next_fp = fp_c.readPointer() let lr = fp_c.add(8).readPointer() fp_c = next_fp stack_arr[n++] = lr } return stack_arr; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant