[RFA 1/6] Use std::vector in end_symtab_get_static_block

Pedro Alves palves@redhat.com
Fri Oct 20 16:47:00 GMT 2017


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



More information about the Gdb-patches mailing list