art_sigsegv_fault crash in Android Studio while debugging native code
Asked Answered
E

0

9

The problem
I'm trying to debug native (c++) code that is called from Java code (MainActivity.OnCreate) in simple android application. I'm using lldb for debugging and build the native code using cmake.
The debug works as expected until I try to step into native language function, then one of these happens:
1. The debugger steps into the function and allows making further steps, but there is no cursor, no normal stack trace, and no variable watches. The only thing in stack trace is the name of the cpp file and memory adress (instruction pointer maybe?) that increases with every step that I take. It looks to me as no debug symbols were loaded.
2. The step suceeds as it should and for a brief moment I can catch a glimpse of correct stack trace. But then the lldb crashes, the stack changes and the cursor is at art_sigsegv_fault. When I continue, I simply get a message that debugger was disconnected. The app continues to run as it should.

Additionally, I've noticed that at the moment of crash the debugger attempts to collect data from variables and never actually suceeds. The variables that are successfully resolved are a JNI pointer and jobject, while the others are jstring.
Miliseconds before the crash:
Milisecond before the crash
After the crash:
After the crash
What I've tried

  • Made sure that symbols are not stripped from .so files, by adding
packagingOptions{
    doNotStrip "**/*.so"
    }  
  • Made sure that CMAKE_CXX_FLAGS have -O0 -ggdb in them (no code optimization, debug compile)
  • Made sure that in Project Structure there is debug build, with properties Debuggable, Jni Debuggable, and Renderscript Debuggable set to true.
    Project Structure
    Build types
    I believe that I've tried all the possible options that I've found here, hence a new question that may seem repetitive at first.
Exemplification answered 26/11, 2019 at 16:45 Comment(2)
Same problem here, legacy app so I'm still using Application.mk, Android.mk... Can't debug native code at all. Android Studio and all its tools are becoming more and more problematic each day. Did you find out anything else about this problem?Faceharden
I came here after seeing sporadic builds break with art_sigsev_fault and I don't understand it. If I rebuild the source it seems to sometimes go away. I just don't have anything to go on. Sure wish someone had answered your question.Problem

© 2022 - 2024 — McMap. All rights reserved.