public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time
@ 2023-11-29 12:27 thomas at mitterfellner dot at
  2023-11-29 16:43 ` [Bug breakpoints/31095] " simark at simark dot ca
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: thomas at mitterfellner dot at @ 2023-11-29 12:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

            Bug ID: 31095
           Summary: Setting a breakpoint in a C++ header file takes a long
                    time
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: thomas at mitterfellner dot at
  Target Milestone: ---

I noticed that setting a breakpoint in a C++ header file (e.g. for a method
that only performs member initialization) using gdb 13.2 takes quite a long
time (>30 s). The project I experienced this in has ~800 cpp and ~1000 hpp
files.
Setting a breakpoint in a cpp file, on the other hand, is performed with no
noticable delay.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
@ 2023-11-29 16:43 ` simark at simark dot ca
  2023-11-29 17:51 ` thomas at mitterfellner dot at
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simark at simark dot ca @ 2023-11-29 16:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Is this a regression, was it better with a previous GDB version?

I presume that this header is included in many .cpp files, and that setting the
breakpoint causes many symtabs to be expanded.  How do you set your breakpoint?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
  2023-11-29 16:43 ` [Bug breakpoints/31095] " simark at simark dot ca
@ 2023-11-29 17:51 ` thomas at mitterfellner dot at
  2023-11-29 19:18 ` simark at simark dot ca
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: thomas at mitterfellner dot at @ 2023-11-29 17:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

--- Comment #2 from Thomas <thomas at mitterfellner dot at> ---
I know I've experienced this behavior in versions prior to 13
2 (definitely in 13.1 too).

I've been setting the breakpoints in VS Code (usually many of them, most in cpp
files, though, so it wasn't obvious to me that the breakpoints in the header
files are causing the delay). When I actually start the debugging session, I
see in the console that gdb starts quickly but then it takes a long time for
the program to be debugged to start (the breakpoints in the main routine to be
reached).

When I had found out the cause of the delay by chance, I tried this from a
command line gdb session. At the prompt, I set a breakpoint via

b file.hpp:<line no.>

and as soon as I hit Enter, there's a delay before I get the next prompt. I
cross-checked in a new session; when I do

b file.cpp:<line no.>

and hit Enter, I immediately get a new prompt.

Regarding the number of files the headers are included from: I have to check
that separately (but I think it's not too many).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
  2023-11-29 16:43 ` [Bug breakpoints/31095] " simark at simark dot ca
  2023-11-29 17:51 ` thomas at mitterfellner dot at
@ 2023-11-29 19:18 ` simark at simark dot ca
  2023-11-29 19:57 ` thomas at mitterfellner dot at
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simark at simark dot ca @ 2023-11-29 19:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

--- Comment #3 from Simon Marchi <simark at simark dot ca> ---
Ok, thanks.  By any chance, is the project you are working on is open source? 
If so, could you provide some steps to build it so we can reproduce?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
                   ` (2 preceding siblings ...)
  2023-11-29 19:18 ` simark at simark dot ca
@ 2023-11-29 19:57 ` thomas at mitterfellner dot at
  2023-11-30 17:00 ` tromey at sourceware dot org
  2023-12-11 15:35 ` thomas at mitterfellner dot at
  5 siblings, 0 replies; 7+ messages in thread
From: thomas at mitterfellner dot at @ 2023-11-29 19:57 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

--- Comment #4 from Thomas <thomas at mitterfellner dot at> ---
Unfortunately, it's proprietary, but I'll try to reproduce it with an open
source project (I'm thinking of Inkscape or GIMP). It may take a while until I
find the time, though.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
                   ` (3 preceding siblings ...)
  2023-11-29 19:57 ` thomas at mitterfellner dot at
@ 2023-11-30 17:00 ` tromey at sourceware dot org
  2023-12-11 15:35 ` thomas at mitterfellner dot at
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2023-11-30 17:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
The usual issue is too much CU expansion.
Sometimes this is unavoidable, like if the breakpoint is
in an inline function that has been inlined a lot.
When you do eventually get the breakpoint, how many locations
does it have?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug breakpoints/31095] Setting a breakpoint in a C++ header file takes a long time
  2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
                   ` (4 preceding siblings ...)
  2023-11-30 17:00 ` tromey at sourceware dot org
@ 2023-12-11 15:35 ` thomas at mitterfellner dot at
  5 siblings, 0 replies; 7+ messages in thread
From: thomas at mitterfellner dot at @ 2023-12-11 15:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31095

--- Comment #6 from Thomas <thomas at mitterfellner dot at> ---
The header is included from four header files which are in turn included in
other header files, so I guess the number of total "inclusion paths" may be
high (not sure how to actually check this without tediously following every
path).

"When you do eventually get the breakpoint, how many locations
does it have?"

What exactly do you mean by this? Is it how often I hit it?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-11 15:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 12:27 [Bug breakpoints/31095] New: Setting a breakpoint in a C++ header file takes a long time thomas at mitterfellner dot at
2023-11-29 16:43 ` [Bug breakpoints/31095] " simark at simark dot ca
2023-11-29 17:51 ` thomas at mitterfellner dot at
2023-11-29 19:18 ` simark at simark dot ca
2023-11-29 19:57 ` thomas at mitterfellner dot at
2023-11-30 17:00 ` tromey at sourceware dot org
2023-12-11 15:35 ` thomas at mitterfellner dot at

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).