[英]How to view values of variables in KDevelop?
I am using KDevelop
as IDE for my C++
program.我使用
KDevelop
作为我的C++
程序的 IDE。 I have an array char buffer[1024]
in my program.我的程序中有一个数组
char buffer[1024]
。 After reading data to buffer, I would like to check it manually.将数据读取到缓冲区后,我想手动检查它。 But in the left panel, I need to read the array
character by character
.但是在左侧面板中,我需要
character by character
读取数组。 Is there some way by which I can get the content of the array at a stretch?有什么方法可以一次性获取数组的内容吗?
Use GDB tool view available in KDevelop. 使用KDevelop中可用的GDB工具视图。 In KDevelop 4.6,
Window->Add ToolView->GDB
will open the GDB
tool view at the bottom/left/right of KDevelop IDE
. 在KDevelop 4.6中,
Window->Add ToolView->GDB
将在KDevelop IDE
的底部/左侧/右侧打开GDB
工具视图。 Debug your program and at the point at which you have to check value of the variable, enter print variable_name
in the textbox corresponding to GDB cmd
. 调试程序,然后在必须检查变量值的位置,在与
GDB cmd
对应的文本框中输入print variable_name
。 The value of variable will be printed. 变量的值将被打印。
Some example commands: 一些示例命令:
Show an array (will show first 200 elements by default): 显示一个数组(默认情况下将显示前200个元素):
(gdb) print buffer
print buffer
$1 = "\000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307"...
Show an array range buffer[index]@count: 显示数组范围缓冲区[index] @count:
(gdb) print buffer[50]@40
print buffer[50]@40
$2 = "23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY"
There's the Variables
tool view.有
Variables
工具视图。
Show it by right clicking left, right or bottom border of KDevelop's window and click Variables
通过右键单击 KDevelop 窗口的左、右或下边框并单击
Variables
来显示它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.