[Interest] spurious breakpoints in Qt Creator

André Pönitz apoenitz at t-online.de
Mon May 16 19:16:11 CEST 2022

On Mon, May 16, 2022 at 09:09:43AM +0200, Elvis Stansvik wrote:
>    Den sön 15 maj 2022 21:45Matej Košík <[1]qt at matej-kosik.net> skrev:
>      Hi,
>      While using Qt Creator, I noticed that it generates "spurious
>      breakpoints".
>      How to reproduce:
>      - I start Qt Creator
>      - I generate a new project
>        (Qt Widgets Application with QMainWindow as a base class)
>      - from the menu I choose
>        - Debug
>          - Start Debugging
>            - Start debugging of startup project
>      then the debugged project first stops in "gtk3/main.cpp" and then stops
>      in other places.
>      When I let the program continue, it then stops again in the file
>      "ico/main.cpp".
>      When I let the program continue, it then stops again in the file
>      "pdf/main.cpp".
>      I guess that I am doing something wrong, but I am unable to figure out
>      what. Any help is welcome. I would like the program to stop only in
>      breakpoints defined by me.

The cause here is the same name of 'main.cpp' for these three files and
Creator defaulting (in some cases) to setting the breakpoints by the
file name bit of the full file path in some cases instead of the full

This is intentional as practice has shown that this is more likely to
work than attempting to set the breakpoint via full path which is then
compared to a path stored in the debug info as plain, not necessarily
canonicalized string (whatever that means cross-compiler and cross-platform,
but includes the presence/absence of ../ bits, use of links and
capitalization on some file systems).

You are running here in the drawback of this approach: In case there
is some ambiguity - i.e. because your application has several main.cpp
files /and/ there is debug information available for these locations
/and/ these overlap in their line range - your breakpoint ends up
having 'multiple locations', including some you did not ask for.

You can change the approach for each breakpoint individually by
changing its path settings property from "Use Engine Default" to
"Use Full Path".


More information about the Interest mailing list