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

GDB system pretty printers for new objfiles not available

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 5.0.0-beta1
    • Qt Creator 4.15.0-beta1
    • Debugger
    • None
    • Debian testing, Qt Creator built from master branch (as of commit 9e2c6fbfca99b8a1e2eccbe76a0715a2070cbf4c), GDB 10.1-1.7
    • Linux/X11
    • fd9ca07a11b1fd24cac58f1c7629e05ca8441614

    Description

      GDB system pretty printers don't work if they are declared in autoloaded Python scripts and the objfiles are loaded dynamically. An example to reproduce is this scenario including the rr debugger.

      Steps to reproduce:

      1. in GDB settings ("Tools" -> "Options" -> "Debugger" -> "GDB", set these settings:
        1. enable "Load system GDB pretty printers"
        2. set these additional startup commands:
          1. set auto-load safe-path /
            set sysroot /
            set solib-search-path /tmp/gdb-pretty-printer-objfile-sample/
            
      1. extract the attached sample project "gdb-pretty-printer-objfile-sample.zip" into /tmp/ and change into the directory /tmp/gdb-pretty-printer-objfile-sample
      2. build using bear, so that a compile_commands.json is created:
        1. bear -- make
          
      1. record a run of the test program using rr
        1. rr record ./test
          
      1. replay using rr (providing debugging server to connect to later):
        1. rr replay -s 50505 -k
          
      1. load the project into Qt Creator using the compile_commands.json file created in step 3 (experimental CompilationDatabaseProjectManager" plugin must be enabled)
      2. set breakpoint in line 5 of py-autoloaded-pretty-printers-in-newobjfile-event-main.cc (return statement)
      3. start debugging by connecting to the debugging server provided by rr/gdb (s. step 5):
        1. "Debug" -> "Start debugging" -> "Attach to running debug server"
        2. in the dialog, make sure that these are set:
          1. Server port: 50505
          2. executable: /tmp/gdb-pretty-printer-objfile-sample/test
        3. press OK
      4. check how value for variable "test" is displayed in the locals view when reaching the breakpoint

      Actual result: just a pointer value is shown

      Expected result: The value as printed by the pretty-printed should be used, as is the case when directly running the program in GDB (i.e. not with rr and the debug server) or when using plain GDB instead of Qt Creator: "MyClassTestLib object, id: 1"

      Plain GDB:

       

      (gdb) p test
      $1 = "MyClassTestLib object, id: 1"
      

       

       

      Further information: I have analyzed this a bit, will add more information in follow-up comments.

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes