Fixed patch. I haven't addressed any of your concerns except fixed what was broken. There are two things changed: 1) get_dynamic, you will see I left it unfinished when switched to generic "find_phdr" to address phdr traversal duplication code. 2) lrfind_mapping_entry can not check for vaddr + offset as offset is file offset, and for some shared objects this will not match even though the vaddr of the entry with zero offset is valid. Stepping through code now shows some of the things you couldn't see, like e.g. why is there so->build_id, and where is it being set (you couldn't see it being set before as qXfer_library was broken). --- Aleksandar On 13-03-27 04:17 PM, Aleksandar Ristovski wrote: > Addressed Jan's comments. > > > > On 13-03-27 10:50 AM, Jan Kratochvil wrote: >> On Wed, 27 Mar 2013 15:38:29 +0100, Aleksandar Ristovski wrote: >>> On 13-03-26 04:41 PM, Jan Kratochvil wrote: >>>>>> + if (build_id_list_p) >>>>>> + qsort (VEC_address (build_id_list_s, data.list), >>>>>> + VEC_length (build_id_list_s, data.list), >>>>>> + sizeof (build_id_list_s), compare_build_id_list); >>>> It is always already sorted by Linux kernel, rather a for cycle to >>>> verify it >>>> really is sorted. >>> >>> Can we guarantee this is always the case? >> >> Yes. >> >> The problem is that if it is unsorted there is a bug somewhere and >> that qsort >> will hide that bug. > > > Qsort removed. I didn't put any traversal; we are making assumption that > the list will be sorted. The checks in the other bits make sure that we > either find the right mapping or none at all, so worst case scenario is > we don't get build-id communicated to gdb. > > > > Thanks, > > Aleksandar >