[lldb-dev] Break setting aliases...

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Tue Jul 21 15:03:08 PDT 2020



> On Jul 21, 2020, at 2:54 PM, Greg Clayton <clayborg at gmail.com> wrote:
> 
> 
> 
>> On Jul 21, 2020, at 10:22 AM, Jim Ingham via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> 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


> 
> 
>> Jim
>> 
>> 
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org <mailto:lldb-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200721/5e4c8259/attachment.html>


More information about the lldb-dev mailing list