From: Fredrik Tolf <fredrik@dolda2000.com>
To: gdb@sourceware.org
Subject: Bad performance in updating JIT debug symbols
Date: Sat, 17 Sep 2016 17:25:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.11.1609171917150.2866@shack.dolda2000.com> (raw)
Dear list,
I'm currently developing a library that uses LLVM to JIT-compile code into
the running process every now and then. It happens fairly often, but in
completely independent batches, so I'm racking up a fair number of LLVM
modules, usually in the thousands, but at the very least in the hundreds.
Whenever a new module is compiled, LLVM uses GDB's JIT-compiler interface
to register the debug symbols for the module, which is pretty nice, but as
the modules pile up, this is becoming very slow. In the end, it starts
taking multiples of tens of milliseconds per new module, and since they
usually come in several at once, GDB starts causing delays of a second or
longer, which is pretty annoying when debugging.
Debugging GDB in the process, it appears that it's stuck in the sorting
phase of update_section_map(), and the place where it's spending all the
time is the part of qsort_cmp() which, according to the comments, "could
be slow (since we iterate over all objfiles in each call to qsort_cmp),
but this shouldn't happen very often (GDB is already in a confused state;
one hopes this doesn't happen at all)."
Which obviously raises the question why it happens at all. I haven't
decoded enough of GDB's source code yet to tell what it's really trying to
do, but the reason for the slowness appears to be related to how the code
and debug sections are organized together, so I'm wondering if this should
be considered a bug in LLVM for organizing them incorrectly.
Thoughts?
--
Fredrik Tolf
next reply other threads:[~2016-09-17 17:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-17 17:25 Fredrik Tolf [this message]
[not found] ` <F4715250-E24B-452E-9232-2469AB2EB2B2@duaneellis.com>
2016-09-17 18:43 ` Fredrik Tolf
2016-09-18 13:55 ` Yichao Yu
2016-09-19 15:10 ` Pedro Alves
2016-09-19 15:45 ` Yichao Yu
2016-09-20 2:20 ` Fredrik Tolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.11.1609171917150.2866@shack.dolda2000.com \
--to=fredrik@dolda2000.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox