Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I debug my qt project with coredump?



  • Hi All,

    I am getting "Segmentation fault (core dumped)" error with my Qt application. As I am bit new to Qt, may I know how to debug my Qt project with the coredump?
    And where can I found the coredump file?

    Here are the full error message:
    "malloc(): mismatching next->prev_size (unsorted)
    Segmentation fault (core dumped)"

    I have done some googling, but nothing found really helpful, may be I didn't find the exact link. So someone already know the solution then please share it.

    Qt version: Qt Creator 4.11.0
    OS: Ubuntu20.04
    gcc: 9.3.0

    Kind regards,
    Raj



  • @v-raj
    All you should have to do is run your application from within Qt Creator via Debug (instead of Run). You should find it is set up to use Ubuntu gdb, that will cut in when you hit the crash, and the stack trace window should show you the calling sequence from your code to the error location.



  • Thanks for your reply @JonB

    I did some debugging using GDB, and here are the stack trace. So how can I analyse more with this logs? still I am not getting the exact code part.

    malloc(): mismatching next->prev_size (unsorted)
    
    Thread 1 "Camera_Filter" received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
    50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) backtrace
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
    #1  0x00007fffee0c1859 in __GI_abort () at abort.c:79
    #2  0x00007fffee12c3ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fffee256285 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
    #3  0x00007fffee13447c in malloc_printerr (str=str@entry=0x7fffee258aa0 "malloc(): mismatching next->prev_size (unsorted)") at malloc.c:5347
    #4  0x00007fffee1374dc in _int_malloc (av=av@entry=0x7fffee287b80 <main_arena>, bytes=bytes@entry=1256) at malloc.c:3741
    #5  0x00007fffee13ad15 in __libc_calloc (n=<optimised out>, elem_size=<optimised out>) at malloc.c:3428
    #6  0x00007fffe5b79248 in  () at /usr/local/cuda/lib64/libcublas.so.11
    #7  0x00007fffe5b7a8d8 in  () at /usr/local/cuda/lib64/libcublas.so.11
    #8  0x00007fffee0e615e in __cxa_finalize (d=0x7fffed84b620) at cxa_finalize.c:83
    #9  0x00007fffe55032d3 in  () at /usr/local/cuda/lib64/libcublas.so.11
    #10 0x00007fffffffd600 in  ()
    


  • @v-raj
    Your stack trace shows this is all to do with something happening in libcublas

    libcublas.so The cuBLAS library is an implementation of BLAS (Basic Linear Algebra Subprograms) on top of the NVIDIA CUDA runtime. It allows the user to access the computational resources of NVIDIA Graphics Processing Unit (GPU), but does not auto-parallelize across multiple GPUs.

    which is something I know nothing about. Nor about what Thread 1 "Camera_Filter". Does it have anything to do with Qt or is it some library your code is using?

    I see nothing about your own program/code in the traceback. Do you at least compile your code for debug? When does the error occur relative to running your program? Do you have anything calling this from your code? Did you try a minimal C++ or Qt program, like a Hello World, to see whether this always happens or depends on something in your code?



  • @JonB

    1. if I run the project with minimal code, then this issue is not happening.

    2. I am getting this error while my program exits, and I am using "std::exit()" all for that, if I use "std::quick_exit()" this issue is not happening.

    3. "Camera_Filter' is my Qt application

    Output from nvidia-smi command:

    "NVIDIA-SMI 470.82.01 Driver Version: 470.82.01 CUDA Version: 11.4"



  • @v-raj said in How can I debug my qt project with coredump?:

    if I run the project with minimal code, then this issue is not happening.

    I am getting this error while my program exits

    So what is the difference between the "minimal code" versus "your program"? I certainly don't know, only you do, since you have said nothing about your application which crashes.

    Maybe it's an error in libcublas or NVIDIA/CUDA stuff.

    and I am using "std::exit()" all for that, if I use "std::quick_exit()" this issue is not happening.

    Doubtless because quick_exit() does less/no clean up. I do not know why you would use either of these in a Qt program.


Log in to reply