How can I see the content of char readline[16] when debugging in QtCreator C++? [SOLVED]
-
-
I recommend you read the "documentation.":http://doc.qt.nokia.com/qtcreator-snapshot/creator-debug-mode.html#locals-and-expressions
Qt Creator allow you interact with variables.
BR,
-
Just set a breakpoint at the line of interest. The "locals and expressions" tab of the debugger lists all variables in the current method, including the this pointer. Your readline variable should show up there. It also should have a + signe or a triangle the left, you can expand it and it shows you the contents of the array then. If you use a char * instead, it is treated as a string and the string is displayed directly.
Find more infos about the debugger in the "respective section":http://doc.qt.nokia.com/qtcreator-2.4/creator-debugging.html of the "Qt Creator Manual":http://doc.qt.nokia.com/qtcreator-2.4/index.html.
-
If it was that easy I wouldn't be posting this question here :)
In Locals and Expressions window I do have readline variable, it has a triangle, but if I click on it, it expands just nothing. I took a screenshot but I do not see how to post it here.
[quote author="Volker" date="1327698555"]Just set a breakpoint at the line of interest. The "locals and expressions" tab of the debugger lists all variables in the current method, including the this pointer. Your readline variable should show up there. It also should have a + signe or a triangle the left, you can expand it and it shows you the contents of the array then. If you use a char * instead, it is treated as a string and the string is displayed directly.
Find more infos about the debugger in the "respective section":http://doc.qt.nokia.com/qtcreator-2.4/creator-debugging.html of the "Qt Creator Manual":http://doc.qt.nokia.com/qtcreator-2.4/index.html.[/quote]
-
On DevNet, you cannot uplaod images directly. Just use a storage provider of your choice (dropbox, flickr, picasaweb, etc. are popular).
In my case, if I just put a
@
char rl[16];
@The debugger shows this (I'm using Creator 2.4 on a Mac):
!http://qdn.berlinbikerx.de/Creator-Debugger-char-array.png!
-
ah, good catch. However it's still a bug if it's not resolvable through some sort of setting.
So, if I declare it the following way then I cannot see the content:
int MAXLINE = 1024;
char sendline[MAXLINE], recvline[MAXLINE];It shows the variable if I declare:
char sendline [1024], recvline [1024];Any ideas how to resolve it?
-
I'm not 100% sure here, but I would say that allocating a static array on the stack using dynamically calculated array size, i.e. putting a variable between the brackets, is not supported by all compilers. But that's a topic for the "C++ Gurus Forum":/forums/viewforum/36/
Regarding Qt Creator: I would guess that it's plain just not supported here. The code model would need to know the size of the array, but that is only calculated during runtime. Creator would have to evaluate the value of the MAXLINE variable and use that for the display of the array.