ndk-samples icon indicating copy to clipboard operation
ndk-samples copied to clipboard

curl-ssl sample JNI debugging is not working

Open AndreiHarasemiuc opened this issue 5 years ago • 3 comments

Cloned the repo as is. Tried to set a breakpoint anywhere in the native cpp code.

I encountered this issue on my own project after adding curl/ssl through prefab. Prior to doing this I was able to debug native code, after I was no longer able to. Tried to clone the curl-ssl sample to see if it's an issue with my project but it seems it's not. Symbols are missing or something, I suspect in libcrypto.so.

image

AndreiHarasemiuc avatar Jun 24 '20 17:06 AndreiHarasemiuc

thank you for reporting the issue: saw it locally, following up internally.

ggfan avatar Jul 14 '20 00:07 ggfan

This happens while libcrypto.so is being loaded. According to this explanation, OpenSSL is trying to probe for supported CPU features, and has its own SIGILL handler. So, the SIGILL is expected.

When running under a debugger, the debugger intercepts all signals sent to the debuggee. In LLDB, the default signal handling behavior for SIGILL signal is stop=true, pass=true, notify=true. Therefore, when execution stops due to SIGILL, you can hit "continue" in the native debugger, and SIGILL will be redirected to the app, and the app will continue as if the debugger never intercepted the signal. This means OpenSSL will be able to identify that this CPU does not support the particular instruction. In short, this is just a harmless pseudo-breakpoint being triggered.

If this extra pause is annoying, you can suppress it by adding the following command to "LLDB Post Attach Commands":

process  handle SIGILL --notify false --pass true --stop false

emrekultursay avatar Jul 14 '20 18:07 emrekultursay

@AndreiHarasemiuc please check it out on your end; the commend mentioned above could be added with instructions at: https://developer.android.com/studio/run/rundebugconfig#editing it works for me on Mac. Kindly let us know your findings, thanks.

ggfan avatar Jul 14 '20 18:07 ggfan