Results 1 to 8 of 8

Thread: Gcov with Qt

  1. #1
    Join Date
    May 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Gcov with Qt

    Hi,

    I am trying to compile my code to check Coverage. i have used "-fprofile-arcs -ftest-coverage" option while compiling my code using GCC. Neither i get any .da / .bb / .gcda files or .gcov files after running the application.

    I tried using the hack specified in the link below
    http://www.qtcentre.org/forum/f-gene...post78633.html But i still face the same issue.

    Am i missing some thing or Is there any other configuration needed to use Gcov.

    Thanks in advance.

    Mani

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Gcov with Qt

    Did you build the application in debug mode?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Gcov with Qt

    Yes i did compile it with debug mode (-g)

  4. #4
    Join Date
    May 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Gcov with Qt

    Hi,

    When i give "make" this is what it does,

    Qt Code:
    1. gcc -c -pipe -fprofile-arcs -ftest-coverage -g -D_REENTRANT -Wall -W -DQT_DBUS_LIB -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I<Include Path> -o ./applicationwindow.o applicationwindow.cpp
    To copy to clipboard, switch view to plain text mode 

    Is there any mistake in the above command ?

    Mani

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Gcov with Qt

    I think this is not enough. You also need to link with the gcov library and pass the same flags to the linker. Here is something that worked for me:
    qmake Code:
    1. QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
    2. QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage
    3. LIBS += -lgcov
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    May 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Gcov with Qt

    I tried this option as well. No luck yet

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Gcov with Qt

    I assure you it works fine for me. Please check if all relevant files are compiled with the mentioned options.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    May 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Gcov with Qt

    Found out the issue. I had to Disable ccache to get the gcno and gcda file to be directed to sourec directory.

    Thanks for the help

    Mani

Similar Threads

  1. qmake and gcov?
    By akos.maroy in forum General Programming
    Replies: 1
    Last Post: 15th August 2008, 15:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.