Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22135

GDB pretty printer output containing quotes breaks displayed values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.9.0-beta2
    • Qt Creator 4.10.0-beta1
    • Debugger
    • None
    • Debian testing, Qt Creator self-built from master branch (as of commit bc7134dce5260717c2261030f6251fed9d099c0e)
    • Linux/X11
    • b29296e9e0265b9b9d6d0b17fa2b91408943a967 (qt-creator/qt-creator/4.9)

    Description

      When using system GDB pretty printers, variable values are not properly shown in case the pretty printers return values that contain double quotes (`"`).

      Attached is a simple example project to reproduce the issue.

       

      To reproduce:

      1) make sure that the use of system GDB pretty printers is enabled at "Tools" -> "Options" -> "Debugger" -> "GDB" -> "Load system GDB pretty printers"

      2) set up a project for the C++ file in the attached archive

        * e.g. extract the archive containing the project and run 'make' to create the binary; then use the "Custem Executable" run configuration in Qt Creator

        * alternatively: configure the use of another build system for the *.cpp file

      3) set a breakpoint at the end of the main function (line 20 in 'test.cpp')

      4) start debugging

      5) when the breakpoint has been reached: check what Qt Creator displays as values for the variables 'first' and 'second' in the variable pane

      Result:

      • `My class object (name: ` is shown for both variables

      Expected result:

      • `My class object (name: ""Hello"")` should be shown for `first`
      • `My class object (name: ""Bye"")` should be shown for `second`

       

      Apparently, Qt Creator has issues with the quote returned in the 'to_string' function of the Python GDB pretty printer 'MyClassPrinter' and does not print any characters following it.

       

      Further notes:

      • When enabling the "Debugger Log" and manually printing the variables (using 'p first' and 'p second') there, the values are properly shown.
      • It may be necessary to either adapt the path from where GDB automatically loads files ('add-auto-load-safe-path </path/to/project/directory') or manually source the 'test-gdb.py' file for the pretty printer to actually be used.
      • The real world example where the issue was encountered was in LibreOffice's GDB pretty printers.

      Attachments

        Activity

          People

            hjk hjk
            michaelweghorn Michael Weghorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: