aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-11-24 18:11:22 +0000
committerPedro Alves <palves@redhat.com>2015-11-24 18:38:07 +0000
commit62147a2265e322c758743edf13a1377fdcb62479 (patch)
treed4334a278d93c27446b07f93319a86a235f919ba /gdb/printcmd.c
parent2f341b6e28e27fadd8160d95337c3aa854bcba3b (diff)
List displays in ascending order
Before: (gdb) info display Auto-display expressions now in effect: Num Enb Expression 3: y 1 2: y 1 1: y 1 After: (gdb) info display Auto-display expressions now in effect: Num Enb Expression 1: y 1 2: y 1 3: y 1 gdb/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * printcmd.c (display_command): Append new display at the end of the list. gdb/testsuite/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * gdb.base/display.exp: Expect displays to be sorted in ascending order. Use multi_line. * gdb.base/solib-display.exp: Likewise.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 1744abd432..c676fc7ed7 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1543,11 +1543,21 @@ display_command (char *arg, int from_tty)
newobj->exp = expr;
newobj->block = innermost_block;
newobj->pspace = current_program_space;
- newobj->next = display_chain;
newobj->number = ++display_number;
newobj->format = fmt;
newobj->enabled_p = 1;
- display_chain = newobj;
+ newobj->next = NULL;
+
+ if (display_chain == NULL)
+ display_chain = newobj;
+ else
+ {
+ struct display *last;
+
+ for (last = display_chain; last->next != NULL; last = last->next)
+ ;
+ last->next = newobj;
+ }
if (from_tty)
do_one_display (newobj);