Break setting aliases...

When we were first devising commands for lldb, we tried to be really parsimonious with the one & two letter unique command strings that lldb ships with by default. I was trying to leave us as much flexibility as possible as we evolved, and I also wanted to make sure we weren’t taking up all the convenient short commands, leaving a cramped space for user aliases.

The _regex_break command was added (and aliased by default to ‘b’) as a way to allow quick access for various common breakpoint setting options. However it suffers from the problem that you can only provide the options that are recognized by the _regexp_break command aliases. For instance, you can’t add the -h option to make a hardware breakpoint. Because the “_regex_break command works by passing the command through a series of regex’s stopping at the first match, trying to extend the regular expressions to also include “anything else” while not causing one regex to claim a command that was really meant for a regex further on in the series is really tricky.

That makes it kind of a wall for people. As soon as you need to do anything it doesn’t support you have to go to a command that is not known to you (since “b” isn’t related to “break set” in any way that a normal user can actually see.)

However, lldb has been around for a while and we only have two unique commands of the form “b[A-Za-z]” in the current lldb command set (br and bt). So I think it would be okay for us to take up a few more second letter commands to make setting breakpoints more convenient. I think adding:

bs (break source) -> break set -y
ba (break address) -> break set -a
bn (break name) -> break set -n

would provide a convenient way to set the most common classes of breakpoints while not precluding access to all the other options available to “break set”. We could still leave “b” by itself for the _regex_break command - people who’ve figured out it’s intricacies shouldn’t lose their investment. This would be purely additive.

What do people think?

Jim

I don’t mind adding the two-letter commands, but I also don’t really see the value in being able to say bs instead of b s -y. Until either becomes muscle memory, both require a little cognitive overhead of thinking “breakpoint set -y” or “breakpoint source”. As a user there would be more value in knowing that the latter is really breakpoint set -y which then allows you to query the help.

If I understand correctly the problem with b is that the regex can’t distinguish easily between what it should parse and what it should forward to breakpoint set. Additionally, because it’s essentially a mini-language, you can’t be sure if something with a colon is a symbol or file separated by a line/column number.

I think we should be able to solve the first issue by making b a proper first-class command instead of a regex alias, taking the exact same options as breakpoint set. I think our existing command object argument parser should be able to parse this and return the remaining “free form” argument, which we can then parse as a mini-language like we do today. Of course this would remain suboptimal, but would be strictly better than what we have today and address the original problem you’re trying to solve. Furthermore, with a first-class command we can do a better job on the help front which is really underwhelming for _regexp_break command aliases.

That leaves the second problem, which would be solved by the new two-letter commands but not by changing b. From a purity perspective I’d lean towards the new commands, but as a user I doubt I would use them. I set almost all my breakpoints with b and I don’t see a compelling reason to change to bs. So that leaves me with using b most of the time, until I do need to pass some extra option at which point I’ll probably just use breakpoint set directly.

TL;DR: Given how widely used b is I’d rather improve that and turn it from a 98% solution into a 99% solution instead of adding new commands.

I don’t mind adding the two-letter commands, but I also don’t really see the value in being able to say bs instead of b s -y. Until either becomes muscle memory, both require a little cognitive overhead of thinking “breakpoint set -y” or “breakpoint source”. As a user there would be more value in knowing that the latter is really breakpoint set -y which then allows you to query the help.

Yes, I don’t really understand people’s objection to “br s -y” or whatever, and peering over people’s shoulders indicates it is not universal. But there are a significant number of folks who are happier with a single command to type and “b s -y” seems to be a hinderance. I was trying to help in this case, not trying to understand…

If I understand correctly the problem with b is that the regex can’t distinguish easily between what it should parse and what it should forward to breakpoint set. Additionally, because it’s essentially a mini-language, you can’t be sure if something with a colon is a symbol or file separated by a line/column number.

More that that. If you type:

(lldb) b f

then we have to complete f in all the collections “b” might access, symbol names and file names in this case. In a substantial project that’s a lot of symbols if I meant a file name and vice versa. And the more we glom into the break-specification mini language, the harder this will be.

