diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-10-21 16:39:51 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-10-21 21:10:02 +0100 |
commit | 45f47c3a25d7574d21b9f451efce38c06256f591 (patch) | |
tree | f47a79abfe8ae237dfbcd9624d51724f37c4d271 /gdb/dwarf2read.c | |
parent | e5f3c0e3b83239b4b73fa76f28513a4a56fe50ce (diff) | |
download | binutils-45f47c3a25d7574d21b9f451efce38c06256f591.zip binutils-45f47c3a25d7574d21b9f451efce38c06256f591.tar.gz binutils-45f47c3a25d7574d21b9f451efce38c06256f591.tar.bz2 |
gdb: Ensure that !(a < a) is true in sort_cmp on obj_section objects
After the switch to use std::sort, if GDB is compiled with the
-D_GLIBCXX_DEBUG=1 flag then we see an error when using sort_cmp (in
objfiles.c) to sort obj_section objects.
The problem is that std::sort checks that the condition !(a < a)
holds, and currently this is not true. GDB's sort_cmp is really
designed to sort lists in which no obj_section repeats, however, there
is some code in place to try and ensure we get a stable sort order if
there is a bug in GDB, unfortunately this code fails the above check.
By reordering some of the checks inside sort_cmp, it is pretty easy to
ensure that the !(a < a) condition holds.
I've not bothered to make this condition check optimal, like I said
this code is only in place to ensure that we get stable results if GDB
goes wrong, so I've made the smallest change needed to get the correct
behaviour.
After this commit I see no regressions when running GDB compiled with
-D_GLIBCXX_DEBUG=1.
gdb/ChangeLog:
* objfiles.c (sort_cmp): Ensure that !(a < a) holds true.
Change-Id: I4b1e3e1640865104c0896cbb6c3fdbbc04d9645b
Diffstat (limited to 'gdb/dwarf2read.c')
0 files changed, 0 insertions, 0 deletions