2012-02-24 Luis Machado * breakpoint.c (bp_location_compare): Sort by pspace before sorting by number. Index: gdb/gdb/breakpoint.c =================================================================== --- gdb.orig/gdb/breakpoint.c 2012-02-24 12:44:27.582553984 -0200 +++ gdb/gdb/breakpoint.c 2012-02-24 12:44:59.210553984 -0200 @@ -10609,6 +10609,14 @@ bp_location_compare (const void *ap, con if (a->address != b->address) return (a->address > b->address) - (a->address < b->address); + /* Sort locations at the same address by their pspace number, keeping + locations of the same inferior (in a multi-inferior environment) + grouped. */ + + if (a->pspace->num != b->pspace->num) + return ((a->pspace->num > b->pspace->num) + - (a->pspace->num < b->pspace->num)); + /* Sort permanent breakpoints first. */ if (a_perm != b_perm) return (a_perm < b_perm) - (a_perm > b_perm);