<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - feature request: builtin support for indirect breakpoints"
   href="https://bugs.llvm.org/show_bug.cgi?id=47888">47888</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>feature request: builtin support for indirect breakpoints
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>james.widman@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>