I think we should be able to solve the first issue by making b a proper first-class command instead of a regex alias, taking the exact same options as breakpoint set. I think our existing command object argument parser should be able to parse this and return the remaining “free form” argument, which we can then parse as a mini-language like we do today. Of course this would remain suboptimal, but would be strictly better than what we have today and address the original problem you’re trying to solve. Furthermore, with a first-class command we can do a better job on the help front which is really underwhelming for _regexp_break command aliases.

That leaves the second problem, which would be solved by the new two-letter commands but not by changing b. From a purity perspective I’d lean towards the new commands, but as a user I doubt I would use them. I set almost all my breakpoints with b and I don’t see a compelling reason to change to bs. So that leaves me with using b most of the time, until I do need to pass some extra option at which point I’ll probably just use breakpoint set directly.

TL;DR: Given how widely used b is I’d rather improve that and turn it from a 98% solution into a 99% solution instead of adding new commands.

I was hoping that since “bs”, “ba”, and “bn” are easy to type and would show up in a top-level “help” new folks would shift to using those, and maybe extant users of “b” would too. Then we could slide past having the “break-specification mini-language” over time.

I was also trying to make things a little better w/o signing up for making “_regex_break” work better which I don’t have any intention of doing personally…

Jim

When we were first devising commands for lldb, we tried to be really parsimonious with the one & two letter unique command strings that lldb ships with by default. I was trying to leave us as much flexibility as possible as we evolved, and I also wanted to make sure we weren’t taking up all the convenient short commands, leaving a cramped space for user aliases.

The _regex_break command was added (and aliased by default to ‘b’) as a way to allow quick access for various common breakpoint setting options. However it suffers from the problem that you can only provide the options that are recognized by the _regexp_break command aliases. For instance, you can’t add the -h option to make a hardware breakpoint. Because the “_regex_break command works by passing the command through a series of regex’s stopping at the first match, trying to extend the regular expressions to also include “anything else” while not causing one regex to claim a command that was really meant for a regex further on in the series is really tricky.

That makes it kind of a wall for people. As soon as you need to do anything it doesn’t support you have to go to a command that is not known to you (since “b” isn’t related to “break set” in any way that a normal user can actually see.)

However, lldb has been around for a while and we only have two unique commands of the form “b[A-Za-z]” in the current lldb command set (br and bt). So I think it would be okay for us to take up a few more second letter commands to make setting breakpoints more convenient. I think adding:

bs (break source) -> break set -y

Is -y a new option you would add? I don't see it. We have --file and --line

ba (break address) -> break set -a
bn (break name) -> break set -n

would provide a convenient way to set the most common classes of breakpoints while not precluding access to all the other options available to “break set”. We could still leave “b” by itself for the _regex_break command - people who’ve figured out it’s intricacies shouldn’t lose their investment. This would be purely additive.

What do people think?

Can we modify the _regex_break to accept options at the start or end of the command somehow?

When we were first devising commands for lldb, we tried to be really parsimonious with the one & two letter unique command strings that lldb ships with by default. I was trying to leave us as much flexibility as possible as we evolved, and I also wanted to make sure we weren’t taking up all the convenient short commands, leaving a cramped space for user aliases.

The _regex_break command was added (and aliased by default to ‘b’) as a way to allow quick access for various common breakpoint setting options. However it suffers from the problem that you can only provide the options that are recognized by the _regexp_break command aliases. For instance, you can’t add the -h option to make a hardware breakpoint. Because the “_regex_break command works by passing the command through a series of regex’s stopping at the first match, trying to extend the regular expressions to also include “anything else” while not causing one regex to claim a command that was really meant for a regex further on in the series is really tricky.

That makes it kind of a wall for people. As soon as you need to do anything it doesn’t support you have to go to a command that is not known to you (since “b” isn’t related to “break set” in any way that a normal user can actually see.)

However, lldb has been around for a while and we only have two unique commands of the form “b[A-Za-z]” in the current lldb command set (br and bt). So I think it would be okay for us to take up a few more second letter commands to make setting breakpoints more convenient. I think adding:

bs (break source) → break set -y

Is -y a new option you would add? I don’t see it. We have --file and --line

