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

Getting Qt source line numbers to display in helgrind debugging multi-threaded race conditions



  • I'm learning about helgrind from David Faure's excellent Qt Developer Days presentation. The presentation was very helpful and I'm able to run helgrind properly. However, in his presentation, the helgrind output includes source code line numbers. In my helgrind output, I only see hex memory locations and line numbers from libraries.

    Note: Presentation on youtube...
    https://www.youtube.com/watch?v=N9X6AJckIG8
    And webpage with instructions...
    http://www.kdab.com/~dfaure/helgrind.html)

    I've added "QMAKE_CXXFLAGS += -g" to my .pro files, but that doesn't seem to help. Do you have any idea how to get the line numbers / debugging information into the application? The lines below show my current output sample from helgrind

    ==25445== Possible data race during read of size 4 at 0x14D2ADE0 by thread #4
    ==25445== Locks held: none
    ==25445==    at 0xD666D21: g_private_set (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
    ==25445==    by 0xD649397: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
    ==25445==    by 0x4C32D06: mythread_wrapper (hg_intercepts.c:389)
    ==25445==    by 0x88C0493: start_thread (pthread_create.c:333)
    ==25445==    by 0x945BACE: clone (clone.S:97)
    ==25445== 
    ==25445== This conflicts with a previous write of size 8 by thread #1
    ==25445== Locks held: 1, at address 0x14D0ACF0
    ==25445==    at 0x88C94FF: recv (recv.c:28)
    ==25445==    by 0x18BB8A73: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18B9E4AB: g_input_stream_read (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18B75B41: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18B76843: g_buffered_input_stream_fill (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18B7DAED: g_data_input_stream_read_line (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18BEC144: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==    by 0x18BECAE8: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5000.3)
    ==25445==  Address 0x14d2ade0 is 0 bytes inside a block of size 4 alloc'd
    ==25445==    at 0x4C2CFCF: malloc (vg_replace_malloc.c:299)
    ==25445==    by 0xD666772: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
    ==25445==    by 0xD666D60: g_private_set (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
    ==25445==    by 0xD649397: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3)
    ==25445==    by 0x4C32D06: mythread_wrapper (hg_intercepts.c:389)
    ==25445==    by 0x88C0493: start_thread (pthread_create.c:333)
    ==25445==    by 0x945BACE: clone (clone.S:97)
    ==25445==  Block was alloc'd by thread #3
    
    

  • Qt Champions 2019

    Those warnings are neither from Qt nor from your source code.
    If you want line number you have to install the corresponding debug-packages for e.g libgio, libglib etc. in your case.




Log in to reply