[lldb-dev] Break setting aliases...

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Wed Jul 22 10:09:02 PDT 2020

> On Jul 22, 2020, at 9:57 AM, Dave Lee <davelee.com at gmail.com> wrote:
> On Tuesday, July 21, 2020, Jim Ingham via lldb-dev <lldb-dev at lists.llvm.org <mailto:lldb-dev at lists.llvm.org>> wrote:
> 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.


> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200722/1bdca39c/attachment-0001.html>

More information about the lldb-dev mailing list