Is there a way to write debug registers directly in ndk?

49 views
Skip to first unread message

Gleb Igumnov

unread,
May 27, 2022, 5:10:53 PM5/27/22
to android-ndk
Hello, I have following problem: I need to set CPU debug registers manualy in my program, to create data breakpoint each time, my string is allocated. My bug is super-cryptic and obscure and it appears only on android, so I don't have any conventional debug methods left.
I've found article, that says that it can be done with ptrace api, using PT_SETDBREGS command and struct dbreg. But I can't find neither in ndk headers.
Is there any way to do it in ndk?

Dan Albert

unread,
May 27, 2022, 5:14:31 PM5/27/22
to android-ndk
afaict that constant is part of BSD ptrace, not Linux ptrace.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/adf475ef-9f7a-4f7a-96bc-093e58ad0e9an%40googlegroups.com.

enh

unread,
May 31, 2022, 9:21:22 PM5/31/22
to android-ndk
yeah, that's spelled differently in Linux land. you should probably check out something like the source to lldb for full details of hardware watchpoints, but here's a simple example from one of the bionic tests: https://android.googlesource.com/platform/bionic/+/master/tests/sys_ptrace_test.cpp#110

Reply all
Reply to author
Forward
0 new messages