[llvm-bugs] [Bug 47888] New: feature request: builtin support for indirect breakpoints

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 16 23:19:19 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47888

            Bug ID: 47888
           Summary: feature request: builtin support for indirect
                    breakpoints
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: james.widman at gmail.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

Hi all, 

Suppose you have two breakpoints, X and Y, and you want Y to be enabled only
after X is hit, and at-most only once for each time X is hit. So you:

- disable Y
- enable X
- add a command to X: 'breakpoint enable Y'
- configure X to auto-continue after running its commands ('-G true')
- add a command to Y: 'breakpoint disable Y'

This works nicely, and you can chain it further so that when you hit breakpoint
b_1, it enables b_2, which enables b_3, ... which enables b_N, and each b_i in
b_2...b_N will disable itself when hit.

But it can get a little unwieldy, especially since there are several steps to
setting up each link in the chain.

So I'm wondering if it would make sense to have a built-in command for this;
maybe like:

        breakpoint sequence create b_1 b_2 [... b_N]

... which would arrange for each breakpoint in the sequence, except the last,
to one-shot-enable the next breakpoint in the sequence. It would also have
these effects by default:

    1. disable every breakpoint in the sequence except b_1, and

    2. set every breakpoint in the sequence, except the last, to auto-continue

... but this could possibly be controlled with options.

I'm not sure whether this is the best way to design the feature; e.g. you might
alternatively want to declare the sequence first and then add new breakpoints
to that sequence (i.e., breakpoints that didn't exist previously).

On the other hand, when I create a bp sequence, here's how that tends to
happen:

    0. Initially, I don't know that I want a bp sequence.

    1. I create b_N first.

    3. Then then I find out that b_N is being hit in contexts that I _don't_
want, and then...

    4. I create b_(N-1) and chain it to b_N.

...which seems like an argument in favor of
create-breakpoints-first-and-then-construct-a-sequence-from-existing-breakpoints.

Here are a couple of features I looked for before submitting this request:

    - a "one-shot" option to 'breakpoint enable' (so that, if the breakpoint
was disabled before this 'break enable' command, it will go back to being
disabled after it's hit)

    - an '--until-breakpoint <breakpoint>' option to 'process continue', which
would one-shot-enable the breakpoint before continuing


Looking forward to feedback!

--James

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201017/151cf79a/attachment.html>


More information about the llvm-bugs mailing list