There has been a lot of work on printers this week but

GDB/MI

GDB MI allows applications to connect to GDB without actually running it from the terminal, this is how frontends talks to GDB. Most of the time this is how users actually use GDB for debugging.

Children and to_string

GDB has two ways for returning pretty printing values, as children or as to_string. children method returns a tuple of two values, the name and the value ie. ('name', value). to_string returns a string or a gdb.Value, you can read up more on that here. some printers return to_string, children or both to give relevant debugging information. For example for a double would return a to_string value and std::vector would return to_string to show how many items are in the vector and children’s value to print the items in the vector.

Printing children and to_string

Currently in GDB/MI, if the pretty-printer has a children method, it ignores the value of the to_string a only shows the children. for example you have the below code

    QStringList alist {"this", "is", "a", "stringlist", "!"};

in gdb cli it would be

    (gdb) print alist 
    $1 = <5 items> = {"this", "is", "a", "stringlist", "!"}

in GDB MI it would be

   -var-create - * "alist"

and the IDE would show something like this. gdb_mi_IDE_variable

this is a current limitation of GDB/MI but the its still usable, however a bug report has been filed. the problem comes when both the to_string and children valuables are needed. The current workaround is to repeat the value in the to_string in the children method. so if you have a QStringRef

    QString string{"this is a string"};
	QStringRef aref(&string, 10 , 6);


    //GDB CLI
    (gdb) print aref 

    $1 = string = {"this is a string", 0x7ffff4fe9b70 "string", 10, 6}

in a IDE it would be

gdbmi_var_qstrref

Python 2

All the printers has been ported to python2

New Printers

Fixes

  • print python string correctly

    GDB cannot show a python string as a string instead it shows it as a char array. the only way to get it to print as a string is to convert it to a char pointer, however this would add the memory address in front of the value.

  • format qtime in python2