public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] gdb: Store section map in an interval tree
@ 2022-06-02 13:35 Ilya Leoshkevich
  2022-06-02 13:35 ` [PATCH 1/5] gdbsupport: Introduce obstack_newvec Ilya Leoshkevich
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Ilya Leoshkevich @ 2022-06-02 13:35 UTC (permalink / raw)
  To: Tom Tromey, Andrew Burgess, Pedro Alves
  Cc: Andreas Arnez, gdb-patches, Ilya Leoshkevich

Hi,

When debugging JITs that report ~10k sections, GDB slows to a crawl,
even with the recent optimization [1].  The problem is that the
algorithmic complexity of adding N new sections is O((N**2)*log(N)),
because the code calls update_section_map() and thus std::sort() N
times.

This series aims to reduce this to O(N*log(N)) by storing sections in
an interval tree and updating it incrementally instead of rebuilding it
every time from scratch.  The interval tree is chosen instead of
simpler alternatives in order to handle overlapping sections.

- Patch 1 introduces obstack_newvec() for allocating obj_section
  objects, which later become non-POD types.
- Patches 2-3 introduce interval tree implementation and tests for it.
- Patch 5 is the actual optimization.

The performance testing [2] results can be found here: [3].

This series survives the regtest on x86_64, power and s390x.

Best regards,
Ilya

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=625b6eae091709b95471eae92d42dc6bc71e6553
[2] https://sourceware.org/pipermail/gdb-patches/2022-May/189592.html
[3] https://github.com/iii-i/binutils-gdb/blob/section-map-20220601-2/gdb/testsuite/jit.png


Ilya Leoshkevich (5):
  gdbsupport: Introduce obstack_newvec
  gdbsupport: Introduce interval_tree
  gdbsupport: Add interval_tree unit tests
  gdbsupport: Add interval_tree fuzzing harness
  gdb: Optimize section map

 gdb/Makefile.in                         |   1 +
 gdb/objfiles.c                          | 384 +++++-----
 gdb/objfiles.h                          |  15 +-
 gdb/symfile.c                           |   2 +-
 gdb/unittests/interval_tree-selftests.c | 400 +++++++++++
 gdbsupport/gdb_obstack.h                |  26 +
 gdbsupport/interval_tree.h              | 915 ++++++++++++++++++++++++
 7 files changed, 1526 insertions(+), 217 deletions(-)
 create mode 100644 gdb/unittests/interval_tree-selftests.c
 create mode 100644 gdbsupport/interval_tree.h

-- 
2.35.3


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

end of thread, other threads:[~2022-06-02 18:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 13:35 [PATCH 0/5] gdb: Store section map in an interval tree Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 1/5] gdbsupport: Introduce obstack_newvec Ilya Leoshkevich
2022-06-02 14:31   ` Tom Tromey
2022-06-02 14:33     ` Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 2/5] gdbsupport: Introduce interval_tree Ilya Leoshkevich
2022-06-02 14:12   ` Pedro Alves
2022-06-02 14:17     ` Ilya Leoshkevich
2022-06-02 14:12   ` Pedro Alves
2022-06-02 14:37     ` Pedro Alves
2022-06-02 15:09       ` Ilya Leoshkevich
2022-06-02 18:04       ` Tom Tromey
2022-06-02 13:35 ` [PATCH 3/5] gdbsupport: Add interval_tree unit tests Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 4/5] gdbsupport: Add interval_tree fuzzing harness Ilya Leoshkevich
2022-06-02 13:35 ` [PATCH 5/5] gdb: Optimize section map Ilya Leoshkevich

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).