Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] Problems with debugging (GDB on Linux with QtCreator)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Problems with debugging (GDB on Linux with QtCreator)

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 1 Posters 11.4k Views 1 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.
  • B Offline
    B Offline
    bobhairgrove
    wrote on 9 Nov 2014, 10:48 last edited by
    #1

    My QtCreator is version 3.2.0, my Qt is 5.3.1 and my g++ is 4.9.0.
    GDB version is 7.8.1, Python version is 2.7.3.
    OS is Ubuntu 12.04 LTS.

    According to the documentation, this should work OK. However, I cannot figure out how to display locals in the Expression pane. I can highlight a variable and choose "Add Expression Evaluator" from the menu. The name of the variable shows up, but it always has "<no such value>" in the Value column.

    Single-stepping works OK, as do breakpoints, but QtCreator doesn't want to step into C library functions even though the source code is part of the project. How can I step into those?

    This is rather frustrating, to say the least.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bobhairgrove
      wrote on 9 Nov 2014, 11:57 last edited by
      #2

      Apparently, since I compiled GDB myself, there is no Python embedded in it ... however, Python is installed in Ubuntu.

      Do I need to recompile GDB with Python? I didn't see any options to do that when I built GDB.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bobhairgrove
        wrote on 9 Nov 2014, 13:25 last edited by
        #3

        OK, I went back and did "make clean" and "make distclean" and reconfigured GDB --with-python after installing the python development files, then rebuilt and installed it.

        Although I can run GDB and do

        @(gdb) python print sys.version@

        and it works in the terminal, QtCreator still doesn't display any local variables with their values. It is the same behavior as before.

        Thanks for any ideas.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bobhairgrove
          wrote on 9 Nov 2014, 13:56 last edited by
          #4

          Following up in the above matter, here is the output when I run the debugger (sorry if it is rather long, I have to split it up into four different messages):

          PART 1:

          @dATTEMPT SYNC

          sStarting debugger "GdbEngine" for ABI "x86-linux-generic-elf-64bit"...
          dStart parameters: 'test_csv' mode: 1
          dABI: x86-linux-generic-elf-64bit
          dLanguages: c++
          dExecutable: /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug/test_csv [terminal]
          dDirectory: /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug
          dDebugger: /usr/bin/gdb
          dProject: /home/bob/code/Qt/test_csv/test_csv (built: /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug)
          dQML server: 127.0.0.1:3768
          dRemote: :0
          dSysroot:
          dDebug Source Location:
          dDebugger settings:
          dQmlInspector.ShowAppOnTop: false (default: false)
          dQmlInspector.FromQml: false (default: false)
          dNoPluginBreakpoints: false (default: false)
          dSelectedPluginBreakpointsPattern: .* (default: .*)
          dBreakOnThrow: false (default: false)
          dBreakOnCatch: false (default: false)
          dBreakOnWarning: false (default: false)
          dBreakOnFatal: false (default: false)
          dBreakOnAbort: false (default: false)
          dShowQmlObjectTree: true (default: true)
          dDisplayStringLimit: 100 (default: 100)
          dListSourceFiles: false (default: false)
          dSkipKnownFrames: false (default: false)
          dEnableReverseDebugging: false (default: false)
          dAllPluginBreakpoints: true (default: true)
          dSelectedPluginBreakpoints: false (default: false)
          dAdjustBreakpointLocations: true (default: true)
          dMaximalStackDepth: 20 (default: 20)
          dShowStandardNamespace: true (default: true)
          dShowQtNamespace: true (default: true)
          dSortStructMembers: true (default: true)
          dAutoDerefPointers: true (default: true)
          dMaximalStringLength: 10000 (default: 10000)
          dWatchdogTimeout: 20 (default: 20)
          dAutoEnrichParameters: true (default: true)
          dUseDynamicType: true (default: true)
          dTargetAsync: false (default: false)
          dWarnOnReleaseBuilds: true (default: true)
          dMultiInferior: false (default: false)
          dIntelFlavor: false (default: false)
          dIdentifyDebugInfoPackages: false (default: false)
          dCDB_Console: false (default: false)
          dBreakpointCorrection: true (default: true)
          dIgnoreFirstChanceAccessViolation: false (default: false)
          dLoadGdbInit: true (default: true)
          dLoadGdbDumpers1: true (default: true)
          dAttemptQuickStart: false (default: false)
          dGdbStartupCommands: (default: )
          dGdbPostAttachCommands: (default: )
          dAlwaysAdjustColumnWidths: true (default: true)
          dExtraDumperFile: (default: )
          dGdbCustomDumperCommands: (default: )
          dAdditionalArguments: (default: )
          dSymbolPaths: (default: )
          dSourcePaths: (default: )
          dBreakEvent: (default: )
          dBreakOnCrtDbgReport: false (default: false)
          dShowThreadNames: false (default: false)
          dUseToolTips: false (default: true) ***
          dUseToolTipsInLocalsView: false (default: false)
          dUseToolTipsInBreakpointsView: false (default: false)
          dUseToolTipsInBreakpointsView: false (default: true) ***
          dUseAddressInBreakpointsView: false (default: false)
          dUseAddressInStackView: false (default: false)
          dCloseBuffersOnExit: false (default: false)
          dSwitchModeOnExit: false (default: false)
          dBreakpointsFullPath: false (default: false)
          dRaiseOnInterrupt: true (default: true)
          dStationaryEditorWhileStepping: false (default: false)
          dUseDebuggingHelper: true (default: true)
          dUseCodeModel: true (default: true)
          dUseAlternatingRowColours: false (default: false)
          dFontSizeFollowsEditor: false (default: false)
          dUseMessageBoxForSignals: true (default: true)
          dAutoQuit: false (default: false)
          dLogTimeStamps: false (default: false)
          dVerboseLog: false (default: false)
          dState changed from DebuggerNotReady(0) to EngineSetupRequested(1) [master]
          dQUEUE: SETUP ENGINE
          dCALL: SETUP ENGINE
          dEXAMINING /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug/test_csv
          dELF SECTIONS: .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .gcc_except_table .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .data .bss .comment .debug_aranges .debug_info .debug_abbrev .debug_line .debug_str .debug_ranges .shstrtab .symtab .strtab
          dTRYING TO START ADAPTER
          @

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bobhairgrove
            wrote on 9 Nov 2014, 13:56 last edited by
            #5

            PART 2:

            @

            dENABLING TEST CASE: 0
            dSTARTING /usr/bin/gdb -i mi
            dGDB STARTED, INITIALIZING IT
            <1show version
            <2show debug-file-directory
            <3set print object on
            <4set breakpoint pending on
            <5set print elements 10000
            <6handle SIGSEGV nopass stop print
            <7set unwindonsignal on
            <8set width 0
            <9set height 0
            sSetting up inferior...
            <10set substitute-path /var/tmp/qt-src /home/bob/Qt-5.3.1/5.3/gcc_64
            <11-interpreter-exec console "set auto-solib-add on"
            <12-interpreter-exec console "python sys.path.insert(1, '/home/bob/Qt-5.3.1/Tools/QtCreator/share/qtcreator/debugger/')"
            <13-interpreter-exec console "python sys.path.append('/usr/bin/data-directory/python')"
            <14-interpreter-exec console "python from gdbbridge import *"

            =thread-group-added,id="i1"
            ~"GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04\n"
            ~"Copyright (C) 2012 Free Software Foundation, Inc.\n"
            ~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type "show copying"\nand "show warranty" for details.\n"
            ~"This GDB was configured as "x86_64-linux-gnu".\nFor bug reporting instructions, please see:\n"
            ~"http://bugs.launchpad.net/gdb-linaro/.\n"

            &"show version\n"
            ~"GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04\n"
            ~"Copyright (C) 2012 Free Software Foundation, Inc.\n"
            ~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type "show copying"\nand "show warranty" for details.\n"
            ~"This GDB was configured as "x86_64-linux-gnu".\nFor bug reporting instructions, please see:\n"
            ~"http://bugs.launchpad.net/gdb-linaro/.\n"
            1^done
            dPARSING VERSION: 1^done
            dSUPPORTED GDB VERSION GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
            dCopyright (C) 2012 Free Software Foundation, Inc.
            dLicense GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
            dThis is free software: you are free to change and redistribute it.
            dThere is NO WARRANTY, to the extent permitted by law. Type "show copying"
            dand "show warranty" for details.
            dThis GDB was configured as "x86_64-linux-gnu".
            dFor bug reporting instructions, please see:
            dhttp://bugs.launchpad.net/gdb-linaro/.
            dGNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
            dCopyright (C) 2012 Free Software Foundation, Inc.
            dLicense GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
            dThis is free software: you are free to change and redistribute it.
            dThere is NO WARRANTY, to the extent permitted by law. Type "show copying"
            dand "show warranty" for details.
            dThis GDB was configured as "x86_64-linux-gnu".
            dFor bug reporting instructions, please see:
            dhttp://bugs.launchpad.net/gdb-linaro/.
            dUSING GDB VERSION: 70400, BUILD: 2012
            <15-interpreter-exec console "set target-async off"

            &"show debug-file-directory\n"
            ~"The directory where separate debug symbols are searched for is "/usr/lib/debug".\n"
            2^done

            &"set print object on\n"
            3^done

            &"set breakpoint pending on\n"
            4^done

            &"set print elements 10000\n"
            5^done

            &"handle SIGSEGV nopass stop print\n"
            ~"Signal Stop\tPrint\tPass to program\tDescription\n"
            ~"SIGSEGV Yes\tYes\tNo\t\tSegmentation fault\n"
            6^done

            &"set unwindonsignal on\n"
            7^done

            &"set width 0\n"
            8^done

            &"set height 0\n"
            9^done

            &"set substitute-path /var/tmp/qt-src /home/bob/Qt-5.3.1/5.3/gcc_64\n"
            10^done

            11^done

            12^done

            13^done
            @

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bobhairgrove
              wrote on 9 Nov 2014, 13:57 last edited by
              #6

              PART 3:

              @
              /* ... lots snipped ...*/

              dENGINE SUCCESSFULLY STARTED
              dNOTE: ENGINE SETUP OK
              dState changed from EngineSetupRequested(1) to EngineSetupOk(3) [master]
              dQUEUE: SETUP INFERIOR
              dState changed from EngineSetupOk(3) to InferiorSetupRequested(4) [master]
              dQUEUE: SETUP INFERIOR

              15^done

              dCALL: SETUP INFERIOR
              dTaking notice of pid 4450
              Going to attach to 4450
              sSetting breakpoints...
              dSetting breakpoints...
              dATTEMPT BREAKPOINT SYNCHRONIZATION
              dTAKING OWNERSHIP OF BREAKPOINT 1 IN STATE 0
              <16-break-insert -f ""main.cpp":44"
              dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED

              &"No symbol table is loaded. Use the "file" command.\n"
              16^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"main.cpp":44",times="0",original-location="\"main.cpp":44"}
              dATTEMPT BREAKPOINT SYNCHRONIZATION
              dBREAKPOINTS ARE SYNCHRONIZED
              dALL COMMANDS DONE; INVOKING CALLBACK
              dNOTE: INFERIOR SETUP OK
              dState changed from InferiorSetupRequested(4) to InferiorSetupOk(6) [master]
              dState changed from InferiorSetupOk(6) to EngineRunRequested(7) [master]
              dQUEUE: RUN ENGINE

              dCALL: RUN ENGINE
              <17attach 4450
              dATTEMPT SYNC
              dATTEMPT BREAKPOINT SYNCHRONIZATION
              dBREAKPOINT SYNCHRONIZATION NOT POSSIBLE IN CURRENT STATE

              &"attach 4450\n"
              ~"Attaching to process 4450\n"
              =thread-group-started,id="i1",pid="4450"
              sThread group i1 created
              =thread-created,id="1",group-id="i1"
              sThread 1 created
              ~"Reading symbols from /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug/test_csv..."
              sReading /home/bob/code/Qt/test_csv/build-test_csv-Desktop_Qt_5_3_GCC_64bit-Debug/test_csv......
              ~"done.\n"
              =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000401e57",file="../test_csv/main.cpp",fullname="/home/bob/code/Qt/test_csv/test_csv/main.cpp",line="44",times="0",original-location="\\"main.cpp\":44"}
              =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
              sLibrary /lib64/ld-linux-x86-64.so.2 loaded
              ~"Reading symbols from /lib64/ld-linux-x86-64.so.2..."
              sReading /lib64/ld-linux-x86-64.so.2......
              ~"(no debugging symbols found)...done.\n"
              ~"Loaded symbols for /lib64/ld-linux-x86-64.so.2\n"
              ~"0x00007f4595d8e6b0 in ?? () from /lib64/ld-linux-x86-64.so.2\n"
              *stopped,frame={addr="0x00007f4595d8e6b0",func="??",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
              dNOTE: INFERIOR STOP OK
              sStopped.
              dState changed from EngineRunRequested(7) to InferiorStopOk(14) [master]
              <18importPlainDumpers
              sStopped.
              17^done
              @

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bobhairgrove
                wrote on 9 Nov 2014, 13:58 last edited by
                #7

                PART 4:

                @
                dINFERIOR ATTACHED
                dNOTE: ENGINE RUN AND INFERIOR STOP OK
                sStopped.
                dState changed from InferiorStopOk(14) to InferiorStopOk(14) [master]
                dNOTE: INFERIOR RUN REQUESTED
                sRun requested...
                dState changed from InferiorStopOk(14) to InferiorRunRequested(10) [master]
                sRunning requested...
                <19-exec-continue

                <20-thread-info

                &"importPlainDumpers\n"
                ~"None\n"
                18^done

                19^running
                dNOTE: INFERIOR RUN OK
                sRunning.
                dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master]
                *running,thread-id="all"
                dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.

                *stopped,reason="signal-received",signal-name="SIGSTOP",signal-meaning="Stopped (signal)",frame={addr="0x00007f4595d8e6b0",func="??",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3"
                dNOTE: INFERIOR SPONTANEOUS STOP
                sStopped.
                dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
                INTERNAL CONTINUE AFTER SIGSTOP FROM STUB
                dNOTE: INFERIOR RUN REQUESTED
                sRun requested...
                dState changed from InferiorStopOk(14) to InferiorRunRequested(10) [master]
                sRunning requested...
                <21-exec-continue

                20^done,threads=[{id="1",target-id="process 4450",name="test_csv",frame={level="0",addr="0x00007f4595d8e6b0",func="??",args=[],from="/lib64/ld-linux-x86-64.so.2"},state="stopped",core="3"}],current-thread-id="1"
                <22-stack-list-frames 0 20

                21^running
                dNOTE: INFERIOR RUN OK
                sRunning.
                dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master]
                *running,thread-id="all"
                dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.

                *stopped,reason="signal-received",signal-name="SIGSTOP",signal-meaning="Stopped (signal)",frame={addr="0x00007f4595d8e6b0",func="??",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="2"
                dNOTE: INFERIOR SPONTANEOUS STOP
                sStopped.
                dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
                INTERNAL CONTINUE AFTER SIGSTOP FROM STUB
                dNOTE: INFERIOR RUN REQUESTED
                sRun requested...
                dState changed from InferiorStopOk(14) to InferiorRunRequested(10) [master]
                sRunning requested...
                <23-exec-continue

                22^done,stack=[frame={level="0",addr="0x00007f4595d8e6b0",func="??",from="/lib64/ld-linux-x86-64.so.2"},frame={level="1",addr="0x0000000000000001",func="??"},frame={level="2",addr="0x00007fffe26fa9b4",func="??"},frame={level="3",addr="0x0000000000000000",func="??"}]

                23^running
                dNOTE: INFERIOR RUN OK
                sRunning.
                dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master]
                *running,thread-id="all"
                dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.

                =library-loaded,id="/usr/local/lib64/libstdc++.so.6",target-name="/usr/local/lib64/libstdc++.so.6",host-name="/usr/local/lib64/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
                sLibrary /usr/local/lib64/libstdc++.so.6 loaded
                =library-loaded,id="/lib/x86_64-linux-gnu/libm.so.6",target-name="/lib/x86_64-linux-gnu/libm.so.6",host-name="/lib/x86_64-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
                sLibrary /lib/x86_64-linux-gnu/libm.so.6 loaded
                =library-loaded,id="/usr/local/lib64/libgcc_s.so.1",target-name="/usr/local/lib64/libgcc_s.so.1",host-name="/usr/local/lib64/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
                sLibrary /usr/local/lib64/libgcc_s.so.1 loaded
                =library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1"
                sLibrary /lib/x86_64-linux-gnu/libc.so.6 loaded

                =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000401e57",file="../test_csv/main.cpp",fullname="/home/bob/code/Qt/test_csv/test_csv/main.cpp",line="44",times="1",original-location="\\"main.cpp\":44"}
                *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000401e57",func="main",args=[],file="../test_csv/main.cpp",fullname="/home/bob/code/Qt/test_csv/test_csv/main.cpp",line="44"},thread-id="1",stopped-threads="all",core="4"
                dNOTE: INFERIOR SPONTANEOUS STOP
                sStopped.
                dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
                sStopped at breakpoint 1 (1) in thread 1.

                <24-thread-info

                24^done,threads=[{id="1",target-id="process 4450",name="test_csv",frame={level="0",addr="0x0000000000401e57",func="main",args=[],file="../test_csv/main.cpp",fullname="/home/bob/code/Qt/test_csv/test_csv/main.cpp",line="44"},state="stopped",core="4"}],current-thread-id="1"
                <25-stack-list-frames 0 20

                25^done,stack=[frame={level="0",addr="0x0000000000401e57",func="main",file="../test_csv/main.cpp",fullname="/home/bob/code/Qt/test_csv/test_csv/main.cpp",line="44"}]
                <26-stack-select-frame 0
                <27bb options:fancy,autoderef,dyntype vars: expanded:local,return,watch,inspect typeformats: formats: watchers: stringcutoff:10000 displaystringlimit:100

                26^done

                &"bb options:fancy,autoderef,dyntype vars: expanded:local,return,watch,inspect typeformats: formats: watchers: stringcutoff:10000 displaystringlimit:100\n"
                ~"data=[],typeinfo=[]\n"
                ~"None\n"
                27^done
                <Rebuild Watchmodel 1>
                sFinished retrieving data

                @

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bobhairgrove
                  wrote on 9 Nov 2014, 14:04 last edited by
                  #8

                  This bit in the above output:

                  @GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04\n"@

                  is strange, because when I run GDB from the console, I get this:

                  @GNU gdb (GDB) 7.8.1
                  Copyright (C) 2014 Free Software Foundation, Inc.
                  (etc.)
                  @

                  I have two versions of GDB installed, one in /usr/bin and the other in /usr/local/bin. Both GDB's give me 7.8.1 when I run them from the terminal.

                  Hmmm...

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bobhairgrove
                    wrote on 9 Nov 2014, 14:20 last edited by
                    #9

                    OK ... I went to the Projects view, clicked on "Build & Run", then "Manage Kits", cloned the auto-detected "Desktop Qt 5.3" kit, then made sure that the GDB in /usr/local/bin was selected, then clicked on "Make Default" at the right.

                    BINGO!! :))

                    Now everything is working as it should, and I see 7.8.1 for the GDB version in the debugging output at the top.

                    1 Reply Last reply
                    1

                    1/9

                    9 Nov 2014, 10:48

                    • Login

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