Added it yesterday.

ba (break address) → break set -a
bn (break name) → break set -n

would provide a convenient way to set the most common classes of breakpoints while not precluding access to all the other options available to “break set”. We could still leave “b” by itself for the _regex_break command - people who’ve figured out it’s intricacies shouldn’t lose their investment. This would be purely additive.

What do people think?

Can we modify the _regex_break to accept options at the start or end of the command somehow?

When the principle of so much of the rest of the lldb command line is that this sort of positional ordering is NOT necessary, doing this would be a shame. At that point, I think Jonas suggestion of having a command “break break-spec-set” or whatever, that took the breakpoint modify option group and then a specifier as an argument(s) which get parsed in the same way that “_regexp_break” does would be a better long-term supportable option.

Jim

I use "b" for file+line breakpoints and "br set -n" for function
breakpoints, mainly because I couldn't be bothered to figure out how
that works with the "b" command. Now that I have studied the command
once again, I may try using it for function breakpoints as well...

I don't have any hard objections to new aliases (if "b" for name
breakpoints doesn't pan out, I may start using "bn" as a shorthand for
"br set -n"), though I do find the idea of beefing up the "b" command
more appealing.

When we were first devising commands for lldb, we tried to be really
parsimonious with the one & two letter unique command strings that
lldb ships with by default. I was trying to leave us as much
flexibility as possible as we evolved, and I also wanted to make sure
we weren’t taking up all the convenient short commands, leaving a
cramped space for user aliases.

The _regex_break command was added (and aliased by default to ‘b’) as
a way to allow quick access for various common breakpoint setting
options. However it suffers from the problem that you can only
provide the options that are recognized by the _regexp_break command
aliases. For instance, you can’t add the -h option to make a
hardware breakpoint. Because the “_regex_break command works by
passing the command through a series of regex’s stopping at the first
match, trying to extend the regular expressions to also include
“anything else” while not causing one regex to claim a command that
was really meant for a regex further on in the series is really tricky.

That makes it kind of a wall for people. As soon as you need to do
anything it doesn’t support you have to go to a command that is not
known to you (since “b” isn’t related to “break set” in any way that
a normal user can actually see.)

However, lldb has been around for a while and we only have two unique
commands of the form “b[A-Za-z]” in the current lldb command set (br
and bt). So I think it would be okay for us to take up a few more
second letter commands to make setting breakpoints more convenient.
I think adding:

bs (break source) -> break set -y

Is -y a new option you would add? I don't see it. We have --file and
--line

Added it yesterday.

ba (break address) -> break set -a
bn (break name) -> break set -n

would provide a convenient way to set the most common classes of
breakpoints while not precluding access to all the other options
available to “break set”. We could still leave “b” by itself for the
_regex_break command - people who’ve figured out it’s intricacies
shouldn’t lose their investment. This would be purely additive.

What do people think?

Can we modify the _regex_break to accept options at the start or end
of the command somehow?

When the principle of so much of the rest of the lldb command line is
that this sort of positional ordering is NOT necessary, doing this would
be a shame. At that point, I think Jonas suggestion of having a command
“break break-spec-set” or whatever, that took the breakpoint modify
option group and then a specifier as an argument(s) which get parsed in
the same way that “_regexp_break” does would be a better long-term
supportable option.

Couldn't we have "b" command work the same way as the "expr" command? If
the user passes no arguments then he can just do "b whatever". And if he
also wants to add any parameters then he can do "b --hardware -- whatever".

The "--" is slightly unfortunate, but it's at least consistent with our
other commands taking raw input. We could avoid that by making the
command not take raw input. I think most of the "modes" of the "b"
command wouldn't need quoting in most circumstances -- source regex and
"lib`func" modes being exceptions.

Furthermore, with a first-class command we can do a better job on the

help front which is really underwhelming for _regexp_break command aliases.

FWIW, this is the first time that I looked at the help for the "b"
command, and I have to say I found it more understandable than the "br
set" command. :stuck_out_tongue:

"br set" help starts with a long list command switches, which are
supposed to show which options can be used together. I think this sort
of listing is nice when the command has a couple of modes and a few
switches, but it really misses the mark when it ends up listing 11 modes
with approximately 20 switches in each one.

