From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options
Date: Wed, 22 May 2019 20:53:00 -0000 [thread overview]
Message-ID: <20190522205327.2568-1-palves@redhat.com> (raw)
This all started a couple years ago with the idea that one reason
people sometimes complain about gdb's defaults, such as "set print
object" or "set print static-members" is that we don't have an easy
way to override the global print settings.
I.e., how if we had options support in the print command, so you could
do this:
(gdb) print -pretty obj
instead of:
(gdb) set print pretty on
(gdb) print obj
(gdb) set print pretty off
then the defaults, while they'd still matter, wouldn't matter so much.
Back then, I experimented with that, and got a prototype up and
running. Other priorities were put in front of it so I never managed
to finish it... until now. The reason I picked it up again, is that
this addresses part of the same motivation that led to Philippe's "/"
command. I don't necessarily think that the solutions are orthogonal,
but I do think that having this feature in might affect how we look at
the "/"-command idea. Particularly, I'm not sold on the way the
feature's user interface is designed.
I'm a strong believer of TAB-completion driving the CLI, and that is
one of the reasons why I like this patchset. If you're like me,
you're pressing TAB all the time. It allows dynamic discovery of
options/features, and makes it not a problem to have longer option
names:
(gdb) p -[TAB]
-address -elements -pretty -symbol
-array -null-stop -repeats -union
-array-indexes -object -static-members -vtbl
The approach I took is that command options have a similar syntax and
names to the global set settings. The above should be familiar, if
you're familiar with the "set print" settings:
(gdb) set print[TAB]
address max-symbolic-offset symbol
array null-stop symbol-filename
array-indexes object symbol-loading
asm-demangle pascal_static-members thread-events
demangle pretty type
elements raw union
entry-values repeats vtbl
frame-arguments sevenbit-strings
inferior-events static-members
So we have boolean, integer and enum options, just like we have the
"set" command counterpart types. In fact, the data structures used to
describe a command's options can (and are) used to install the
corresponding "set" commands.
This results in options like:
(gdb) print -elements 100 -object off -- *myobj
(gdb) backtrace -frame-arguments scalars
(gdb) frame apply all -past-main
Also, command options are abbreviatable, boolean arguments are
optional (on is assumed), and you can write 0/1 instead of on/off too,
so you could replace the above with
(gdb) print -e 100 -o 0 -- *myobj
(gdb) backtrace -fr s
(gdb) f ap a -past-m
BTW, you'll notice that the framework doesn't split arguments in an
array of arguments, getopt-/buildargv- style. The reason for that is
that many commands in gdb accept raw, unformatted arguments,
expressions, and we can't split those up around whitespace.
So the series adds fixes a number of latent bugs exposed while writing
this, the options infrastructure proper along with its testsuite
(patch #12), and converts a number of commands to use the
infrastructure: "print"/"compile print", "compile code/file",
"backtrace", and "thread/frame apply" & friends.
Patch #9 adds testing of the "set"/"show" commands' parsing/completion
mechanics.
For print in particular, I settled on requiring "--" if you specify
any option. I'm open to opinions otherwise, but please read through
the series, and particularly patch #13 for more details around that
choice.
Documentation is most in the last patch of the series, except there's
another bit in patch #09, which could be a standalone patch.
Pedro Alves (24):
Fix latent bug in custom word point completion handling
Fix latent bug with custom word point completers
Fix TID parser bug
Make check_for_argument skip whitespace after arg itself
Allow "unlimited" abbreviations
Fix "set enum-command value garbage"
Remove "show" command completers
gdb.base/settings.exp: Fix comment typo
New set/show testing framework (gdb.base/settings.exp)
boolean/auto-boolean commands, make "o" ambiguous
number_or_range_parser::get_number, don't treat "1 -" as a range
Introduce generic command options framework
Make "print" and "compile print" support -OPT options
Migrate rest of compile commands to new options framework
Introduce rename_cmd
Make "backtrace" support -OPT options
"backtrace full/no-filters/hide" completer
lib/completion-support.exp: Add test_gdb_completion_offers_commands
Introduce complete_command
Make "frame apply" support -OPT options
"thread apply 1 -- -" vs "frame apply level 0 -- -"
Make "thread apply" use the gdb::option framework
Delete parse_flags/parse_flags_qcs
NEWS and manual changes for command options changes
gdb/doc/gdb.texinfo | 338 +++++++++--
gdb/NEWS | 97 ++++
gdb/Makefile.in | 3 +
gdb/ax-gdb.c | 2 -
gdb/breakpoint.c | 5 +-
gdb/cli/cli-decode.c | 183 ++++--
gdb/cli/cli-decode.h | 4 +
gdb/cli/cli-option.c | 732 ++++++++++++++++++++++++
gdb/cli/cli-option.h | 335 +++++++++++
gdb/cli/cli-setshow.c | 287 ++++++----
gdb/cli/cli-setshow.h | 27 +
gdb/cli/cli-utils.c | 124 +++--
gdb/cli/cli-utils.h | 62 +--
gdb/command.h | 5 +
gdb/compile/compile.c | 215 ++++---
gdb/completer.c | 84 ++-
gdb/completer.h | 20 +-
gdb/cp-valprint.c | 57 --
gdb/frame.c | 84 +--
gdb/frame.h | 55 +-
gdb/maint-test-options.c | 460 +++++++++++++++
gdb/maint-test-settings.c | 257 +++++++++
gdb/mi/mi-cmd-stack.c | 23 +-
gdb/printcmd.c | 94 +++-
gdb/python/py-framefilter.c | 3 +-
gdb/stack.c | 627 ++++++++++++++++-----
gdb/stack.h | 5 +
gdb/testsuite/gdb.base/completion.exp | 2 +-
gdb/testsuite/gdb.base/options.c | 33 ++
gdb/testsuite/gdb.base/options.exp | 923 +++++++++++++++++++++++++++++++
gdb/testsuite/gdb.base/settings.c | 23 +
gdb/testsuite/gdb.base/settings.exp | 536 ++++++++++++++++++
gdb/testsuite/gdb.compile/compile.exp | 15 +-
gdb/testsuite/gdb.multi/tids.exp | 16 +-
gdb/testsuite/lib/completion-support.exp | 66 ++-
gdb/thread.c | 285 +++++++---
gdb/tid-parse.c | 16 +-
gdb/tid-parse.h | 3 +
gdb/unittests/cli-utils-selftests.c | 133 -----
gdb/valprint.c | 259 ++++++---
gdb/valprint.h | 20 +-
41 files changed, 5563 insertions(+), 955 deletions(-)
create mode 100644 gdb/cli/cli-option.c
create mode 100644 gdb/cli/cli-option.h
create mode 100644 gdb/maint-test-options.c
create mode 100644 gdb/maint-test-settings.c
create mode 100644 gdb/testsuite/gdb.base/options.c
create mode 100644 gdb/testsuite/gdb.base/options.exp
create mode 100644 gdb/testsuite/gdb.base/settings.c
create mode 100644 gdb/testsuite/gdb.base/settings.exp
--
2.14.5
next reply other threads:[~2019-05-22 20:53 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 20:53 Pedro Alves [this message]
2019-05-22 20:53 ` [PATCH 04/24] Make check_for_argument skip whitespace after arg itself Pedro Alves
2019-05-22 20:53 ` [PATCH 11/24] number_or_range_parser::get_number, don't treat "1 -" as a range Pedro Alves
2019-05-22 20:53 ` [PATCH 18/24] lib/completion-support.exp: Add test_gdb_completion_offers_commands Pedro Alves
2019-05-22 20:53 ` [PATCH 08/24] gdb.base/settings.exp: Fix comment typo Pedro Alves
2019-05-24 11:40 ` Pedro Alves
2019-05-22 20:53 ` [PATCH 03/24] Fix TID parser bug Pedro Alves
2019-05-22 20:53 ` [PATCH 07/24] Remove "show" command completers Pedro Alves
2019-05-23 19:28 ` Sergio Durigan Junior
2019-05-24 11:25 ` Pedro Alves
2019-05-24 14:21 ` Sergio Durigan Junior
2019-05-22 20:53 ` [PATCH 15/24] Introduce rename_cmd Pedro Alves
2019-05-25 19:58 ` Philippe Waroquiers
2019-05-29 16:03 ` Pedro Alves
2019-05-29 18:30 ` Pedro Alves
2019-05-30 10:22 ` Philippe Waroquiers
2019-05-30 20:01 ` Pedro Alves
2019-05-22 20:53 ` [PATCH 19/24] Introduce complete_command Pedro Alves
2019-05-22 20:54 ` [PATCH 02/24] Fix latent bug with custom word point completers Pedro Alves
2019-05-22 20:54 ` [PATCH 14/24] Migrate rest of compile commands to new options framework Pedro Alves
2019-05-22 20:54 ` [PATCH 20/24] Make "frame apply" support -OPT options Pedro Alves
2019-05-25 20:12 ` Philippe Waroquiers
2019-05-29 15:13 ` Pedro Alves
2019-05-29 15:25 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 01/24] Fix latent bug in custom word point completion handling Pedro Alves
2019-05-22 20:54 ` [PATCH 22/24] Make "thread apply" use the gdb::option framework Pedro Alves
2019-05-25 20:24 ` Philippe Waroquiers
2019-05-29 15:38 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 10/24] boolean/auto-boolean commands, make "o" ambiguous Pedro Alves
2019-05-22 20:54 ` [PATCH 06/24] Fix "set enum-command value garbage" Pedro Alves
2019-05-23 19:13 ` Sergio Durigan Junior
2019-05-24 11:39 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 05/24] Allow "unlimited" abbreviations Pedro Alves
2019-05-22 20:54 ` [PATCH 09/24] New set/show testing framework (gdb.base/settings.exp) Pedro Alves
2019-05-23 4:15 ` Eli Zaretskii
2019-05-22 20:54 ` [PATCH 12/24] Introduce generic command options framework Pedro Alves
2019-05-25 7:43 ` Philippe Waroquiers
2019-05-25 10:31 ` Pedro Alves
2019-05-22 20:54 ` [PATCH 21/24] "thread apply 1 -- -" vs "frame apply level 0 -- -" Pedro Alves
2019-05-22 20:58 ` [PATCH 13/24] Make "print" and "compile print" support -OPT options Pedro Alves
2019-05-24 19:49 ` Sergio Durigan Junior
2019-05-25 10:10 ` Pedro Alves
2019-05-25 10:37 ` Andreas Schwab
2019-05-22 20:58 ` [PATCH 16/24] Make "backtrace" " Pedro Alves
2019-05-22 21:00 ` [PATCH 17/24] "backtrace full/no-filters/hide" completer Pedro Alves
2019-05-22 21:00 ` [PATCH 24/24] NEWS and manual changes for command options changes Pedro Alves
2019-05-23 4:31 ` Eli Zaretskii
2019-05-23 15:01 ` Pedro Alves
2019-05-23 15:07 ` Eli Zaretskii
2019-05-23 15:31 ` Pedro Alves
2019-05-25 20:40 ` Philippe Waroquiers
2019-05-29 16:03 ` Pedro Alves
2019-05-22 21:03 ` [PATCH 23/24] Delete parse_flags/parse_flags_qcs Pedro Alves
2019-05-22 21:46 ` [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options Pedro Alves
2019-05-24 19:58 ` Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190522205327.2568-1-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox