[PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order

Pedro Alves palves@redhat.com
Thu Oct 22 10:56:00 GMT 2015


PR 17539 points out that "info inferiors" lists inferiors in
decreasing order.  I audited the "info" sub commands, and GDB is
inconsistent on this issue in several places.  Some commands list in
ascending order, while others in descending order.

For example, ascending order:

  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   0x00000000004008ad in main at foo.c:81
  2       breakpoint     keep y   0x00000000004008ad in main at foo.c:81
  3       breakpoint     keep y   0x00000000004008ad in main at foo.c:81
  4       breakpoint     keep y   0x00000000004008ad in main at foo.c:81
  (gdb)

  (gdb) info skip
  Num     Type           Enb What
  1       function       y   main
  2       function       y   main
  3       function       y   main
  (gdb)

  (gdb) info bookmarks
     1       0x4008ad    '0'
     2       0x4008ad    '0'
     3       0x4008ad    '0'
     4       0x4008ad    '0'
  (gdb)

  (gdb) info tasks
    ID       TID P-ID Pri State                 Name
     1   8088000   0   15 Child Activation Wait main_task
     2   80a4000   1   15 Accept Statement      b
     3   809a800   1   15 Child Activation Wait a
  *  4   80ae800   3   15 Runnable              c
  (gdb)

Descending:

  (gdb) info display
  Auto-display expressions now in effect:
  Num Enb Expression
  4:   y  1
  3:   y  1
  2:   y  1
  1:   y  1
  (gdb)

  (gdb) info threads
    Id   Target Id         Frame
    3    Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
    2    Thread 0x7ffff7fc4700 (LWP 29034) function (arg=0x0) at foo.c:60
  * 1    Thread 0x7ffff7fc5740 (LWP 29030) main () at foo.c:92
  (gdb)

  (gdb) info inferiors 
    Num  Description       Executable        
    1    process 5473      /home/pedro/gdb/tests/threads 
  * 2    process 5477      /home/pedro/gdb/tests/main 
  (gdb)

  (gdb) info checkpoints
    3 process 29132 at 0x4008ad, file foo.c, line 81
    2 process 29131 at 0x4008ad, file foo.c, line 81
    1 process 29130 at 0x4008ad, file foo.c, line 81
  * 0 Thread 0x7ffff7fc5740 (LWP 29128) (main process) at 0x4008ad, file foo.c, line 81
  (gdb)

This patch series switches all "descending order" commands I found to
ascending order, and adjusts manual and testsuite accordingly.

Pedro Alves (6):
  Make gdb.python/py-inferior.exp test names unique
  Linux: dump the signalled thread first
  List inferiors/threads/pspaces in ascending order
  List checkpoints in ascending order
  List displays in ascending order
  NEWS: "info" commands now list in ascending order

 gdb/NEWS                                           |   4 +
 gdb/doc/gdb.texinfo                                |   8 +-
 gdb/inferior.c                                     |  13 +-
 gdb/linux-fork.c                                   |  35 +++-
 gdb/linux-tdep.c                                   | 126 ++++++------
 gdb/printcmd.c                                     |  14 +-
 gdb/progspace.c                                    |  12 +-
 gdb/testsuite/gdb.base/checkpoint.exp              |   4 +-
 gdb/testsuite/gdb.base/display.exp                 |  35 +++-
 gdb/testsuite/gdb.base/foll-exec-mode.exp          |   2 +-
 gdb/testsuite/gdb.base/foll-fork.exp               |   6 +-
 gdb/testsuite/gdb.base/foll-vfork.exp              |   2 +-
 gdb/testsuite/gdb.base/multi-forks.exp             |  30 +--
 gdb/testsuite/gdb.base/solib-display.exp           |  19 +-
 gdb/testsuite/gdb.mi/mi-nonstop.exp                |   2 +-
 gdb/testsuite/gdb.mi/mi-nsintrall.exp              |   4 +-
 gdb/testsuite/gdb.multi/base.exp                   |  18 +-
 gdb/testsuite/gdb.multi/multi-arch.exp             |   2 +-
 gdb/testsuite/gdb.python/py-inferior.exp           | 217 ++++++++++----------
 gdb/testsuite/gdb.threads/break-while-running.exp  |   8 +-
 gdb/testsuite/gdb.threads/execl.exp                |   2 +-
 gdb/testsuite/gdb.threads/gcore-thread.exp         |   4 +-
 gdb/testsuite/gdb.threads/info-threads-cur-sal.exp |  10 +-
 gdb/testsuite/gdb.threads/kill.exp                 |   2 +-
 gdb/testsuite/gdb.threads/linux-dp.exp             |   2 +-
 gdb/testsuite/gdb.threads/multiple-step-overs.exp  |   2 +-
 gdb/testsuite/gdb.threads/next-bp-other-thread.exp |   2 +-
 .../gdb.threads/step-bg-decr-pc-switch-thread.exp  |   2 +-
 .../gdb.threads/step-over-lands-on-breakpoint.exp  |   2 +-
 .../gdb.threads/step-over-trips-on-watchpoint.exp  |   2 +-
 gdb/testsuite/gdb.threads/thread-find.exp          | 218 ++++-----------------
 gdb/testsuite/gdb.threads/tls.exp                  |   2 +-
 gdb/testsuite/lib/mi-support.exp                   |  13 +-
 gdb/thread.c                                       |  13 +-
 34 files changed, 394 insertions(+), 443 deletions(-)

-- 
1.9.3



More information about the Gdb-patches mailing list