This is then followed by descriptions of the 20 or so switches. This
list is alphabetical, which means the most commonly used options end up
burried between the switches I've never even used.

OTOH, "help b" gives me a reminder of the types of breakpoints I can set
and an example for how to set them. That is what I need most of the
time. The thing I maybe find missing there (and what might also help
folks needing to switch to more powerful "br set") is if each of the
"modes" of the "b" command also listed the equivalent "br set" command.

pl

If these are defined as regular aliases, I wonder how many people would try, say, bn -H whatever and be confused when it doesn’t work because it didn’t do the right thing (such as creating a breakpoint named “-H” in this example). Should these new aliases support flags before and after the positional argument? Personally I think so. But to support that, it seems they’d need to be implemented with command regex. In that case, would it be good to add similar before/after flag composition abilities to b as Greg Clayton suggested?

It hasn’t been mentioned in this thread, but b has undocumented handling for flags: the prefix b - is expanded to breakpoint set -. Because of this I almost never use breakpoint set directly. For whatever it’s worth, this means bn can be achieved as b -n, etc. As Pavel Labath suggested, I think it’s worth updating the help documentation for b to explicitly lead users from b to breakpoint set.

Dave

I think adding:

bs (break source) → break set -y
ba (break address) → break set -a
bn (break name) → break set -n

would provide a convenient way to set the most common classes of breakpoints while not precluding access to all the other options available to “break set”.

If these are defined as regular aliases, I wonder how many people would try, say, bn -H whatever and be confused when it doesn’t work because it didn’t do the right thing (such as creating a breakpoint named “-H” in this example). Should these new aliases support flags before and after the positional argument? Personally I think so. But to support that, it seems they’d need to be implemented with command regex. In that case, would it be good to add similar before/after flag composition abilities to b as Greg Clayton suggested?

Grrr… Apparently command aliases don’t work quite how I intended them to. I thought the intent was that:

(lldb) command alias breakpoint set -y %1

would put the first argument into the %1 position, not the first command word. That way you could preserve the position independence of options. But that’s not what it does. %1 is just the first command word (-H in your example).

The way it works now, mine is not a useful suggestion. When I have some time I’ll play around with how to make that work, until then we can keep discussing the _regex_break command, but the aliases I started out with are unappealing.

Jim

I use "b" for file+line breakpoints and "br set -n" for function
breakpoints, mainly because I couldn't be bothered to figure out how
that works with the "b" command. Now that I have studied the command
once again, I may try using it for function breakpoints as well...

I don't have any hard objections to new aliases (if "b" for name
breakpoints doesn't pan out, I may start using "bn" as a shorthand for
"br set -n"), though I do find the idea of beefing up the "b" command
more appealing.

When we were first devising commands for lldb, we tried to be really
parsimonious with the one & two letter unique command strings that
lldb ships with by default. I was trying to leave us as much
flexibility as possible as we evolved, and I also wanted to make sure
we weren’t taking up all the convenient short commands, leaving a
cramped space for user aliases.

The _regex_break command was added (and aliased by default to ‘b’) as
a way to allow quick access for various common breakpoint setting
options. However it suffers from the problem that you can only
provide the options that are recognized by the _regexp_break command
aliases. For instance, you can’t add the -h option to make a
hardware breakpoint. Because the “_regex_break command works by
passing the command through a series of regex’s stopping at the first
match, trying to extend the regular expressions to also include
“anything else” while not causing one regex to claim a command that
was really meant for a regex further on in the series is really tricky.

That makes it kind of a wall for people. As soon as you need to do
anything it doesn’t support you have to go to a command that is not
known to you (since “b” isn’t related to “break set” in any way that
a normal user can actually see.)

However, lldb has been around for a while and we only have two unique
commands of the form “b[A-Za-z]” in the current lldb command set (br
and bt). So I think it would be okay for us to take up a few more
second letter commands to make setting breakpoints more convenient.
I think adding:

bs (break source) -> break set -y

Is -y a new option you would add? I don't see it. We have --file and
--line

Added it yesterday.

ba (break address) -> break set -a
bn (break name) -> break set -n

would provide a convenient way to set the most common classes of
breakpoints while not precluding access to all the other options
available to “break set”. We could still leave “b” by itself for the
_regex_break command - people who’ve figured out it’s intricacies
shouldn’t lose their investment. This would be purely additive.

What do people think?

Can we modify the _regex_break to accept options at the start or end
of the command somehow?

When the principle of so much of the rest of the lldb command line is
that this sort of positional ordering is NOT necessary, doing this would
be a shame. At that point, I think Jonas suggestion of having a command
“break break-spec-set” or whatever, that took the breakpoint modify
option group and then a specifier as an argument(s) which get parsed in
the same way that “_regexp_break” does would be a better long-term
supportable option.

Couldn't we have "b" command work the same way as the "expr" command? If
the user passes no arguments then he can just do "b whatever". And if he
also wants to add any parameters then he can do "b --hardware -- whatever".

The "--" is slightly unfortunate, but it's at least consistent with our
other commands taking raw input. We could avoid that by making the
command not take raw input. I think most of the "modes" of the "b"
command wouldn't need quoting in most circumstances -- source regex and
"lib`func" modes being exceptions.

If anybody wants to work on this, I think Jonas is right, the first step would be to convert it to an actual command not a regex command. The _regexp-break command is already hard enough to comprehend.

You could still do the actual specifier parsing with a series of regex’s if that seems best, though there might be easier ways to do it. I also don’t think this would need to be a raw command, rather it could be a parsed command with one argument which was the breakpoint specifier and then all the other breakpoint flags.

All the specifications you can currently pass to b are single words w/o spaces in them, or if they do have spaces they are the things you are used to having to quote in lldb: like file names with spaces. I don’t think anybody would mind having to do:

b “file with spaces.c:12”

or

b “+[ObjCClass selector]”

since they have to do that pretty much everywhere else in lldb.

The “b -“ thingie that Dave pointed out is the exception to this, but it would also be unnecessary, since all the other flags would be straightforwardly available.

Furthermore, with a first-class command we can do a better job on the

help front which is really underwhelming for _regexp_break command aliases.

FWIW, this is the first time that I looked at the help for the "b"
command, and I have to say I found it more understandable than the "br
set" command. :stuck_out_tongue:

"br set" help starts with a long list command switches, which are
supposed to show which options can be used together. I think this sort
of listing is nice when the command has a couple of modes and a few
switches, but it really misses the mark when it ends up listing 11 modes
with approximately 20 switches in each one.

This is then followed by descriptions of the 20 or so switches. This
list is alphabetical, which means the most commonly used options end up
burried between the switches I've never even used.

Yes. I’ve said many times before that making “break set” the master command for breakpoint setting was a mistake. I didn’t expect we’d come up with so many useful breakpoint types, each with some common and some independent (or even overlapping) options. It would have been much better to have done:

break set file
break set name
break set address

etc - with a separate subcommand per primary.

This would actually have taken one less letter to type (“b s n” rather than “b s -n”) and make it easier to document the function of the command and its options. For instance when -n is the primary, it means “function on which to set a breakpoint”, but when specified along with -p as the primary, it means “function in which to search for the source pattern”. Right now you either have to make very verbose help strings or leave these distinctions to be guessed. But set up as subcommands, -n would only exist for “break set source-regex” and could be properly documented there.

I think cutting over from the current command to ones arranged like this would be too disruptive, but it might okay to make a “break set2” that follows this pattern. Then we could still support people with scripts that did “break set -n” or whatever, but have a way to switch over to the new one with a little notice.

Jim

BTW: to see what things expand to after reach regex alias, just set this setting first:

(lldb) settings set interpreter.expand-regex-aliases true

Each time you type "b main" it will show you the expansion:

(lldb) b main
breakpoint set --name 'main'
...
(lldb) b main.cpp:12
breakpoint set --file 'main.cpp' --line 12
...

It shows the full expansion.

Greg

The "--" is slightly unfortunate, but it's at least consistent with our
other commands taking raw input. We could avoid that by making the
command not take raw input. I think most of the "modes" of the "b"
command wouldn't need quoting in most circumstances -- source regex and
"lib`func" modes being exceptions.

If anybody wants to work on this, I think Jonas is right, the first step would be to convert it to an actual command not a regex command. The _regexp-break command is already hard enough to comprehend.

You could still do the actual specifier parsing with a series of regex’s if that seems best, though there might be easier ways to do it. I also don’t think this would need to be a raw command, rather it could be a parsed command with one argument which was the breakpoint specifier and then all the other breakpoint flags.

All the specifications you can currently pass to b are single words w/o spaces in them, or if they do have spaces they are the things you are used to having to quote in lldb: like file names with spaces.

The lib`func notation contains a backtick, which is used for expression
substitution in the command interpreter. Currently we seem to be just
dropping an unmatched backtick, which would break that. We could change
it so that the unmatched backtick is kept, though I would actually
prefer to make that an error..

"br set" help starts with a long list command switches, which are
supposed to show which options can be used together. I think this sort
of listing is nice when the command has a couple of modes and a few
switches, but it really misses the mark when it ends up listing 11 modes
with approximately 20 switches in each one.

This is then followed by descriptions of the 20 or so switches. This
list is alphabetical, which means the most commonly used options end up
burried between the switches I've never even used.

Yes. I’ve said many times before that making “break set” the master command for breakpoint setting was a mistake. ...

Restructuring the commands is one thing. It might be a good idea but
there are less invasive things we could do to make this better. Just
restructuring the help output to make the most common use cases easier
to find would help a lot IMO. We could drop or simplify the "synopsis"
section, maybe replacing it with a couple of examples of the most useful
kinds of breakpoints.

Then we could group the options to keep the similar ones together and
make them easier to find/skip. Maybe with groups like:
- options specifying where to set a breakpoint: --file, --line; --name; etc.
- options restricting the reported breakpoint hits:
--thread-id,--thread-name,--condition, etc.
- various modifiers: --disable, --hardware, --one-shot, etc.
- others (?)

The division may not be perfect (like, is --ignore-count a "modifier" or
does it "restrict breakpoint hits"?), but even so I think this would
make that list a lot easier to navigate. But we digress...

BTW: to see what things expand to after reach regex alias, just set

this setting first:

(lldb) settings set interpreter.expand-regex-aliases true

That is cool. I wonder if that should be the default...

pl

The “–” is slightly unfortunate, but it’s at least consistent with our
other commands taking raw input. We could avoid that by making the
command not take raw input. I think most of the “modes” of the “b”
command wouldn’t need quoting in most circumstances – source regex and
“lib`func” modes being exceptions.

If anybody wants to work on this, I think Jonas is right, the first step would be to convert it to an actual command not a regex command. The _regexp-break command is already hard enough to comprehend.

You could still do the actual specifier parsing with a series of regex’s if that seems best, though there might be easier ways to do it. I also don’t think this would need to be a raw command, rather it could be a parsed command with one argument which was the breakpoint specifier and then all the other breakpoint flags.

All the specifications you can currently pass to b are single words w/o spaces in them, or if they do have spaces they are the things you are used to having to quote in lldb: like file names with spaces.

The lib`func notation contains a backtick, which is used for expression
substitution in the command interpreter. Currently we seem to be just
dropping an unmatched backtick, which would break that. We could change
it so that the unmatched backtick is kept, though I would actually
prefer to make that an error…

IMO the backtick parsing in lldb is currently done incorrectly. In the original design, it was supposed to be another form of quote, not a preprocessing stage. I think, for instance, this is more surprising than useful:

(lldb) run
Process 44292 launched: ‘/tmp/a.out’ (x86_64)
Process 44292 stopped

  • thread #1, queue = ‘com.apple.main-thread’, stop reason = breakpoint 1.1
    frame #0: 0x0000000100003f66 a.out`main at variable.c:7
    4 main()
    5 {
    6 int a = 100;
    → 7 printf(“%d\n”, a);
    ^
    8 return 0;
    9 }
    Target 0: (a.out) stopped.

