在Qt调试器中显示数组内容 [英] Show Array's Content in a Range in Qt Debugger

查看:615
本文介绍了在Qt调试器中显示数组内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用QT Creator调试器.当我尝试调试大型数组(即1000,000个元素)时,它挂起,试图检索整个数组的值,尽管我试图仅查看前几个元素.在KDevelop中,调试器仅显示前5个元素,然后按单击以显示另外5个元素,依此类推.

I'm using QT Creator debugger. When I try to debug a large array (i.e. 1000,000 elements), it hangs for trying to retrieve the whole array's values, though I'm trying to see the first few elements only. In KDevelop the debugger shows the first 5 elements only, then I press click to show another 5 elements and so on.

是否可以在QT Creator中执行相同的操作?

Is it possible to do the same in QT Creator?

推荐答案

答案取决于您使用的调试后端以及Qt Creator的版本.

The answer depends on the debugging backend you use, and the version of Qt Creator.

使用GDB作为调试后端,您可以从本地和表达式"视图的上下文菜单中使用添加新的表达式求值器",然后输入"{Type [100]} a"以通过a来查看项a [0]定义为类型a [100000];"的数组的[99].

With GDB as debugging backend you can use 'Add New Expression Evaluator' form the the 'Locals and Expression' view's context menu, and enter '{Type[100]}a' to see the items a[0] through a[99] of an array defined as 'Type a[100000];'.

在Qt Creator 3.2中,更简单的'a [0..100]'也可以用作表达式,而GDB和LLDB都可以作为调试后端.

In Qt Creator 3.2 the simpler 'a[0..100]' works as expression, too, with both GDB and LLDB as debugging backend.

这篇关于在Qt调试器中显示数组内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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