* Re: / (slash) command : fast way to temporarily change setting(s) to run a command [not found] <1555313564.1473.2.camel@skynet.be> @ 2019-04-16 3:06 ` Simon Marchi 2019-04-16 6:48 ` Philippe Waroquiers 2019-04-17 8:14 ` Kevin Buettner 1 sibling, 1 reply; 10+ messages in thread From: Simon Marchi @ 2019-04-16 3:06 UTC (permalink / raw) To: Philippe Waroquiers, gdb On 2019-04-15 3:32 a.m., Philippe Waroquiers wrote: > GDB has a lot of settings related to how commands behaves and/or print things. >     > There is however currently no easy way to temporarily change a setting > for a command. > > The proposed new / command allows to temporarily change > the settings in order to execute another command. > A simple example: > By default, 'set print pretty on|off' is off. > To temporarily pretty > print something, today, you have to do: > (gdb) set print pretty on > (gdb) print > something > (gdb) set print pretty off > With the / command: > (gdb) /p print something > > > The objective for this / command is to be fast to type, so it uses > 1 or 2 letters codes to identify which settings(s) to temporarily set. > See the proposed user manual at > https://sourceware.org/ml/gdb-patches/2019-04/msg00245.html > and the patch at > https://sourceware.org/ml/gdb-patches/2019-04/msg00244.html > > > Several settings can be changed at once: > (gdb) /lAai print some_array > is the equivalent of: >    (gdb) set language ada >    (gdb) set print array on >    (gdb) set print array-indexes on >    (gdb) print some_array >    (gdb) set language auto >    (gdb) set print array off >    (gdb) set print array-indexes off > > An advantage of this approach is that the same options > are usable for all commands. > For example, you can use: > (gdb) /lAai backtrace full > so that what backtrace prints is temporarily using > the settings identified by /lAai. > > The full list of currently changeable settings is given > in the 'help /' below. > > Feedback/comments/... welcome > > Thank > Philippe > > > (gdb) help / > Usage: /SETTING... COMMAND > Temporarily changes settings according to SETTING, run COMMAND, > and then restore the settings to their previous values. > Each temporarily changeable setting is identified by a unique sequence > of one or more letters. > A boolean setting is temporarily activated (set to "on") by giving > its sequence of letters.  If the boolean sequence of letters is prefixed > by !, the boolean setting is deactivated (set to "off"). > An integer setting is temporarily changed by using its sequence of letters > optionally prefixed by the temporary value desired. > If no prefix value is given before the integer setting letters, > the integer setting is temporarily changed to an unlimited value. > An enum setting is temporarily changed by giving its sequence of letters > followed by a letter designating the chosen enum value. > Example: >  /100e!ai print some_array > is equivalent to: >  # save current values of the settings set print elements/array/array-index. >  set print elements 100 >  set print array off >  set print array-index on >  print some_array >  # restore the saved values of the changed settings. > The temporarily changeable settings are: > /Be       set backtrace past-entry       Boolean on|off > /Bl       set backtrace limit            Unsigned integer (0 means unlimited) > /Bm       set backtrace past-main        Boolean on|off > /Co       set print object               Boolean on|off > /Cs       set print static-members       Boolean on|off > /Cv       set print vtbl                 Boolean on|off > /Pa       set print address              Boolean on|off > /Ps       set print symbol               Boolean on|off > /Rf       set print raw frame-arguments  Boolean on|off > /a        set print array                Boolean on|off > /e        set print elements             Unsigned integer (0 means unlimited) > /f[asn]   set print frame-arguments      Enum, a = all, s = scalars, n = none > /i        set print array-indexes        Boolean on|off > /l[aluAscCdfgmMOo] set language          Enum, a = auto, l = local, >                                 u = unknown, A = ada, s = asm, c = c, C = c++, >                                 d = d, f = fortran, g = go, m = minimal, >                                 M = modula-2, O = objective-c, o = opencl > /n        set print null-stop            Boolean on|off > /p        set print pretty               Boolean on|off > /r        set print repeats              Unsigned integer (0 means unlimited) > /u        set print union                Boolean on|off > /v        set varsize-limit              Unsigned integer (0 means unlimited) > (gdb) Hi Philippe, I like the idea, I would probably use it most with /e (for long strings) and /p. I just tried it a little bit, and I appreciate the fact that it's easy to apply to your previous command. Just type up and add the prefix to the beginning of the line. About that help, I would just add a few newlines here and there to space things out and ease the reading. Other than that, it's quite clear. Simon Simon ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-16 3:06 ` / (slash) command : fast way to temporarily change setting(s) to run a command Simon Marchi @ 2019-04-16 6:48 ` Philippe Waroquiers 2019-04-16 12:20 ` Simon Marchi 0 siblings, 1 reply; 10+ messages in thread From: Philippe Waroquiers @ 2019-04-16 6:48 UTC (permalink / raw) To: Simon Marchi, gdb On Mon, 2019-04-15 at 23:06 -0400, Simon Marchi wrote: > Hi Philippe, > > I like the idea, I would probably use it most with /e (for long strings) and /p. > I just tried it a little bit, and I appreciate the fact that it's easy to apply > to your previous command. Just type up and add the prefix to the beginning of the > line. Interesting, that was not the primary use case I was thinking to. We could make this even easier by making COMMAND optional in: Usage: /SETTING... [COMMAND] and giving no command means to repeat the previous command with the additional given settings e.g. : (gdb) some command .... some command output (gdb) /e => executes /e some command (gdb) /e some command ... some command output (gdb) /p => executes /ep some command I guess we probably call dont_repeat () in / command when no COMMAND is given. > > About that help, I would just add a few newlines here and there to space things > out and ease the reading. Other than that, it's quite clear. Ok, will add some new lines in the v2 of the patch. Thanks for the feedback Philippe ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-16 6:48 ` Philippe Waroquiers @ 2019-04-16 12:20 ` Simon Marchi 2019-04-16 21:22 ` Philippe Waroquiers 0 siblings, 1 reply; 10+ messages in thread From: Simon Marchi @ 2019-04-16 12:20 UTC (permalink / raw) To: Philippe Waroquiers; +Cc: gdb On 2019-04-16 02:48, Philippe Waroquiers wrote: > On Mon, 2019-04-15 at 23:06 -0400, Simon Marchi wrote: >> Hi Philippe, >> >> I like the idea, I would probably use it most with /e (for long >> strings) and /p. >> I just tried it a little bit, and I appreciate the fact that it's easy >> to apply >> to your previous command. Just type up and add the prefix to the >> beginning of the >> line. > Interesting, that was not the primary use case I was thinking to. > > We could make this even easier by making COMMAND optional in: > Usage: /SETTING... [COMMAND] > and giving no command means to repeat the previous command with the > additional > given settings e.g. : > (gdb) some command > .... some command output > (gdb) /e > => executes /e some command > > (gdb) /e some command > ... some command output > (gdb) /p > => executes /ep some command > > I guess we probably call dont_repeat () in / command > when no COMMAND is given. Ah yeah, that sounds good too, I would be consistent with the fact that just like you can do: (gdb) p 10 $4 = 10 (gdb) p/x $5 = 0xa Does it mean that as a side-effect, "/" alone would repeat the previos command unaltered? Simon ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-16 12:20 ` Simon Marchi @ 2019-04-16 21:22 ` Philippe Waroquiers 0 siblings, 0 replies; 10+ messages in thread From: Philippe Waroquiers @ 2019-04-16 21:22 UTC (permalink / raw) To: Simon Marchi; +Cc: gdb On Tue, 2019-04-16 at 08:20 -0400, Simon Marchi wrote: > > Ah yeah, that sounds good too, I would be consistent with the fact that > just like you can do: > > (gdb) p 10 > $4 = 10 > (gdb) p/x > $5 = 0xa > > Does it mean that as a side-effect, "/" alone would repeat the previos > command unaltered? The previous command can be run by just typing Return, so I think we can keep slash command checking that at least one setting was given. I thought that implementing a command that would re-run the previous saved_command_line would mean to just look/use saved_command_line. But when a command runs, saved_command_line already contains the line of the currently running command. Slightly unexpected but not a big deal: it is very easy to add previous_saved_command_line. Philippe ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command [not found] <1555313564.1473.2.camel@skynet.be> 2019-04-16 3:06 ` / (slash) command : fast way to temporarily change setting(s) to run a command Simon Marchi @ 2019-04-17 8:14 ` Kevin Buettner 2019-04-17 20:59 ` Philippe Waroquiers 2019-04-19 16:52 ` John Baldwin 1 sibling, 2 replies; 10+ messages in thread From: Kevin Buettner @ 2019-04-17 8:14 UTC (permalink / raw) To: gdb; +Cc: Philippe Waroquiers My first reaction to this proposal was that '/' is already used in some commands to modify their behavior. E.g. "print", "display", and "x" all use /FMT to change the way that data is formatted. That said, '/' seems to be used in only a handful of commands. It may be that its use is confined to the ones already mentioned. I see that the "interrupt" command allows the use of -a to modify its behavior. Most commands have no modifiers at all. I don't have a serious objection to Philippe's proposal, but I do think that we ought to consider whether use of '/' in this context might be confusing to the user. Might some other character or command name be less confusing? I don't know the answer to this, but I do think it's something which should be pondered before making this proposal a part of GDB's CLI. Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-17 8:14 ` Kevin Buettner @ 2019-04-17 20:59 ` Philippe Waroquiers 2019-04-19 16:52 ` John Baldwin 1 sibling, 0 replies; 10+ messages in thread From: Philippe Waroquiers @ 2019-04-17 20:59 UTC (permalink / raw) To: Kevin Buettner, gdb On Wed, 2019-04-17 at 01:14 -0700, Kevin Buettner wrote: > My first reaction to this proposal was that '/' is already used in > some commands to modify their behavior. E.g. "print", "display", and > "x" all use /FMT to change the way that data is formatted. > > That said, '/' seems to be used in only a handful of commands. It > may be that its use is confined to the ones already mentioned. > > I see that the "interrupt" command allows the use of -a to modify > its behavior. Most commands have no modifiers at all. > > I don't have a serious objection to Philippe's proposal, but I do > think that we ought to consider whether use of '/' in this context > might be confusing to the user. Might some other character or command > name be less confusing? I don't know the answer to this, but I do > think it's something which should be pondered before making this > proposal a part of GDB's CLI. Yes, for sure, getting the user interface correct is critical: it is always possible to improve the implementation/code in the next release, but changing the user interface in a next release is a lot more difficult. Maybe we need to identify first what kind of confusion can happen with the '/' command ? In fact, one of the reasons I started with '/' is that I find this easy to remember and not confusing, as '/' is already used to indicate 'some options or settings' in various GDB commands. I did not want to use '-' as today, the '-' options of commands that use this cannot be combined, while the / options can (both in the slash command, and in commands that use / as option such as print). We could use another character, e.g. ':', but other characters IMO do not ring a bell that it is related to settings or options. If really we need to use another character, of course, the code to change is quite trivial (mostly name changes, as currently, many variables and args are called 'slash_...'). But / seems a reasonable (the best?) option :) Thanks Philippe ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-17 8:14 ` Kevin Buettner 2019-04-17 20:59 ` Philippe Waroquiers @ 2019-04-19 16:52 ` John Baldwin 2019-05-03 3:10 ` Kevin Buettner 1 sibling, 1 reply; 10+ messages in thread From: John Baldwin @ 2019-04-19 16:52 UTC (permalink / raw) To: Kevin Buettner, gdb; +Cc: Philippe Waroquiers On 4/17/19 1:14 AM, Kevin Buettner wrote: > My first reaction to this proposal was that '/' is already used in > some commands to modify their behavior. E.g. "print", "display", and > "x" all use /FMT to change the way that data is formatted. > > That said, '/' seems to be used in only a handful of commands. It > may be that its use is confined to the ones already mentioned. > > I see that the "interrupt" command allows the use of -a to modify > its behavior. Most commands have no modifiers at all. > > I don't have a serious objection to Philippe's proposal, but I do > think that we ought to consider whether use of '/' in this context > might be confusing to the user. Might some other character or command > name be less confusing? I don't know the answer to this, but I do > think it's something which should be pondered before making this > proposal a part of GDB's CLI. I find using / to make sense actually. A leading / applies "global" settings to the following command, so you have a general syntax that is something like: [/global settings] [command] [/command-specific settings] [arguments] Where moving from left to right consistently "narrows" the scope. This is not unlike the syntax used in certain command line programs that reuse getopt-like interfaces for subcommand options while also supporting "global" options. git is an example of this (you have global options before the verb and then command-specific options after the verb both of which use the same getopt syntax) as well as svn, etc. -- John Baldwin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-04-19 16:52 ` John Baldwin @ 2019-05-03 3:10 ` Kevin Buettner 2019-05-03 8:23 ` Pedro Alves 0 siblings, 1 reply; 10+ messages in thread From: Kevin Buettner @ 2019-05-03 3:10 UTC (permalink / raw) To: gdb; +Cc: John Baldwin, Philippe Waroquiers, Pedro Alves On Fri, 19 Apr 2019 09:52:43 -0700 John Baldwin <jhb@FreeBSD.org> wrote: > On 4/17/19 1:14 AM, Kevin Buettner wrote: > > My first reaction to this proposal was that '/' is already used in > > some commands to modify their behavior. E.g. "print", "display", and > > "x" all use /FMT to change the way that data is formatted. > > > > That said, '/' seems to be used in only a handful of commands. It > > may be that its use is confined to the ones already mentioned. > > > > I see that the "interrupt" command allows the use of -a to modify > > its behavior. Most commands have no modifiers at all. > > > > I don't have a serious objection to Philippe's proposal, but I do > > think that we ought to consider whether use of '/' in this context > > might be confusing to the user. Might some other character or command > > name be less confusing? I don't know the answer to this, but I do > > think it's something which should be pondered before making this > > proposal a part of GDB's CLI. > > I find using / to make sense actually. A leading / applies "global" > settings to the following command, so you have a general syntax that > is something like: > > [/global settings] [command] [/command-specific settings] [arguments] > > Where moving from left to right consistently "narrows" the scope. > This is not unlike the syntax used in certain command line programs > that reuse getopt-like interfaces for subcommand options while also > supporting "global" options. git is an example of this (you have > global options before the verb and then command-specific options > after the verb both of which use the same getopt syntax) as well as > svn, etc. I like this rationale for the global / command. I'd like to wait a bit longer before reviewing Philippe's patch, however. I know that one of my colleagues has some thoughts on the interface and I'd like to give him a little extra time to express them here... Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-05-03 3:10 ` Kevin Buettner @ 2019-05-03 8:23 ` Pedro Alves 2019-05-03 9:10 ` Philippe Waroquiers 0 siblings, 1 reply; 10+ messages in thread From: Pedro Alves @ 2019-05-03 8:23 UTC (permalink / raw) To: Kevin Buettner, gdb; +Cc: John Baldwin, Philippe Waroquiers On 5/3/19 4:10 AM, Kevin Buettner wrote: > On Fri, 19 Apr 2019 09:52:43 -0700 > John Baldwin <jhb@FreeBSD.org> wrote: > >> On 4/17/19 1:14 AM, Kevin Buettner wrote: >>> My first reaction to this proposal was that '/' is already used in >>> some commands to modify their behavior. E.g. "print", "display", and >>> "x" all use /FMT to change the way that data is formatted. >>> >>> That said, '/' seems to be used in only a handful of commands. It >>> may be that its use is confined to the ones already mentioned. >>> >>> I see that the "interrupt" command allows the use of -a to modify >>> its behavior. Most commands have no modifiers at all. >>> >>> I don't have a serious objection to Philippe's proposal, but I do >>> think that we ought to consider whether use of '/' in this context >>> might be confusing to the user. Might some other character or command >>> name be less confusing? I don't know the answer to this, but I do >>> think it's something which should be pondered before making this >>> proposal a part of GDB's CLI. >> >> I find using / to make sense actually. A leading / applies "global" >> settings to the following command, so you have a general syntax that >> is something like: >> >> [/global settings] [command] [/command-specific settings] [arguments] >> >> Where moving from left to right consistently "narrows" the scope. >> This is not unlike the syntax used in certain command line programs >> that reuse getopt-like interfaces for subcommand options while also >> supporting "global" options. git is an example of this (you have >> global options before the verb and then command-specific options >> after the verb both of which use the same getopt syntax) as well as >> svn, etc. > > I like this rationale for the global / command. > > I'd like to wait a bit longer before reviewing Philippe's patch, however. > I know that one of my colleagues has some thoughts on the interface > and I'd like to give him a little extra time to express them here... That was me. :-) See here: https://sourceware.org/ml/gdb-patches/2019-05/msg00002.html I'll follow up when I have a chance. Yesterday I fixed the regressions that Philippe pointed at (fixes already in the branch) -- I wanted to see if it was possible to get to a clean slate for better experimenting / better ground for discussion. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: / (slash) command : fast way to temporarily change setting(s) to run a command 2019-05-03 8:23 ` Pedro Alves @ 2019-05-03 9:10 ` Philippe Waroquiers 0 siblings, 0 replies; 10+ messages in thread From: Philippe Waroquiers @ 2019-05-03 9:10 UTC (permalink / raw) To: Pedro Alves, Kevin Buettner, gdb; +Cc: John Baldwin On Fri, 2019-05-03 at 09:23 +0100, Pedro Alves wrote: > > > > I like this rationale for the global / command. > > > > I'd like to wait a bit longer before reviewing Philippe's patch, however. > > I know that one of my colleagues has some thoughts on the interface > > and I'd like to give him a little extra time to express them here... > > That was me. :-) See here: > > https://sourceware.org/ml/gdb-patches/2019-05/msg00002.html > > I'll follow up when I have a chance. Yesterday I fixed the > regressions that Philippe pointed at (fixes already in the branch) -- I > wanted to see if it was possible to get to a clean slate for better > experimenting / better ground for discussion. Thanks for this. Note that I have listed some points for the discussion in https://sourceware.org/ml/gdb-patches/2019-05/msg00019.html IMO, a (the?) major question I still have about keeping (or not) the "/" patch is for options that have a 'wide' impact. The "/" command avoids that this option has to be added as a specific argument to all the commands that are impacted directly or indirectly. An example is the new max-depth. As far as I understand, max-depth will at least impact: backtrace print frame info args ... (in fact all commands that are printing directly or indirectly some variables). With the "/" command, you have a way to influence all these commands. Otherwise, as far as I understand, an option --max-depth has to be added to all these commands. (or the user has to do set/launch command/reset). Philippe ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-05-03 9:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1555313564.1473.2.camel@skynet.be>
2019-04-16 3:06 ` / (slash) command : fast way to temporarily change setting(s) to run a command Simon Marchi
2019-04-16 6:48 ` Philippe Waroquiers
2019-04-16 12:20 ` Simon Marchi
2019-04-16 21:22 ` Philippe Waroquiers
2019-04-17 8:14 ` Kevin Buettner
2019-04-17 20:59 ` Philippe Waroquiers
2019-04-19 16:52 ` John Baldwin
2019-05-03 3:10 ` Kevin Buettner
2019-05-03 8:23 ` Pedro Alves
2019-05-03 9:10 ` Philippe Waroquiers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox