Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

How does one debug libqtforandroid?



  • I am having a crash in my app and the backtrace doesn't really tell much about the crash. So, I'm planing to step through libqtforandroid.so to find where it crashes.

    ********** Crash dump: **********
    Build fingerprint: 'samsung/gts4lltedd/gts4llte:9/PPR1.180610.011/T835DDU2BSD1:user/release-keys'
    pid: 11765, tid: 11765, name: org.kde.krita  >>> org.kde.krita <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x18
    Stack frame #00 pc 0002d168  /data/data/org.kde.krita/qt-reserved-files/plugins/platforms/android/libqtforandroid.so
    

    But, when I set a breakpoint on any symbol in libqtforandroid.so it isn't found (I have compiled it with debug symbols). I can step through other Qt libraries like libQt5Gui.so but not libqtforandroid.so.
    It doesn't help when I run it using lldb. Only one frame is returned (other frames don't give something meaningful either) in the backtrace:

    (lldb) bt
    * thread #1, name = 'org.kde.krita', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
      * frame #0: 0xca533168
    

    So, what am I doing wrong? What should I do to be able to step through libqtforandroid.so in lldb?



  • I have no idea. But according to one post in StackOverflow one reason is that "A page was accessed that is not even mapped into the address space of the application at all. This will often result from dereferencing a null pointer or a pointer that was corrupted with a small integer value. This is reported as SEGV_MAPERR."

    So you should be able to find out where the crash happens in your code by traditional debugging techniques and check your pointers (and other problems). The assumption being that if the problem is in your code, it can be found in your code.



  • If the problem is with my code, I should have a proper backtrace (I think). But, the problem is only one frame is returned which makes this problem so much harder to solve.

    PS: I've disabled optimizations as well.


  • Qt Champions 2018

    @sh-zam said in How does one debug libqtforandroid?:

    Stack frame #00 pc 0002d168 /data/data/org.kde.krita/qt-reserved-files/plugins/platforms/android/libqtforandroid.so

    There should be more in the stack trace.



  • @jsulm I'm afraid, what do you mean?

    This is the stack trace and as previously said, only one frame is returned :(

    (lldb) bt all
    * thread #1, name = 'org.kde.krita', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
      * frame #0: 0xca5bb168
      thread #2, name = 'Jit thread pool'
        frame #0: 0xe8d35f7c libc.so`syscall + 28
        frame #1: 0xe7828f96 libart.so`art::ConditionVariable::WaitHoldingLocks(art::Thread*) + 82
        frame #2: 0xe7b09c8e libart.so`art::ThreadPool::GetTask(art::Thread*) + 178
        frame #3: 0xe7b09550 libart.so`art::ThreadPoolWorker::Run() + 64
        frame #4: 0xe7b09184 libart.so`art::ThreadPoolWorker::Callback(void*) + 96
        frame #5: 0xe8d90092 libc.so`__pthread_start(void*) + 24
        frame #6: 0xe8d3a4d2 libc.so`__start_thread + 26
      thread #3, name = 'Signal Catcher'
    ......