This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/7] btrace: Use binary search to find instruction.


On 2016-10-27 02:28, Tim Wiederhake wrote:
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.

Hi Tim,

Unless you expect to backport this patch in the 7.12 branch (which I don't think is the case here), you can use C++ standard containers and functions. Specifically, std::vector instead of DEF_VEC, and probably std::lower_bound (if I understand correctly what the code is doing).

Also, since we now have btrace_function pointers in a sorted vector, do we still need them to be linked together as a linked list?

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]