I am using KDevelop
as IDE for my C++
program. I have an array char buffer[1024]
in my program. 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
. Is there some way by which I can get the content of the array at a stretch?
Asked
Active
Viewed 2,717 times
8

Ciro Santilli OurBigBook.com
- 347,512
- 102
- 1,199
- 985

Jackzz
- 1,417
- 4
- 24
- 53
2 Answers
4
Use GDB tool view available in KDevelop. In KDevelop 4.6, Window->Add ToolView->GDB
will open the GDB
tool view at the bottom/left/right of KDevelop IDE
. 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
. The value of variable will be printed.
Some example commands:
Show an array (will show first 200 elements by default):
(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:
(gdb) print buffer[50]@40
print buffer[50]@40
$2 = "23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY"
-
GDB tool view?? Where will I get it from? – Jackzz Jun 12 '15 at 04:20
-
OH!! GOT IT..THANKYOU – Jackzz Jun 12 '15 at 04:26
-
Oops!! it prints only first 200 characters even if i give print buffer[0]@250 :( – Jackzz Jun 12 '15 at 05:04
-
@Jackz I guess GDB puts that limitation, you may want to dig into GDB docs if there is any way to turn off / extend the limit. Please share if you find something interesting. – doqtor Jun 12 '15 at 09:15
-
2Ya.. I got it from here: http://stackoverflow.com/questions/233328/how-do-i-print-the-full-value-of-a-long-string-in-gdb/233339#233339 – Jackzz Jun 12 '15 at 09:19
0
There's the Variables
tool view.
Show it by right clicking left, right or bottom border of KDevelop's window and click Variables

FireFragment
- 596
- 1
- 4
- 15