[Bug breakpoints/33352] New: Slow line breakpoint resolve in a widely used template function

dmitry.neverov at jetbrains dot com sourceware-bugzilla@sourceware.org
Mon Sep 1 12:00:50 GMT 2025


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

            Bug ID: 33352
           Summary: Slow line breakpoint resolve in a widely used template
                    function
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: dmitry.neverov at jetbrains dot com
  Target Milestone: ---

To reproduce, run gdb with and without a breakpoint in a template function,
e.g. in std::vector::push_back.

For example, if I debug lldb (just as an example of a large executable which
uses std::vector a lot) and add a breakpoint in its entry point, the breakpoint
is reached in ~8 seconds:

$ gdb \
-ex "shell date" \
-ex "file /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb" \
-ex "b /home/nd/w/llvm/lldb/tools/driver/Driver.cpp:730" \
-ex "run" \
-ex "shell date" 
GNU gdb (GDB) 17.0.50.20250830-git
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Mon Sep  1 01:34:43 PM CEST 2025
Reading symbols from /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb...
Breakpoint 1 at 0x18184: file /home/nd/w/llvm/lldb/tools/driver/Driver.cpp,
line 730.
Starting program: /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0x7fffffffddb8) at
/home/nd/w/llvm/lldb/tools/driver/Driver.cpp:730
730       std::setlocale(LC_ALL, "");
Mon Sep  1 01:34:51 PM CEST 2025
(gdb) 


If I add a line breakpoint in std::vector::push_back, it takes ~8m30s:

$ gdb \
-ex "shell date" \
-ex "file /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb" \
-ex "b /home/nd/w/llvm/lldb/tools/driver/Driver.cpp:730" \
-ex "b /usr/include/c++/13/bits/stl_vector.h:1286" \
-ex "run" \
-ex "shell date" 
GNU gdb (GDB) 17.0.50.20250830-git
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Mon Sep  1 01:35:57 PM CEST 2025
Reading symbols from /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb...
Breakpoint 1 at 0x18184: file /home/nd/w/llvm/lldb/tools/driver/Driver.cpp,
line 730.
Breakpoint 2 at 0x3c6fc: /usr/include/c++/13/bits/stl_vector.h:1286. (8
locations)
Starting program: /home/nd/w/llvm/llvm/cmake-build-debug/bin/lldb 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 2.9, std::vector<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > >::push_back (
    this=0x7ffff7ca7fb0 <llvm::DebugCounter::instance()::O+80>, __x=...) at
/usr/include/c++/13/bits/stl_vector.h:1286
1286                _Alloc_traits::construct(this->_M_impl,
this->_M_impl._M_finish,
Mon Sep  1 01:44:38 PM CEST 2025
(gdb) 


Most of this time gdb spends loding full debug info of the CUs which include
std::vector on the main thread (worker threads are idle).

I wonder if the line breakpoint can be resolved without reading full debug
info?
Or maybe it is possible to process CUs in parallel?

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


More information about the Gdb-prs mailing list