简体   繁体   English

在ubuntu 12.04上无法在qt调试模式下显示变量值

[英]Can't show variable values in qt debug mode on ubuntu 12.04

I've installed qt 5.2 on ubuntu 12.04. 我在ubuntu 12.04上安装了qt 5.2。 but when I run it in the debug mode variables do not appear in locals and expressions window. 但是当我在调试模式下运行它时,变量不会出现在locals和expressions窗口中。 I tried right-clicking on the variable and clicking on add expression evaluator but nothing happens. 我尝试右键单击变量并单击添加表达式计算器,但没有任何反应。 I also tried dragging it to locals and expressions window but instead of its value it puts in value column and the type column is left empty. 我也尝试将它拖动到本地和表达式窗口,但它的值不是它放在值列中,而类型列是空的。

Only for global variables qt shows the correct values. 仅对全局变量qt显示正确的值。

I tried the same version of qt on a 13.10 ubuntu and it works fine. 我在13.10 ubuntu上尝试了相同版本的qt,它运行正常。 Can anyone tell me what I should do to fix this? 谁能告诉我应该怎么做才能解决这个问题?

EDIT: 编辑:

This is the compile output 这是编译输出

17:10:23: Running steps for project test1...

17:10:23: Configuration unchanged, skipping qmake step.

17:10:23: Starting: "/usr/bin/make" 

g++ -c -pipe -g -std=c++0x -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_CORE_LIB -I/opt/Qt5.2.0/5.2.0/gcc/mkspecs/linux-g++ -I../test1 -I/opt/Qt5.2.0/5.2.0/gcc/include -I/opt/Qt5.2.0/5.2.0/gcc/include/QtCore -I. -I. -o main.o ../test1/main.cpp

g++ -Wl,-rpath,/opt/Qt5.2.0/5.2.0/gcc -Wl,-rpath,/opt/Qt5.2.0/5.2.0/gcc/lib -o test1 main.o   -L/opt/Qt5.2.0/5.2.0/gcc/lib -lQt5Core -lpthread 
{ test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9][^0-9]*\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'test1' && test -f test1.gdb-index && objcopy --add-section '.gdb_index=test1.gdb-index' --set-section-flags '.gdb_index=readonly' 'test1' 'test1' && rm -f test1.gdb-index || true

17:10:24: The process "/usr/bin/make" exited normally.

17:10:24: Elapsed time: 00:01.

EDIT: 编辑:

For anyone who faces the same problem, Just as Nejat said I installed gdb 7.6 which fixed it. 对于任何面临同样问题的人,就像Nejat说我安装了gdb 7.6来修复它。

The problem is that gcc 4.8 is using a newer format for storing debugging information and you are using gdb version less than 7.5. 问题是gcc 4.8使用更新的格式来存储调试信息,而你使用的gdb版本低于7.5。 You can check your gdb version by: 您可以通过以下方式检查您的gdb版本:

gdb --version

You should upgrade your gdb to the newest version. 您应该将gdb升级到最新版本。

The same symptom can result from having a gdb that is too new, instead of too old. 使gdb太新而不是太旧会导致相同的症状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM