<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 --- - Can't set breakpoint in static initializer"
   href="https://llvm.org/bugs/show_bug.cgi?id=25806">25806</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can't set breakpoint in static initializer
          </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>Linux
          </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>tberghammer@google.com
          </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>LLDB don't detect the loading of a shared object file linked against the main
executable before the static initializers are executed for the given module.
Because of this it is not possible to get breakpoint hits in these static
initializers and to display proper debug info in case of a crash in these
codes. (The issue isn't happening for dlopen-ed libraries.)

The issue is demonstrated in TestLoadUnlod.py
LoadUnloadTestCase.test_static_init_during_load test case.

My current understanding of the problem:

The problem is that DynamicLoaderPOSIXDYLD first set a breakpoint on the entry
of the main executable based on the content of auxv (it will be libc.so'_start)
and then set the rendezvous breakpoint when the entry breakpoint is hit. The
static initializers are running before libc.so'_start is called so at this
point we haven't loaded the library list and haven't set the rendezvous
breakpoint either.

I think the correct solution to the problem is to change DynamicLoaderPOSIXDYLD
to set the (current) entry breakpoint at a location what is hit before any code
is executed, but I don't know what is the reasonable location for the
(something what works on all platforms).</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>