C++ gdb错误消息:DW_OP_reg、DW_OP_片和DW_OP_位片

C++ gdb错误消息:DW_OP_reg、DW_OP_片和DW_OP_位片,c++,debugging,qt,gdb,C++,Debugging,Qt,Gdb,我正在调试其他人的Qt程序,遇到了以下错误消息,我不明白: DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece. 我不确定这意味着什么,谷歌也帮不了什么忙 下面是上下文-sLocation是前面几行声明的QString。但是,它是从内联的函数创建的,因此我不确定它的值,并尝试在附加到之前进行检查:

我正在调试其他人的Qt程序,遇到了以下错误消息,我不明白:

DWARF-2 expression error: DW_OP_reg operations must be used either alone or in
conjuction with DW_OP_piece or DW_OP_bit_piece.
我不确定这意味着什么,谷歌也帮不了什么忙

下面是上下文-
sLocation
是前面几行声明的
QString
。但是,它是从内联的函数创建的,因此我不确定它的值,并尝试在附加到之前进行检查:

(gdb) printqstring suffix
(QString)0xffffbd80: "sorted"
(gdb) next
1241        sLocation += suffix;
(gdb) printqstring sLocation
Can't take address of "sLocation" which isn't an lvalue.
(gdb) info local
sLocation = <error reading variable sLocation (DWARF-2 expression error:
    DW_OP_reg operations must be used either alone or in conjuction with
    DW_OP_piece or DW_OP_bit_piece.)>
(gdb)printqstring后缀
(QString)0xffffbd80:“已排序”
(gdb)下一步
1241 sLocation+=后缀;
(gdb)打印字符串位置
不能接受不是左值的“sLocation”地址。
(gdb)本地信息
位置=

有人能解释一下该错误消息的含义或原因吗?

该错误消息意味着
GDB
正在从可执行文件读取
DWARF2
调试信息,并拒绝该信息,认为该信息无效(不遵循
DWARF2
标准)

无效信息可能是由于GCC中的错误造成的,在SVN版本147187中已修复:

2009-05-06  Jakub Jelinek  <jakub@redhat.com>

    * dwarf2out.c (new_reg_loc_descr): Don't ever create DW_OP_regX.
    (one_reg_loc_descriptor): Create DW_OP_regX here instead of calling
    new_reg_loc_descr.
    (loc_by_reference): If loc is DW_OP_regX, change it into DW_OP_bregX 0
    instead of appending DW_OP_deref*.
2009-05-06雅库布·杰利内克
*dwarf2out.c(new_reg_loc_descr):永远不要创建DW_OP_regX。
(一个_reg_loc_描述符):在此处创建DW_OP_regX,而不是调用
新注册位置描述。
(loc_by_reference):如果loc是DW_OP_regX,则将其更改为DW_OP_bregX 0
而不是附加DW_OP_deref*。

我在运行Ubuntu 10.10 64位时遇到了同样的问题。然而,同样的代码在10.04 LTS 32位上可以完美地工作

这是两种设置的版本输出 Ubuntu 10.10:

$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
10.04 LTS上的通用条款:

$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5
干杯,
安德烈

在IRC的帮助下,我能够使用
readelf-wi/path/to/debug/lib
来识别违规条目:
2字节块:536(DW_OP_reg3;DW_OP_deref)。
但是,我正在使用r158895中标记的gcc-4.4.4,因此我认为这可能是一个新的或相关的错误。我在
GNU gdb(gdb)上看到了相同的错误7.4.1-debian
gcc版本4.7.2(debian 4.7.2-5)