This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 0/4] Introduce the "with" command


( See original discussion and prototype here:
   https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html )

 (gdb) help with
 Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
 Usage: with SETTING [VALUE] [-- COMMAND]
 Usage: w SETTING [VALUE] [-- COMMAND]
 With no COMMAND, repeats the last executed command.
 SETTING is any setting settable with the "set" command.
 E.g.:
   with language pascal -- print obj
   with print elements unlimited -- print obj

More details in patch #4.

New in v2:

 - Now a series of 4 patches instead of a single patch.  The main
   patch is patch #4.  This patch includes documentation bits.

 - The "with" command's implementation moved from printcmd.c to
   cli/cli-cmds.c, near "show".

 - Philippe pointed out a bug in v1.  The issue was related to how on
   var_uinteger commands, "unlimited" is user-visible as "0", but
   stored internally in the command's control variable as "-1".
   Without proper internal/user-visible translation, restoring a
   setting's original value failed, if the setting was originally set
   to "unlimited".  In order to fix that, in v2 I'm reusing code from
   do_show_command to convert the set/show command's control variable
   to a string representation.

 - In order to thoroughly test the point above, I thought I'd reuse
   the recently introduced "maint test-settings set/show
   uinteger/zuinteger-unlimited/..." commands, in order to test "with"
   against all command type variants (all enum var_types).  But,
   instead of adding a new "maint test-settings with" command just for
   that, I thought that it was better if we added a more broadly
   usable "maint with" command that worked with all maintenance
   settings.  So the series includes a patch to rename "maint
   test-settings set/show" to "maint set/show test-settings".  That's
   patch #3.  That patch includes documentation bits, though
   of borderline-obvious kind.

- Making the new gdb.base/with.exp testcase exercise "maint with
  test-settings" uncovered bugs in the "maint set/show test-settings"
  settings.  Those are fixed by patch #1.

Pedro Alves (4):
  Fix defaults of some "maint test-settings" subcommands
  Fix a few comments in maint-test-settings.c
  "maint test-settings set/show" -> "maint set/show test-settings"
  Introduce the "with" command

 gdb/doc/gdb.texinfo                 | 101 +++++++++++++-
 gdb/NEWS                            |  18 ++-
 gdb/cli/cli-cmds.c                  | 129 +++++++++++++++++-
 gdb/cli/cli-cmds.h                  |  13 ++
 gdb/cli/cli-setshow.c               |  74 +++++-----
 gdb/cli/cli-setshow.h               |   5 +
 gdb/command.h                       |  19 +--
 gdb/maint-test-settings.c           | 167 +++++++++++------------
 gdb/maint.c                         |  27 ++++
 gdb/testsuite/gdb.base/settings.exp |  35 ++---
 gdb/testsuite/gdb.base/with.c       |  41 ++++++
 gdb/testsuite/gdb.base/with.exp     | 261 ++++++++++++++++++++++++++++++++++++
 gdb/top.c                           |   7 +-
 13 files changed, 738 insertions(+), 159 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/with.c
 create mode 100644 gdb/testsuite/gdb.base/with.exp

-- 
2.14.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]