如何让Qt Creator的调试器显示C ++向量在OS X中的内容? [英] How do I make Qt Creator's debugger show the contents of C++ vectors in OS X?

查看:307
本文介绍了如何让Qt Creator的调试器显示C ++向量在OS X中的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,它大量使用向量,并在Mac OS X 10.6.6上第一次使用Qt Creator 2.0.1进行开发。



在我调试时,我可以在 Locals and Watchers 窗口中看到文字和数组,但是一旦我展开一个向量,在这种情况下学生,我得到这个树:





我正在使用的另一个人在Ubuntu上使用相同版本的Qt Creator,向量的内容很好。

这是他的调试器:



解决方案

QtCreator 2.6支持Mac FSF GDB(7.5)支持。 FSF GDB支持python,它允许qtcreator正确显示QVector,QSet,QList,QString等。它可以从macports下载。


  1. 下载和安装macport(从此处下载 http://www.macports.org/install.php

  2. 要安装FSF GDB 7.5:

      sudo port install gdb 


  3. 授予FSF GDB权限以调试应用程序:

      sudo codesign -s gdb-cert / opt / local / bin / ggdb 

    如果找不到gdb-cert,请点击下面的链接创建一个gdb-cert,并按照创建证书的说明:



    a href =http://sourceware.org/gdb/wiki/BuildingOnDarwin> http://sourceware.org/gdb/wiki/BuildingOnDarwin



    如果你不授予ggdb的权限,你会得到一个:

      id 28885:(os / kern)failure(0x5)。 
    (请检查gdb是否已签署 - 请参阅taskgated(8))


  4. 更改QtCreator中的工具包调试程序



    将路径从/ usr / bin / gdb更改为/ opt / local / bin / ggdb


  5. 默认情况下FSF GDB无法正确处理断点因为mac clang ++不导出调试符号。要导出调试符号,需要手动运行dsymutil。幸运的是,在使用qmake链接程序后,可以自动运行dysmutil命令。在.pro文件中添加以下行:

      macx {
    CONFIG(debug,debug | release){
    QMAKE_POST_LINK = dsymutil \MyApp.app/Contents/MacOS/MyApp\
    }
    }



I'm writing a program that makes extensive use of vectors and am developing with Qt Creator 2.0.1 on Mac OS X 10.6.6 for the first time.

As I am debugging, I can see literals and arrays just fine in the Locals and Watchers window, but as soon as I go to expand a vector, in this case of type Student, I get this tree:

The other person I am working with on this is using the same version of Qt Creator on Ubuntu and can see the contents of the vectors just fine. What am I doing wrong?

This is his debugger:

解决方案

QtCreator 2.6 has support for Mac FSF GDB (7.5) support. FSF GDB supports python which allows qtcreator to properly display QVector, QSet, QList, QString, etc. It can be download from macports.

  1. Download and Install macports (download it from here http://www.macports.org/install.php)
  2. To install FSF GDB 7.5:

         sudo port install gdb
    

  3. Give FSF GDB permission to debug applications:

    sudo codesign -s gdb-cert /opt/local/bin/ggdb
    

    If gdb-cert isn't found, create a gdb-cert by clicking on the link below, and follow the directions for "Creating a certificate":

    http://sourceware.org/gdb/wiki/BuildingOnDarwin

    If you don't give permission to ggdb, you'll get a:

     Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
     (please check gdb is codesigned - see taskgated(8)) 
    

  4. Change the kit debugger in QtCreator

    Change the path from /usr/bin/gdb to /opt/local/bin/ggdb

  5. By default FSF GDB fails to handle breakpoints correctly because mac clang++ doesn't export debug symbols. To export the debugging symbols, dsymutil needs to be run manually. Luckly, dysmutil command can be run automatically after link the program using qmake. Add the following lines in your .pro file:

    macx {
        CONFIG(debug, debug|release) {
            QMAKE_POST_LINK = dsymutil \"MyApp.app/Contents/MacOS/MyApp\"
        }
    }   
    

这篇关于如何让Qt Creator的调试器显示C ++向量在OS X中的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