[摘]gdb查看QString类型变量
来源:互联网 发布:儿童发音矫正软件 编辑:程序博客网 时间:2024/05/18 23:54
GDBsupports the command
WhenGDB starts it reads in the file
Examplesession:
(gdb) print myString $2 = {static null = {<No datafields>}, static shared_null = {ref = {atomic = 39},alloc = 0, size = 0, data = 0x82174ca, clean = 0, simpletext = 0,righttoleft = 0, asciiCache = 0, reserved = 0, array = {0}}, staticshared_empty = {ref = {atomic = 1}, alloc = 0, size = 0, data =0xf5f71aca, clean = 0, simpletext = 0, righttoleft = 0, asciiCache= 0, reserved = 0, array = {0}}, d = 0x8260b48, staticcodecForCStrings = 0x0}(gdb) printqstring myString(QString)0x8217658 (length=26): "this is an example QString"(gdb)
As yousee above,
Theform
Thismacro was posted by David Faure to the KDE maillist in 2001:
define printqstring set $i=0 while $i <$arg0.d->len print$arg0.d->unicode[$i++].cl endend
Italready prints out each character of the QString onto a singleline.
A muchrefined version was posted by Arnaud de Muyser to the qt-interestlist the same year:
define ps
end
Qt4.x
Theinternal representation of QString changed for Qt 4.x: the lengthis now stored in d->size and it uses UCS-16 insteadof UTF-8 for internal storage. The fact that QStrings are nowimplicitly shared does not matter in this context though.
So thisis my adapted version of the macro:
define printqstring printf "(QString)0x%x (length=%i):"",&$arg0,$arg0.d->size set $i=0while $i < $arg0.d->size set$c=$arg0.d->data[$i++] if $c < 32 ||$c > 127 printf "\\u0xx", $c else printf "%c",(char)$c end end printf ""\n" end- [摘]gdb查看QString类型变量
- [摘]gdb查看QString类型变量
- GDB查看变量
- GDB查看变量
- GDB查看变量
- GDB查看变量
- GDB查看变量
- GDB查看变量
- GDB查看变量
- gdb脚本 - 查看stl变量
- gdb 查看变量和内存
- gdb 局部变量无法查看
- 查看变量类型
- python查看变量类型
- 用gdb 来查看结构体类型
- 查看一个变量的类型
- 在gdb中打印QString
- 在GDB中查看Unicode文本变量内容(wchar_t*)
- [转] Android开发环境搭建全程演示…
- Android SDK & Android NDK 官方下…
- QImage实现图片间渐变切换
- [转]Qt-Embedded 4 install
- sourceinsight常用宏
- [摘]gdb查看QString类型变量
- [转]无线网络
- Qt屏幕截屏
- [转] Qt,Qt-Embedded, Qtopia你…
- [转]QtEmbedded/Qtopia FAQ
- Qt contextMenu的创建和使用
- singleton modle.(单件模式 / 单态…
- [转]堆、栈及静态数据区详解
- [转] C/S结构与B/S结构的特点分析