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.
This commit is contained in:
Pedro Alves
2015-11-24 18:11:22 +00:00
parent 2f341b6e28
commit 62147a2265
5 changed files with 70 additions and 9 deletions

View File

@@ -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);