[lldb-dev] Break setting aliases...

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Tue Jul 21 10:22:18 PDT 2020

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?



More information about the lldb-dev mailing list