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

CDB is skipping breakpoints set in a static library which is used in several DLLs.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 4.8.0
    • Debugger
    • None
    • Qt Creator 4.8.0
      MSVC2017 64bit
      CDB from WDK 10.0.17763.1
    • Windows

    Description

      Overview

      QtCreator is using CDB bu command to set breakpoints. But bu command sets only one breakpoint at a time by design. This leads to a problem when user sets a breakpoint in a static library, which is used multiple times. Because CDB will set the breakpoint in only one module, instead of all, where this staic library is used.

      Example to reproduce:

      I've attached an example project, which shows the problem. Here's the structure of the project:

       

       

      Subproject File Content
      Static lib mymath.cpp
      #include "mymath.h"
      
      int sum(int a, int b)
      {
          return a + b;
      }
      Shared lib 1 mysharedlibrary_1.cpp
      #include "mysharedlibrary_1.h"
      #include "mymath.h"
      
      int sharedSum_1()
      {
          return sum(0, 2);
      }
      Shared lib 2 mysharedlibrary_2.cpp
      #include "mysharedlibrary_2.h"
      #include "mymath.h"
      
      int sharedSum_2()
      {
          return sum(0, 3);
      }
      
      Application main.cpp
      #include <QCoreApplication>
      #include <QDebug>
      
      #include "mymath.h"
      #include "mysharedlibrary_1.h"
      #include "mysharedlibrary_2.h"
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          qDebug() << "staticSum()   = " << sum(0, 1);
          qDebug() << "sharedSum_1() = " << sharedSum_1();
          qDebug() << "sharedSum_2() = " << sharedSum_2();
      
          return a.exec();
      }
      

      Everything seems to be ok, except the fact, that if want to debug Static lib's function sum and set a breakpoint inside it, the breakpoint will actually be only set in one of the DLLs.

      So, to see the problem, you need to set a breakpoint mymath.cpp::sum.

      Proposal:

      There's two ways to solve this:

      • Use CDB's bm function to set breakpoints. This is the only one which allows setting multiple breakpoints.
      • When user sets a breakpoint in file, which's compiled into a static library, collect the information, in which modules this library is used and then explicitly set brakpoint in each module.
        bu module_a!func
        bu module_b!func
        

      Attachments

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

        Activity

          People

            davschul David Schulz
            sirotin Igor Sirotin
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes