Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yichao Yu <yyc1992@gmail.com>
Cc: gdb@sourceware.org, Paul Pluzhnikov <ppluzhnikov@google.com>
Subject: Re: JIT debugging (Attach and speed)
Date: Wed, 23 Mar 2016 18:24:00 -0000	[thread overview]
Message-ID: <56F2DF69.9030908@redhat.com> (raw)
In-Reply-To: <CAMvDr+Ra3yi465XBcJR=oYtOM8+-=1Hj2xs32n-wYVpiN_exUQ@mail.gmail.com>

On 03/23/2016 04:51 AM, Yichao Yu wrote:
>>>>> Yeah, there's no full fix available, only some ideas thrown out.
>>>>> The last discussed one wouldn't cause a regression -- the
>>>>> "longjmp"-caching idea.  We may still need to defer breakpoint re-set
>>>>> to at most once per jit load event, something like Paul's original
>>>>> patch, but with a breakpoint_re_set call somewhere.
>
> I've just run the profile myself and got some quite different result
> from the 2011 thread[1].
> With no breakpoint in gdb and simply jitting O(2000) functions: [2]
> With one (un-triggered) breakpoint in gdb and jitting O(1500) functions: [3]
>
> It seems that there's other slowness when there are breakpoint created
> but in terms of scaling, the fastest growing one is the sorting in
> `update_section_map`
>
> [1] https://sourceware.org/ml/gdb/2011-01/msg00009.html
> [2] http://i.imgur.com/6Ca6Yal.jpg
> [3] http://i.imgur.com/aHKGACX.jpg

Ouch.  Not sure what to do here.

Maybe we could cache something above find_pc_section ->
update_section_map, to avoid the section look ups.
 From [2], we see that this is in the inline frame sniffer.
Maybe we can add a shortcut here, based on assuming that if
we're stopped at the jit event breakpoint address, then we're
not stopped at an inlining site.  That is, a trick similar to
the pc_at_non_inline_function check in infrun.c.

So, as a quick hack, if you make inline_frame_sniffer bail out early
with 0, does it improve things?

>
>>>>> It'd even be better to somehow restrict breakpoint re-setting
>>>>> to the jit modules that were added/removed/changed, but
>>>>> that's harder.
>
> I've re-read the 2011 thread and I think I have a slightly better
> understanding now. IIUC we need to check if the newly registered file
> contains any pending breakpoints. Is the problem that this is done by
> checking it over all the registered object files? Is it possible to
> avoid O(n^2) scaling without only re-setting on the jit object file
> currently being modified?

Batch loading the object files comes to mind.  From reading
the code, it seems like gdb only reads on object file per
JIT_REGISTER event.  The descriptor->relevant_entry one.
Is that correct?  Is there a reason the loader couldn't batch
compile all functions, only call the JIT_REGISTER once, and
then have GDB follow descriptor->relevant_entry->next_entry, etc.?

If we could batch load, then we could also defer breakpoint re-set
until all is loaded, as well as inhibit section map updates,
as done in svr4_handle_solib_event for normal DSO loading.

Thanks,
Pedro Alves


  reply	other threads:[~2016-03-23 18:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 14:56 Yichao Yu
2016-03-22 15:46 ` Pedro Alves
2016-03-22 16:10   ` Paul Pluzhnikov
2016-03-22 16:15   ` Pedro Alves
2016-03-22 16:23     ` Yichao Yu
2016-03-22 16:41       ` Pedro Alves
2016-03-22 16:47         ` Yichao Yu
2016-03-22 17:00           ` Pedro Alves
2016-03-23  2:18             ` Yichao Yu
2016-03-23  4:51               ` Yichao Yu
2016-03-23 18:24                 ` Pedro Alves [this message]
2016-03-23 19:32                   ` Yichao Yu
2016-03-23 19:48                     ` Pedro Alves
2016-03-23 20:51                       ` Yichao Yu
2016-03-24  1:17                         ` Pedro Alves
2016-03-24  3:14                           ` Yichao Yu
2016-03-24 21:02                             ` Yichao Yu
2016-03-23 12:24               ` Pedro Alves
2016-03-23 13:31                 ` Pedro Alves

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=56F2DF69.9030908@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=ppluzhnikov@google.com \
    --cc=yyc1992@gmail.com \
    /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