在“使用调试信息发布”中创建Qt模式? [英] Build Qt in "Release with Debug Info" mode?

查看:155
本文介绍了在“使用调试信息发布”中创建Qt模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来构建Qt在发布与调试信息模式?我的应用程序崩溃只有在释放模式(工作正常在调试模式),似乎问题来自Qt(可能是一个错误Qt)。我想看到Qt的调试信息。



Qt文档具有debug



我的应用程序工作原理



只有在VSC ++ 64Bit版本上崩溃



任何提示?

解决方案

我们使用qmake生成vcproj文件来构建Qt。我写了一个python脚本(但是sed也很好)更改vcproj文件以在版本中使用调试信息。



调试信息对堆栈确实是无价的



以下是相关的片段:

  for root,dirs,os.walk中的文件(qt_build_dir):
for f in files:
如果不是f.endswith('。vcproj'):
continue

output = []
with open(pj(root,f),'r')as file:
for line in file.readlines():
line = line.strip()
if'DebugInformationFormat =0'line:
output.append('\t\t\t\tDebugInformationFormat =3')
elif'GenerateDebugInformation =false'== line:
output.append('\t\t\t\tGenerateDebugInformation =true')
else:
output.append(line)

with open(pj(root,f),'w')as file:
file.write('\\\
'.join输出))


Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt.

Qt docs has "debug" , "release" but not "release with debug" mode.

[Upate]

My application works fine with Mingw 32bit Release/Debug and VSC++ Compiler 64bit Debug.

Only crashes on VSC++ 64Bit Release

Any tips ?

解决方案

We use qmake to generate vcproj files to build Qt. I wrote a python script (but sed is fine too) to change the vcproj-files to build with debug information in release too.

Having debug info is indeed invaluable for stack traces that go back and forth between Qt and our app.

Here's the relevant snippet:

for root, dirs, files in os.walk( qt_build_dir ):
    for f in files:
      if not f.endswith('.vcproj'):
          continue

      output = []
      with open(pj(root, f), 'r') as file:
          for line in file.readlines():
              line = line.strip()
              if 'DebugInformationFormat="0"' == line:
                  output.append('\t\t\t\tDebugInformationFormat="3"')
              elif 'GenerateDebugInformation="false"' == line:
                  output.append('\t\t\t\tGenerateDebugInformation="true"')
              else:
                  output.append(line)

      with open(pj(root, f), 'w') as file:
          file.write('\n'.join(output))

这篇关于在“使用调试信息发布”中创建Qt模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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