aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-osdata.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-07-19 21:10:09 -0600
committerTom Tromey <tom@tromey.com>2018-07-30 08:33:26 -0600
commit463c08d160e55d6eaf0f9bc3729781ce90f4de3f (patch)
tree3c98c35b84280fc2c1596465bb9bfc4e8f2ceac5 /gdb/nat/linux-osdata.c
parentdba7455e76f87abe81cc9e4e9b1f979c1da02846 (diff)
downloadgdb-463c08d160e55d6eaf0f9bc3729781ce90f4de3f.zip
gdb-463c08d160e55d6eaf0f9bc3729781ce90f4de3f.tar.gz
gdb-463c08d160e55d6eaf0f9bc3729781ce90f4de3f.tar.bz2
Fix crash with -D_GLIBCXX_DEBUG
I noticed a buildbot failure where gdb crashed in info-os.exp, when compiled with -D_GLIBCXX_DEBUG: (gdb) info os procgroups /usr/include/c++/7/bits/stl_algo.h:4834: Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)). Objects involved in the operation: iterator::value_type "< operator type" { type = pid_pgid_entry; } The bug here is that pid_pgid_entry::operator< violates the C++ irreflexivity rule; that is, that an object cannot be less than itself. Tested locally by re-running info-os.exp. gdb/ChangeLog 2018-07-30 Tom Tromey <tom@tromey.com> * nat/linux-osdata.c (pid_pgid_entry::operator<): Fix irreflexivity violation.
Diffstat (limited to 'gdb/nat/linux-osdata.c')
-rw-r--r--gdb/nat/linux-osdata.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 25e895d..2323dcc 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -415,9 +415,11 @@ struct pid_pgid_entry
/* Process group leaders always come first... */
if (this->is_leader ())
- return true;
-
- if (other.is_leader ())
+ {
+ if (!other.is_leader ())
+ return true;
+ }
+ else if (other.is_leader ())
return false;
/* ...else sort by PID. */