<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 - LLDB stopping before function arguments have been initialized"
   href="https://bugs.llvm.org/show_bug.cgi?id=32297">32297</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB stopping before function arguments have been initialized
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </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>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tblodt@icloud.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compile this test program with -fsanitize=address -g:

struct foo {
    int foof;
};

struct bar {
    struct foo barf;
};

void baz(struct bar *bar) {
    struct foo foof = bar->barf;
}

int main() {
    struct bar bar = {};
    baz(&bar);
    return 0;
}

Then start lldb and do this:

(lldb) b baz
Breakpoint 1: where = morph`baz + 41 at generator.c:9, address =
0x0000000100000c49
(lldb) r
Process 45496 launched: '/Users/tbodt/Developer/csc180/fuck/morph' (x86_64)
AddressSanitizer debugger support is active. Memory error breakpoint has been
installed and you can now use the 'memory history' command.
Process 45496 stopped
* thread #1: tid = 0x13ab09, 0x0000000100000c49
morph`baz(bar=0x00007fff5fbff860) + 41 at generator.c:9, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000c49 morph`baz(bar=0x00007fff5fbff860) + 41 at
generator.c:9
   6        struct foo barf;
   7    };
   8
-> 9    void baz(struct bar *bar) {
   10       struct foo foof = bar->barf;
   11   }
   12
(lldb) p bar
(bar *) $0 = 0x00007fff5fbff860
(lldb) up
frame #1: 0x0000000100000e5a morph`main + 234 at generator.c:15
   12
   13   int main() {
   14       struct bar bar = {};
-> 15       baz(&bar);
   16       return 0;
   17   }
   18
(lldb) p &bar
warning: could not load any Objective-C class information. This will
significantly reduce the quality of type information available.
(bar *) $1 = 0x00007fff5fbff840

Notice that when the program stops the arrow is pointing to the top of the
function declaration, not the first line of the function. Also notice that at
that point, bar is not the pointer that was passed into the function. If you
step once in baz, it goes to the first line of the function and bar is now
correct.

I'm not sure whether the bug is ASAN generating code that LLDB can't handle, or
LLDB not correctly handling the code ASAN generates.</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>