<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Breakpoint in child process (after fork) hangs the child"
   href="https://llvm.org/bugs/show_bug.cgi?id=30983">30983</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Breakpoint in child process (after fork) hangs the child
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>simon.kagstrom@netinsight.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm afraid I'm using LLDB on OSX Sierra, not built from source.

I'm experiencing a problem when setting breakpoints which are hit by a child
process after a fork. A simple example to trigger the problem can be found
below.

If I set a breakpoint on the "printf("In child\n");" statement, the child
process will hit it without reporting to the parent, and then simply hang there
(so that the printout is never seen).

I assume this is because the breakpoints aren't being reported back to LLDB, as
in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - equivilent of gdb's follow-fork-mode child"
   href="show_bug.cgi?id=17972">Bug 17972</a>. If follow-fork mode won't be implemented, then at least perhaps
breakpoints can be cleared for the child?

#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/user.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(int argc, const char *argv[])
{
  pid_t child;

  child = fork();
  if (child < 0)
    {
      printf("Error\n");
    }
  else if (child == 0)
    {
      printf("In child\n"); // Breakpoint here is bad news!
    }
  else
    {
      int status;
      printf("In parent, child %d\n", child);

      wait(&status);
    }

  return 0;
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>