(lldb) expr char *$my_str = “some a other”
(lldb) expr $my_str
(char *) $my_str = 0x00000001001423e0 “some 100 other”

And this has tripped people up in the past.

The intent was to substitute an option value or argument with the result of an expression if it was appropriately marked. If backticks worked that way an inter-word backtick would not be significant.

We could also change the character we print for separating shlib from file name both in how we print the spec and in how we encode it in ‘b’. As long as these two are consistent I don’t think folks would much care what it was…

“br set” help starts with a long list command switches, which are
supposed to show which options can be used together. I think this sort
of listing is nice when the command has a couple of modes and a few
switches, but it really misses the mark when it ends up listing 11 modes
with approximately 20 switches in each one.

This is then followed by descriptions of the 20 or so switches. This
list is alphabetical, which means the most commonly used options end up
burried between the switches I’ve never even used.

Yes. I’ve said many times before that making “break set” the master command for breakpoint setting was a mistake. …

Restructuring the commands is one thing. It might be a good idea but
there are less invasive things we could do to make this better. Just
restructuring the help output to make the most common use cases easier
to find would help a lot IMO. We could drop or simplify the “synopsis”
section, maybe replacing it with a couple of examples of the most useful
kinds of breakpoints.

Then we could group the options to keep the similar ones together and
make them easier to find/skip. Maybe with groups like:

  • options specifying where to set a breakpoint: --file, --line; --name; etc.
  • options restricting the reported breakpoint hits:
    –thread-id,–thread-name,–condition, etc.
  • various modifiers: --disable, --hardware, --one-shot, etc.
  • others (?)

The division may not be perfect (like, is --ignore-count a “modifier” or
does it “restrict breakpoint hits”?), but even so I think this would
make that list a lot easier to navigate. But we digress…

This is already partly done. The primaries for all these settings are always listed first, because they are required for a given form. So you see:

Command Options Usage:
breakpoint set [-DHd] -l [-G ] [-C ] [-c ] [-i ] [-o ] [-q ] [-t ] [-x ] [-T ] [-R ] [-N ] [-u ] [-f ] [-m ] [-s ] [-K ]
breakpoint set [-DHd] -a [-G ] [-C ] [-c ] [-i ] [-o ] [-q ] [-t ] [-x ] [-T ] [-N ] [-s ]
breakpoint set [-DHd] -n [-G ] [-C ] [-c ] [-i ] [-o ] [-q ] [-t ] [-x ] [-T ] [-R ] [-N ] [-f ] [-L ] [-s ] [-K ]

etc. The first entries are always the primaries - how you are setting the breakpoint. The first one is a little odd because it only lists -l. That’s because the file is not required when setting file&line breakpoints (it uses the default file if you don’t specify one.) But the rest mostly make sense. However, you have to know what you are looking for to see this. I’m not sure reordering the other options will help this particular issue much.

OTOH, it would be really useful to maintain OptionGroups when the command options are consed up, and represent this in the help output. Right now, you flatten all the options groups your command uses into one list and that gets sorted and printed. But the OptionGroups do express some of the ordering you are looking for. For instance all the options that “break set” and “break modify” share, i.e. all the ones that effect how you react to hitting a breakpoint rather than how you set it, are in their own OptionGroup.

BTW: to see what things expand to after reach regex alias, just set

this setting first:

(lldb) settings set interpreter.expand-regex-aliases true

That is cool. I wonder if that should be the default…

I don’t think so. People don’t really want to know how the b command works, they just want it to magically work. And my experience is that people really hate extra output. We had a knock-down drag-out fight about the fact that the “po” command used to print the result variable of the object whose “object description” was being printed. So the output was:

(lldb) po foo
(NSWhatever *) $1 = 0x123454
This object is a really great object, use it a lot

And though the extra info was in fact useful, the majority opinion was the people didn’t want to have to look past it for the po result (*). This was not a terribly politely expressed opinion either…

I think if we spit out some text people didn’t understand every time they used the “b” command we would have a similar reaction.

Jim

(*) Then of course the people who did know what it meant and were using the result variable as well complained, so now we have the oddly named “description-verbosity” option to expr to turn it back on again.