Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.13.0-beta1
-
None
-
Debian GNU/Linux testing
-
-
70c4889ac9a0d75c93809dd5bb321fcb2272a202 (qt-creator/qt-creator/master)
Description
Qt Creator nicely shows a text representation for variable values of type const char* (and similar) in its locals and expressions view. However, this is not the case for variables of type const gchar* (where gchar is a typedef for char in GLib) or other typedefs for various character types.
Sample program:
// compile: // g++ -g -O0 $(pkg-config --cflags glib-2.0) gchar_sample.cxx #include <iostream> #include <glib-2.0/glib.h> typedef char mychar; int main() { const char *str = "hello"; const gchar *gstr = str; const mychar *mystr = str; std::cout << str << ", " << gstr << ", " << mystr << std::endl; return 0; };
Steps to reproduce:
- set up a project in Qt Creator using above sample program
- set breakpoint at the line "return 0"
- start debugging
- check value displayed for the local variables
Result:
- str is shown as "hello" (OK)
- For gstr, it only shows
- the pointer's address if option "Dereference pointers automatically" is disabled)
- type gchar and value "h" if option "Dereference pointers automatically" is enabled
- same for mystr
Expected result:
The text representation "hello" should be used for all three local variables, just like e.g. command line GDB also does it:
Breakpoint 1, main () at gchar_sample.cxx:19 19 (gdb) p str $1 = 0x555555556005 "hello" (gdb) p gstr $2 = (const gchar *) 0x555555556005 "hello" (gdb) p mystr $3 = (const mychar *) 0x555555556005 "hello"
Notes:
I plan to submit a patch to Gerrit that improves this.