This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/6] Use std::vector in end_symtab_get_static_block
- From: Pedro Alves <palves at redhat dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>, gdb-patches at sourceware dot org
- Cc: tom at tromey dot com, simon dot marchi at ericsson dot com
- Date: Fri, 20 Oct 2017 17:47:18 +0100
- Subject: Re: [RFA 1/6] Use std::vector in end_symtab_get_static_block
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C2502C059B69
- References: <20171020153318.AF81FD80819@oc3748833570.ibm.com>
On 10/20/2017 04:33 PM, Ulrich Weigand wrote:
> [Re-sent since the original seems to have gotten lost somehow.]
>
>>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>>
>> Simon> That made me doubt for a second, since we're more used to see "<"
>> Simon> in these functions. I then saw that block_compar did sort them
>> Simon> in descending order. Could you add a comment here to indicate that?
>>
>> Done, thanks.
>
> This causes a number of regressions in the gdb.opt/inline-cmds.exp
> test case for me. Not sure exactly why, but changing the std::sort
> to a std::stable_sort like below fixes those regressions for me.
> Maybe the logic for handling inline function blocks somehow relied
> on some (undocumented) behavior of qsort for handling elements that
> compare as equal?
>
Sounds like we should improve the sort predicate to disambiguate
better, define a total order? I don't really know which sorting
is assumed, but e.g., if the block start addresses are the same,
compare the blocks' end addresses. If those match as well,
repeat but with the blocks' superblocks. And/or sort function
blocks before non-function blocks. Etc.
Thanks,
Pedro Alves