This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v5 3/9] btrace: Use binary search to find instruction.
- From: Doug Evans <xdje42 at gmail dot com>
- To: Tim Wiederhake <tim dot wiederhake at intel dot com>
- Cc: gdb-patches at sourceware dot org, markus dot t dot metzger at intel dot com, palves at redhat dot com
- Date: Sun, 12 Feb 2017 19:57:54 -0800
- Subject: Re: [PATCH v5 3/9] btrace: Use binary search to find instruction.
- Authentication-results: sourceware.org; auth=none
- References: <1485527996-32506-1-git-send-email-tim.wiederhake@intel.com> <1485527996-32506-4-git-send-email-tim.wiederhake@intel.com>
Tim Wiederhake <tim.wiederhake@intel.com> writes:
> Currently, btrace_find_insn_by_number will iterate over all function call
> segments to find the one that contains the needed instruction. This linear
> search is too slow for the upcoming Python bindings that will use this
> function to access instructions. This patch introduces a vector in struct
> btrace_thread_info that holds pointers to all recorded function segments and
> allows to use binary search.
>
> The proper solution is to turn the underlying tree into a vector of objects
> and use indices for access. This requires more work. A patch set is
> currently being worked on and will be published later.
>
> 2017-01-27 Tim Wiederhake <tim.wiederhake@intel.com>
>
> gdb/ChangeLog:
> * btrace.c (btrace_fetch): Copy function call segments pointer
> into a vector.
> (btrace_clear): Clear the vector.
> (btrace_find_insn_by_number): Use binary search to find the correct
> function call segment.
> * btrace.h (brace_fun_p): New typedef.
> (struct btrace_thread_info) <functions>: New field.
LGTM