Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to debug Qt sources on mac
Forum Updated to NodeBB v4.3 + New Features

how to debug Qt sources on mac

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 5 Posters 4.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    i saw this, and i saw this too. But neither was explicit about how to set this up for mac.

    I tried this:

    0_1559864800479_Screen Shot 2019-06-06 at 4.46.23 PM.png

    but i still don't see sources in the debugger:

    0_1559864916031_Screen Shot 2019-06-06 at 4.48.23 PM.png

    it's all grayed out and shows disassembly instead of source if i select one.

    note also tried this path, same problem:

    0_1559865015527_Screen Shot 2019-06-06 at 4.49.47 PM.png

    jsulmJ 1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #20

      i see no such "Use debug version of frameworks":

      0_1561480846034_Screen Shot 2019-06-25 at 9.39.22 AM.png

      but setting the environment variable worked!!

      C 1 Reply Last reply
      0
      • D davecotter

        i saw this, and i saw this too. But neither was explicit about how to set this up for mac.

        I tried this:

        0_1559864800479_Screen Shot 2019-06-06 at 4.46.23 PM.png

        but i still don't see sources in the debugger:

        0_1559864916031_Screen Shot 2019-06-06 at 4.48.23 PM.png

        it's all grayed out and shows disassembly instead of source if i select one.

        note also tried this path, same problem:

        0_1559865015527_Screen Shot 2019-06-06 at 4.49.47 PM.png

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @davecotter First question: did you install Qt source code (for exact same Qt version you're using)?
        bin directories do not contain source code.
        Is there Qt source code in the second path you added?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • D Offline
          D Offline
          davecotter
          wrote on last edited by
          #3

          Yes, I did install the sources for the version of QT that I am using. They are at the directory labeled “Src“

          1 Reply Last reply
          0
          • D Offline
            D Offline
            davecotter
            wrote on last edited by
            #4

            any ideas?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #5

              Hi,

              One thing I find surprising, why do you have the Qt frameworks deployed in your application bundle since you are currently developing your application ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D Offline
                D Offline
                davecotter
                wrote on last edited by
                #6

                cuz otherwise the app doesn't run

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  It doesn't run from Qt Creator without the frameworks embedded ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    davecotter
                    wrote on last edited by davecotter
                    #8

                    yes that is correct

                    i think what's going on there is that i'm linking to boost::threads and its dependencies (system and atomic), and macdeployqt magically manages all the necessary install_name_tool -change things even for my boost libraries, so i let it do its thing.

                    I suppose for the debug release i could script those things myself? i haven't tried. but if it means i'll be able to use the debugger to step through Qt source code, then i'll have at it?

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      davecotter
                      wrote on last edited by
                      #9

                      do you think this is the problem? that in the debugger, the qt frameworks are loading from my app bundle?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        Since you ran macdeployqt and install_name_tools, you like have everything loaded from your application bundle rather than from your Qt installation.

                        Note that you have the -use-debug-libs option for macdeploqt that should help.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • D Offline
                          D Offline
                          davecotter
                          wrote on last edited by
                          #11

                          okay so i eliminated macdeployqt from the equation, by manually calling install_name_tool on my boost libraries, and now the Qt libs are running from the Qt installation folder. yet i still can not debug (view or step through) the Qt Widgets or Core code:

                          0_1560912795970_Screen Shot 2019-06-18 at 7.51.28 PM.png

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            davecotter
                            wrote on last edited by
                            #12

                            anyone have any further hints? have i set things up correctly? is what i'm trying to do even POSSIBLE?

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              davecotter
                              wrote on last edited by
                              #13

                              pretty please?

                              1 Reply Last reply
                              0
                              • H Offline
                                H Offline
                                HamishM
                                wrote on last edited by
                                #14

                                It looks like you are linked to the Qt release frameworks (QtCore.framework/Versions/5/QtCore), not the debug versions (QtCore.framework/Versions/5/QtCore_debug). When I am debugging in Xcode, I see the QtCore_debug filename, not QtCore.

                                I'm not sure how you fix this with Qt Creator. Are you actually debugging a debug build, with CONFIG = debug, not CONFIG = release?

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  davecotter
                                  wrote on last edited by
                                  #15

                                  I believe so yes, if this is what you mean:

                                  0_1561442040178_Screen Shot 2019-06-24 at 10.53.26 PM.png

                                  now looking, i see i also have this line in my .pro file:

                                  # this line makes qmake parse this file ONCE not three times
                                  CONFIG -= debug_and_release
                                  
                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    davecotter
                                    wrote on last edited by
                                    #16

                                    and are we sure i have my "source path mappings" set right? what SHOULD that be set to?

                                    H 1 Reply Last reply
                                    0
                                    • D davecotter

                                      and are we sure i have my "source path mappings" set right? what SHOULD that be set to?

                                      H Offline
                                      H Offline
                                      HamishM
                                      wrote on last edited by
                                      #17

                                      @davecotter debug looks fine.

                                      I poked around in Xcode and found that the source for QCoreApplication for example lived at /Users/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp

                                      So your source mapping looks correct. I added that source mapping in lldb inside Xcode, using

                                      settings set target.source-map /Users/qt/work/qt /Users/hamish/dev/Qt5.12.4/5.12.4/Src

                                      and Xcode displayed the Qt source OK.

                                      1 Reply Last reply
                                      1
                                      • D Offline
                                        D Offline
                                        davecotter
                                        wrote on last edited by
                                        #18

                                        your source mapping looks correct

                                        well i provided two examples, so which one is correct? is itclang_64/bin or is itSrc?

                                        how do i configure Qt Creator so that i can debug in Qt Creator debugger? I'm not directly using Xcode

                                        C 1 Reply Last reply
                                        0
                                        • D davecotter

                                          your source mapping looks correct

                                          well i provided two examples, so which one is correct? is itclang_64/bin or is itSrc?

                                          how do i configure Qt Creator so that i can debug in Qt Creator debugger? I'm not directly using Xcode

                                          C Offline
                                          C Offline
                                          christiani
                                          wrote on last edited by
                                          #19

                                          @davecotter said in how to debug Qt sources on mac:

                                          how do i configure Qt Creator so that i can debug in Qt Creator debugger? I'm not directly using Xcode

                                          In the Run Settings you should tick the box that says "Use debug version of frameworks" or alternatively set the environment variable DYLD_IMAGE_SUFFIX=_debug.
                                          See: https://doc.qt.io/qtcreator/creator-debugger-engines.html#debugging-tools-for-macos and https://doc.qt.io/qt-5/macos-issues.html#qt-libraries-as-frameworks

                                          1 Reply Last reply
                                          2
                                          • D Offline
                                            D Offline
                                            davecotter
                                            wrote on last edited by
                                            #20

                                            i see no such "Use debug version of frameworks":

                                            0_1561480846034_Screen Shot 2019-06-25 at 9.39.22 AM.png

                                            but setting the environment variable worked!!

                                            C 1 Reply Last reply
                                            0

                                            • Login

                                            • Login or register to search.
                                            • First post
                                              Last post
                                            0
                                            • Categories
                                            • Recent
                                            • Tags
                                            • Popular
                                            • Users
                                            • Groups
                                            • Search
                                            • Get Qt Extensions
                                            • Unsolved